+ 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):
|
class ObjectAdmin(admin.ModelAdmin):
|
||||||
pass
|
list_display = ('title', 'ammout', 'uuid', 'img')
|
||||||
|
|
||||||
|
|
||||||
# Register your models here.
|
# 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.
|
# Create your models here.
|
||||||
|
|
||||||
class Object(models.Model):
|
class Object(models.Model):
|
||||||
title = models.TextField(max_length=100, default=None)
|
ammout = models.PositiveIntegerField(default=1, blank=False)
|
||||||
img = models.ImageField(default=None)
|
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)
|
uuid = models.UUIDField(primary_key=True, default=uuid.uuid4, editable=False)
|
||||||
inventarized_date = models.DateTimeField()
|
inventarized_date = models.DateTimeField(blank=False, null=True)
|
||||||
description = models.TextField(max_length=500)
|
description = models.TextField(max_length=500, blank=True)
|
||||||
removed_date = models.DateTimeField()
|
removed_date = models.DateTimeField(blank=True, default=None, null=True)
|
||||||
user_added = models.ForeignKey(User, on_delete=models.CASCADE)
|
user_added = models.ForeignKey(User, on_delete=models.CASCADE, blank=False, null=True)
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,33 @@
|
||||||
from django.shortcuts import render
|
from django.shortcuts import render
|
||||||
from django.contrib.auth.decorators import login_required
|
from django.contrib.auth.decorators import login_required
|
||||||
|
from .forms import ObjectForm
|
||||||
|
from django.utils import timezone
|
||||||
|
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
||||||
@login_required
|
@login_required
|
||||||
def add(request):
|
def add(request):
|
||||||
context = {'title': 'Objekt inventarisieren'}
|
if request.method == 'POST':
|
||||||
|
form = ObjectForm(request.POST)
|
||||||
|
|
||||||
return render(request, 'object_adder/index.html', context)
|
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;
|
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 {
|
.heading {
|
||||||
font-size: 1.6em;
|
font-size: 1.6em;
|
||||||
font-weight: bold;
|
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 {
|
.shadow {
|
||||||
-webkit-box-shadow: 3px 3px 28px -3px rgba(0, 0, 0, 0.1);
|
-webkit-box-shadow: 3px 3px 28px -3px rgba(0, 0, 0, 0.1);
|
||||||
|
|
@ -114,118 +51,32 @@
|
||||||
transition: 0.3s;
|
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 {
|
.red {
|
||||||
color: red;
|
color: red;
|
||||||
}
|
}
|
||||||
|
|
||||||
.yellowgreen {
|
|
||||||
color: yellowgreen;
|
|
||||||
|
.title-wrapper *{
|
||||||
|
vertical-align: middle;
|
||||||
}
|
}
|
||||||
|
|
||||||
.btn-reload {
|
#id_img{
|
||||||
margin-top: 1em;
|
display: inline-block;
|
||||||
|
margin-left: 1.2em;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.uilink {
|
.description-wrapper *{
|
||||||
margin-left: 1.1em;
|
vertical-align: middle;
|
||||||
font-size: 1.3em;
|
|
||||||
order: 2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.bot-btn-cont {
|
.invform *{
|
||||||
height: 3em;
|
margin-top: 1.5em;
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
align-items: center;
|
|
||||||
}
|
}
|
||||||
.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">
|
integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous">
|
||||||
|
|
||||||
<link href="https://fonts.googleapis.com/css?family=Dosis" rel="stylesheet">
|
<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>
|
<title>{{ title }}</title>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -24,7 +27,7 @@
|
||||||
<img src="{% static 'user_manager/images/logo_50_50.png' %}" class="logo">
|
<img src="{% static 'user_manager/images/logo_50_50.png' %}" class="logo">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<span class="welcome">Welcome {{ user.username }}!</span>
|
<span class="welcome">Wilkommen {{ user.username }}!</span>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="navbar-header">
|
<div class="navbar-header">
|
||||||
<img src="{% static 'user_manager/images/logo_50_50.png' %}" class="logo_not_logged_in">
|
<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' %}
|
{% extends 'bases/navbar.html' %}
|
||||||
<html>
|
<html>
|
||||||
{% block content%}
|
{% block content %}
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<p>On this page objects can be added.</p>
|
{% if not obj_name is None %}
|
||||||
</div>
|
<div class="alert alert-info alert-dismissible">
|
||||||
</body>
|
<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 %}
|
{% endblock %}
|
||||||
|
|
||||||
</html>
|
</html>
|
||||||
|
|
@ -12,7 +12,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{% if next %}
|
{% 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 %}
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="col-sm-offset-2 col-sm-10">
|
<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 }}">
|
<input type="hidden" name="next" value="{{ next }}">
|
||||||
<span class="reset"><a href="{% url 'password_reset' %}">Lost password?</a></span>
|
<span class="reset"><a href="{% url 'password_reset' %}">Lost password?</a></span>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,17 @@
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<h3>Right Aligned Navbar</h3>
|
<h3>Inventarium</h3>
|
||||||
<p>The .navbar-right class is used to right-align navigation bar buttons.</p>
|
<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>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue