Compare commits
3 Commits
36769322b4
...
8e25d5dff2
Author | SHA1 | Date | |
---|---|---|---|
8e25d5dff2 | |||
a95b90896e | |||
eea7d4ffa6 |
@ -56,7 +56,7 @@ ROOT_URLCONF = 'lostplaces.urls'
|
||||
TEMPLATES = [
|
||||
{
|
||||
'BACKEND': 'django.template.backends.django.DjangoTemplates',
|
||||
'DIRS': [],
|
||||
'DIRS': [os.path.join(BASE_DIR, 'templates')],
|
||||
'APP_DIRS': True,
|
||||
'OPTIONS': {
|
||||
'context_processors': [
|
||||
@ -129,3 +129,7 @@ MEDIA_ROOT = os.path.join(BASE_DIR, 'uploads')
|
||||
|
||||
# Use custom user model
|
||||
AUTH_USER_MODEL = 'lostplaces_app.Explorer'
|
||||
|
||||
# Templates to use for authentication
|
||||
LOGIN_REDIRECT_URL = 'home'
|
||||
LOGOUT_REDIRECT_URL = 'home'
|
||||
|
@ -17,8 +17,11 @@ 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.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)
|
||||
|
@ -7,11 +7,7 @@
|
||||
<link rel="stylesheet" href="{% static 'main.css' %}">
|
||||
<link rel="icon" type="image/png" href="{% static 'favicon.ico' %}">
|
||||
<title>
|
||||
{% if title%}
|
||||
{{title}}|UrbEx
|
||||
{% else %}
|
||||
Urban Exploration
|
||||
{% endif %}
|
||||
{% block title %}Urban Exploration{% endblock %}
|
||||
</title>
|
||||
</head>
|
||||
<body>
|
||||
|
@ -1,6 +1,8 @@
|
||||
{% extends 'global.html'%}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}Lost Places{% endblock %}
|
||||
|
||||
{% block maincontent %}
|
||||
<ul class="LP-Place__List">
|
||||
{% for place in place_list %}
|
||||
|
@ -1,6 +1,8 @@
|
||||
{% extends 'global.html'%}
|
||||
{% load static %}
|
||||
|
||||
{% block title %}{{place.name}}{% endblock %}
|
||||
|
||||
{% block maincontent %}
|
||||
|
||||
|
||||
|
@ -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/<int:pk>/', place_detail_view, name='place_detail'),
|
||||
path('places/', place_list_view)
|
||||
]
|
@ -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()})
|
||||
|
||||
|
17
source/lostplaces/templates/home.html
Normal file
17
source/lostplaces/templates/home.html
Normal file
@ -0,0 +1,17 @@
|
||||
{% extends 'global.html'%}
|
||||
{% load static %}
|
||||
|
||||
# {% block title %}Start{% endblock %}
|
||||
|
||||
{% block maincontent %}
|
||||
|
||||
{% if user.is_authenticated %}
|
||||
Hi {{ user.username }}!
|
||||
<p><a href="{% url 'logout' %}">logout</a></p>
|
||||
{% else %}
|
||||
<p>Du bist nicht eingeloggt.</p>
|
||||
<a href="{% url 'login' %}">login</a> |
|
||||
<a href="{% url 'signup' %}">signup</a>
|
||||
{% endif %}
|
||||
|
||||
{% endblock maincontent %}
|
15
source/lostplaces/templates/registration/login.html
Normal file
15
source/lostplaces/templates/registration/login.html
Normal file
@ -0,0 +1,15 @@
|
||||
{% extends 'global.html'%}
|
||||
{% load static %}
|
||||
|
||||
# {% block title %}Login{% endblock %}
|
||||
|
||||
{% block maincontent %}
|
||||
|
||||
<h2>Login</h2>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit">Login</button>
|
||||
</form>
|
||||
|
||||
{% endblock maincontent %}
|
15
source/lostplaces/templates/signup.html
Normal file
15
source/lostplaces/templates/signup.html
Normal file
@ -0,0 +1,15 @@
|
||||
{% extends 'global.html'%}
|
||||
{% load static %}
|
||||
|
||||
# {% block title %}Registrierung{% endblock %}
|
||||
|
||||
{% block maincontent %}
|
||||
|
||||
<h2>Registrierung</h2>
|
||||
<form method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<button type="submit">Sign up</button>
|
||||
</form>
|
||||
|
||||
{% endblock maincontent %}
|
Loading…
Reference in New Issue
Block a user