diff --git a/source/lostplaces/lostplaces/urls.py b/source/lostplaces/lostplaces/urls.py index d06e2ae..5f9f908 100644 --- a/source/lostplaces/lostplaces/urls.py +++ b/source/lostplaces/lostplaces/urls.py @@ -16,9 +16,12 @@ Including another URLconf from django.contrib import admin from django.conf import settings from django.conf.urls.static import static -from django.urls import path, include +from django.urls import path, include +from django.views.generic.base import TemplateView urlpatterns = [ + path('', TemplateView.as_view(template_name='home.html'), name='home'), path('admin/', admin.site.urls), + path('explorers/', include('django.contrib.auth.urls')), path('', include('lostplaces_app.urls')), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/source/lostplaces/lostplaces_app/urls.py b/source/lostplaces/lostplaces_app/urls.py index 7f08398..2eb4107 100644 --- a/source/lostplaces/lostplaces_app/urls.py +++ b/source/lostplaces/lostplaces_app/urls.py @@ -1,8 +1,9 @@ from django.urls import path -from .views import hello_world, place_detail_view, place_list_view +from .views import hello_world, place_detail_view, place_list_view, SignUpView urlpatterns = [ - path('hello_world/', hello_world), + path('hello_world/', hello_world), # You know what this is :P + path('signup/', SignUpView.as_view(), name='signup'), path('place//', place_detail_view, name='place_detail'), path('places/', place_list_view) ] \ No newline at end of file diff --git a/source/lostplaces/lostplaces_app/views.py b/source/lostplaces/lostplaces_app/views.py index a1fcc25..3656295 100644 --- a/source/lostplaces/lostplaces_app/views.py +++ b/source/lostplaces/lostplaces_app/views.py @@ -1,8 +1,17 @@ from django.shortcuts import render +from django.urls import reverse_lazy +from django.views.generic.edit import CreateView + +from .forms import ExplorerCreationForm from .models import Place # Create your views here. +class SignUpView(CreateView): + form_class = ExplorerCreationForm + success_url = reverse_lazy('login') + template_name = 'signup.html' + def place_list_view(request,): return render(request, 'placeList.html', {'place_list':Place.objects.all()}) diff --git a/source/lostplaces/templates/base.html b/source/lostplaces/templates/base.html deleted file mode 100644 index e69de29..0000000 diff --git a/source/lostplaces/templates/home.html b/source/lostplaces/templates/home.html index e69de29..a3ee862 100644 --- a/source/lostplaces/templates/home.html +++ b/source/lostplaces/templates/home.html @@ -0,0 +1,17 @@ +{% extends 'global.html'%} +{% load static %} + +# {% block title %}Start{% endblock %} + +{% block maincontent %} + +{% if user.is_authenticated %} + Hi {{ user.username }}! +

logout

+{% else %} +

Du bist nicht eingeloggt.

+ login | + signup +{% endif %} + +{% endblock maincontent %} \ No newline at end of file diff --git a/source/lostplaces/templates/registration/login.html b/source/lostplaces/templates/registration/login.html index e69de29..afd54d9 100644 --- a/source/lostplaces/templates/registration/login.html +++ b/source/lostplaces/templates/registration/login.html @@ -0,0 +1,15 @@ +{% extends 'global.html'%} +{% load static %} + +# {% block title %}Login{% endblock %} + +{% block maincontent %} + +

Login

+
+ {% csrf_token %} + {{ form.as_p }} + +
+ +{% endblock maincontent %} \ No newline at end of file diff --git a/source/lostplaces/templates/signup.html b/source/lostplaces/templates/signup.html index e69de29..47e2598 100644 --- a/source/lostplaces/templates/signup.html +++ b/source/lostplaces/templates/signup.html @@ -0,0 +1,15 @@ +{% extends 'global.html'%} +{% load static %} + +# {% block title %}Registrierung{% endblock %} + +{% block maincontent %} + +

Registrierung

+
+ {% csrf_token %} + {{ form.as_p }} + +
+ +{% endblock maincontent %} \ No newline at end of file