created object adder app

This commit is contained in:
Clemens-Dautermann 2018-12-18 19:27:15 +01:00
parent 8e855e0748
commit 594712650c
15 changed files with 71 additions and 4 deletions

View file

@ -8,4 +8,4 @@ class SignUpForm(UserCreationForm):
class Meta:
model = User
fields = ('username', 'first_name', 'last_name', 'email', 'password1', 'password2', )
fields = ('username', 'first_name', 'last_name', 'email', 'password1', 'password2',)

View file

@ -11,6 +11,7 @@
integrity="sha384-hWVjflwFxL6sNzntih27bfxkr27PmbbK/iSvJ+a4+0owXq79v+lsFkW54bOGbiDQ" crossorigin="anonymous">
<link href="https://fonts.googleapis.com/css?family=Dosis" rel="stylesheet">
<title>{{ title }}</title>
</head>
@ -32,8 +33,7 @@
<ul class="nav navbar-nav">
<li><a href="{% url 'index' %}">Home</a></li>
{% if user.is_authenticated %}
{% else %}
<li><a href="#">Page 2</a></li>
<li><a href="{% url 'add' %}">Objekt inventarisieren</a></li>
{% endif %}
</ul>
{% if user.is_authenticated %}

View file

@ -0,0 +1,12 @@
{% extends 'bases/navbar.html' %}
<html>
{% block content%}
<body>
<div class="container">
<p>On this page objects can be added.</p>
</div>
</body>
{% endblock %}
</html>

View file

@ -11,6 +11,7 @@ def index(request):
def register(request):
if request.method == 'POST':
form = SignUpForm(request.POST)
title = 'Login'
if form.is_valid():
form.save()
@ -22,6 +23,7 @@ def register(request):
else:
form = SignUpForm()
title = 'Registrieren'
context = {'form': form}
context = {'form': form, 'title': title}
return render(request, 'registration/register.html', context)