+ Implemented inventarization
+ minor translation fixes
This commit is contained in:
parent
e0b98dabce
commit
5877b83424
10 changed files with 121 additions and 185 deletions
|
|
@ -3,7 +3,7 @@ from .models import Object
|
|||
|
||||
|
||||
class ObjectAdmin(admin.ModelAdmin):
|
||||
pass
|
||||
list_display = ('title', 'ammout', 'uuid', 'img')
|
||||
|
||||
|
||||
# Register your models here.
|
||||
|
|
|
|||
12
invsystem/object_adder/forms.py
Normal file
12
invsystem/object_adder/forms.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
from django.forms import ModelForm, TextInput
|
||||
|
||||
from .models import Object
|
||||
|
||||
|
||||
class ObjectForm(ModelForm):
|
||||
class Meta:
|
||||
model = Object
|
||||
fields = ('ammout', 'title', 'img', 'description')
|
||||
widgets = {
|
||||
'title': TextInput(),
|
||||
}
|
||||
|
|
@ -6,10 +6,11 @@ from django.contrib.auth.models import User
|
|||
# Create your models here.
|
||||
|
||||
class Object(models.Model):
|
||||
title = models.TextField(max_length=100, default=None)
|
||||
img = models.ImageField(default=None)
|
||||
ammout = models.PositiveIntegerField(default=1, blank=False)
|
||||
title = models.TextField(max_length=100, default=None, blank=False)
|
||||
img = models.ImageField(default=None, blank=True)
|
||||
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||
inventarized_date = models.DateTimeField()
|
||||
description = models.TextField(max_length=500)
|
||||
removed_date = models.DateTimeField()
|
||||
user_added = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||
inventarized_date = models.DateTimeField(blank=False, null=True)
|
||||
description = models.TextField(max_length=500, blank=True)
|
||||
removed_date = models.DateTimeField(blank=True, default=None, null=True)
|
||||
user_added = models.ForeignKey(User, on_delete=models.CASCADE, blank=False, null=True)
|
||||
|
|
|
|||
|
|
@ -1,11 +1,33 @@
|
|||
from django.shortcuts import render
|
||||
from django.contrib.auth.decorators import login_required
|
||||
from .forms import ObjectForm
|
||||
from django.utils import timezone
|
||||
|
||||
|
||||
# Create your views here.
|
||||
|
||||
@login_required
|
||||
def add(request):
|
||||
context = {'title': 'Objekt inventarisieren'}
|
||||
if request.method == 'POST':
|
||||
form = ObjectForm(request.POST)
|
||||
|
||||
if form.is_valid():
|
||||
try:
|
||||
obj = form.save(commit=True)
|
||||
except OverflowError:
|
||||
context = {'title': 'Fehler!',
|
||||
'error': 'Weder in den Chemieraum noch in eine Variable des Datentypes SQLite INTEGER passen mehr als 9223372036854775807 Objekte. Bitte inventarisieren sie das Objekt neu.'}
|
||||
return render(request, 'object_adder/error.html', context)
|
||||
|
||||
obj.inventarized_date = timezone.now()
|
||||
obj.removed_date = None
|
||||
obj.user_added = request.user
|
||||
obj.save()
|
||||
|
||||
context = {'title': 'Objekt inventarisieren', 'form': ObjectForm,
|
||||
'obj_name': form.cleaned_data.get('title')}
|
||||
return render(request, 'object_adder/index.html', context)
|
||||
|
||||
else:
|
||||
context = {'title': 'Objekt inventarisieren', 'form': ObjectForm}
|
||||
return render(request, 'object_adder/index.html', context)
|
||||
|
|
|
|||
|
|
@ -36,75 +36,12 @@
|
|||
position: relative;
|
||||
}
|
||||
|
||||
.error {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.userlist {
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
.profilecontainer {
|
||||
height: 60px;
|
||||
margin: 20px;
|
||||
padding: 10px;
|
||||
|
||||
}
|
||||
|
||||
.profilecontainer:hover {
|
||||
height: 60px;
|
||||
margin: 20px;
|
||||
-webkit-box-shadow: 3px 3px 28px -3px rgba(0, 0, 0, 0.64);
|
||||
-moz-box-shadow: 3px 3px 28px -3px rgba(0, 0, 0, 0.64);
|
||||
box-shadow: 3px 3px 28px -3px rgba(0, 0, 0, 0.64);
|
||||
border-radius: 10px;
|
||||
transition: 0.3s;
|
||||
|
||||
}
|
||||
|
||||
.profilepic {
|
||||
height: 50px;
|
||||
float: left;
|
||||
border-radius: 50%;
|
||||
margin-top: -5px;
|
||||
}
|
||||
|
||||
.profilename {
|
||||
position: relative;
|
||||
top: 16%;
|
||||
margin-left: 10px;
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
.heading {
|
||||
font-size: 1.6em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.btn-info {
|
||||
margin-left: 3%;
|
||||
}
|
||||
|
||||
.imgcontainer {
|
||||
float: left;
|
||||
}
|
||||
|
||||
.profilepic-big {
|
||||
border-radius: 50%;
|
||||
margin-left: 70px;
|
||||
-webkit-box-shadow: 3px 3px 28px -3px rgba(0, 0, 0, 0.1);
|
||||
-moz-box-shadow: 3px 3px 28px -3px rgba(0, 0, 0, 0.1);
|
||||
box-shadow: 3px 3px 28px -3px rgba(0, 0, 0, 0.1);
|
||||
transition: 0.3s;
|
||||
margin-top: 15px;
|
||||
}
|
||||
|
||||
.info {
|
||||
font-size: 1.3em;
|
||||
margin: 20px;
|
||||
padding-top: 20px;
|
||||
padding-bottom: 20px;
|
||||
}
|
||||
|
||||
.shadow {
|
||||
-webkit-box-shadow: 3px 3px 28px -3px rgba(0, 0, 0, 0.1);
|
||||
|
|
@ -114,118 +51,32 @@
|
|||
transition: 0.3s;
|
||||
}
|
||||
|
||||
.verified {
|
||||
height: 23px;
|
||||
width: 23px;
|
||||
}
|
||||
|
||||
.search {
|
||||
width: 210px;
|
||||
box-sizing: border-box;
|
||||
border: 2px solid #ccc;
|
||||
border-radius: 4px;
|
||||
font-size: 16px;
|
||||
background-color: white;
|
||||
background-position: 10px 10px;
|
||||
background-size: 24px 24px;
|
||||
background-repeat: no-repeat;
|
||||
padding: 12px 20px 12px 40px;
|
||||
-webkit-transition: width 0.4s ease-in-out;
|
||||
transition: width 0.4s ease-in-out;
|
||||
margin-bottom: 20px;
|
||||
}
|
||||
|
||||
.search:focus {
|
||||
width: 50%;
|
||||
}
|
||||
|
||||
.btn-del {
|
||||
margin-left: 30px;
|
||||
}
|
||||
|
||||
.profilepic-1 {
|
||||
height: 50px;
|
||||
float: left;
|
||||
border-radius: 50%;
|
||||
margin-top: -11px;
|
||||
margin-right: 10px;
|
||||
|
||||
}
|
||||
|
||||
.bot {
|
||||
font-size: 1.3em;
|
||||
margin-top: 1em;
|
||||
}
|
||||
|
||||
bot:hover {
|
||||
-webkit-box-shadow: 3px 3px 28px -3px rgba(0, 0, 0, 0.1);
|
||||
-moz-box-shadow: 3px 3px 28px -3px rgba(0, 0, 0, 0.1);
|
||||
box-shadow: 3px 3px 28px -3px rgba(0, 0, 0, 0.1);
|
||||
border-radius: 10px;
|
||||
transition: 0.3s;
|
||||
}
|
||||
|
||||
.botheading {
|
||||
margin-left: 0.5em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.nodec {
|
||||
list-style-type: none;
|
||||
}
|
||||
|
||||
.description {
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
.detaillist {
|
||||
margin-top: 20px;
|
||||
margin-bottom: 20px;
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
.startbutton {
|
||||
margin-left: 1em;
|
||||
margin-top: 1em;
|
||||
float: left;
|
||||
order: 1;
|
||||
|
||||
}
|
||||
|
||||
.notrunning {
|
||||
color: red;
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
.running {
|
||||
color: greenyellow;
|
||||
margin-left: 1em;
|
||||
}
|
||||
|
||||
.red {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.yellowgreen {
|
||||
color: yellowgreen;
|
||||
|
||||
|
||||
.title-wrapper *{
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.btn-reload {
|
||||
margin-top: 1em;
|
||||
#id_img{
|
||||
display: inline-block;
|
||||
margin-left: 1.2em;
|
||||
|
||||
}
|
||||
|
||||
.uilink {
|
||||
margin-left: 1.1em;
|
||||
font-size: 1.3em;
|
||||
order: 2;
|
||||
.description-wrapper *{
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.bot-btn-cont {
|
||||
height: 3em;
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
align-items: center;
|
||||
.invform *{
|
||||
margin-top: 1.5em;
|
||||
}
|
||||
.stop-api-button{
|
||||
margin-top: 2em;
|
||||
|
||||
#id_description{
|
||||
width: 18em;
|
||||
height: 5em;
|
||||
}
|
||||
|
|
@ -11,6 +11,9 @@
|
|||
integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous">
|
||||
|
||||
<link href="https://fonts.googleapis.com/css?family=Dosis" rel="stylesheet">
|
||||
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
|
||||
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
|
||||
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
|
||||
<title>{{ title }}</title>
|
||||
|
||||
|
||||
|
|
@ -24,7 +27,7 @@
|
|||
<img src="{% static 'user_manager/images/logo_50_50.png' %}" class="logo">
|
||||
|
||||
</div>
|
||||
<span class="welcome">Welcome {{ user.username }}!</span>
|
||||
<span class="welcome">Wilkommen {{ user.username }}!</span>
|
||||
{% else %}
|
||||
<div class="navbar-header">
|
||||
<img src="{% static 'user_manager/images/logo_50_50.png' %}" class="logo_not_logged_in">
|
||||
|
|
|
|||
8
invsystem/user_manager/templates/object_adder/error.html
Normal file
8
invsystem/user_manager/templates/object_adder/error.html
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{% extends 'bases/navbar.html' %}
|
||||
<html>
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<p class="red">{{ error }}</p>
|
||||
</div>
|
||||
{% endblock %}
|
||||
</html>
|
||||
|
|
@ -1,12 +1,42 @@
|
|||
{% extends 'bases/navbar.html' %}
|
||||
<html>
|
||||
{% block content%}
|
||||
{% block content %}
|
||||
|
||||
<body>
|
||||
<div class="container">
|
||||
<p>On this page objects can be added.</p>
|
||||
</div>
|
||||
</body>
|
||||
<body>
|
||||
<div class="container">
|
||||
{% if not obj_name is None %}
|
||||
<div class="alert alert-info alert-dismissible">
|
||||
<a href="#" class="close" data-dismiss="alert" aria-label="close">×</a>
|
||||
Das Objekt <strong>{{ obj_name }}</strong> wurde inventarisiert!
|
||||
</div>
|
||||
{% endif %}
|
||||
<form method="POST" class="post-form invform">
|
||||
{% csrf_token %}
|
||||
<div class="ammout-wrapper">
|
||||
{{ form.ammout.errors }}
|
||||
<label for="{{ form.ammout.id_for_lable }}">Anzahl:</label>
|
||||
{{ form.ammout }}
|
||||
</div>
|
||||
<div class="title-wrapper">
|
||||
{{ form.title.errors }}
|
||||
<label for="{{ form.title.id_for_lable }}">Objekt:</label>
|
||||
{{ form.title }}
|
||||
</div>
|
||||
<div class="img-wrapper">
|
||||
{{ form.img.errors }}
|
||||
<label for="{{ form.img.id_for_lable }}">Bild:</label>
|
||||
{{ form.img }}
|
||||
</div>
|
||||
<div class="description-wrapper">
|
||||
{{ form.description.errors }}
|
||||
<label for="{{ form.description.id_for_lable }}">Beschreibung:</label>
|
||||
{{ form.description }}
|
||||
</div>
|
||||
|
||||
<button type="submit" class="save btn btn-primary">inventarisieren</button>
|
||||
</form>
|
||||
</div>
|
||||
</body>
|
||||
{% endblock %}
|
||||
|
||||
</html>
|
||||
|
|
@ -12,7 +12,7 @@
|
|||
{% endif %}
|
||||
|
||||
{% if next %}
|
||||
<p class="error">You cannot access that page without being logged in.</p>
|
||||
<p class="error">Sie müssen sich zuerst anmelden um diese Seite zu besuchen.</p>
|
||||
{% endif %}
|
||||
|
||||
|
||||
|
|
@ -33,7 +33,7 @@
|
|||
|
||||
<div class="form-group">
|
||||
<div class="col-sm-offset-2 col-sm-10">
|
||||
<button type="submit" class="btn btn-default">Login</button>
|
||||
<button type="submit" class="btn btn-primary">Login</button>
|
||||
<input type="hidden" name="next" value="{{ next }}">
|
||||
<span class="reset"><a href="{% url 'password_reset' %}">Lost password?</a></span>
|
||||
|
||||
|
|
|
|||
|
|
@ -4,8 +4,17 @@
|
|||
|
||||
<body>
|
||||
<div class="container">
|
||||
<h3>Right Aligned Navbar</h3>
|
||||
<p>The .navbar-right class is used to right-align navigation bar buttons.</p>
|
||||
<h3>Inventarium</h3>
|
||||
<p>Mit diesem System können allerlei Dinge inventarisiert werden.</p>
|
||||
<p>Zum Beispiel: </p>
|
||||
<ul>
|
||||
<li>Krims</li>
|
||||
<li>Krams</li>
|
||||
<li>Dings</li>
|
||||
<li>Bums</li>
|
||||
</ul>
|
||||
<h3>UUUUUND: </h3>
|
||||
<h1>ZEUGS!!!</h1>
|
||||
</div>
|
||||
</body>
|
||||
{% endblock %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue