Compare commits
8 Commits
4a6c3b7606
...
86d0a300ae
Author | SHA1 | Date | |
---|---|---|---|
86d0a300ae | |||
049b672c00 | |||
b54e81d372 | |||
dc318d4f98 | |||
045786c7ca | |||
3ab5bf6826 | |||
ca1bc12e88 | |||
57c0889c4e |
2
Pipfile
2
Pipfile
@ -8,7 +8,7 @@ pylint = "*"
|
|||||||
|
|
||||||
[packages]
|
[packages]
|
||||||
django = "*"
|
django = "*"
|
||||||
django-thumbs-v2 = "*"
|
easy-thumbnails = "*"
|
||||||
image = "*"
|
image = "*"
|
||||||
django-widget-tweaks = "*"
|
django-widget-tweaks = "*"
|
||||||
# Commented out to not explicitly specify Python3 subversion.
|
# Commented out to not explicitly specify Python3 subversion.
|
||||||
|
@ -41,7 +41,7 @@ INSTALLED_APPS = [
|
|||||||
'django.contrib.sessions',
|
'django.contrib.sessions',
|
||||||
'django.contrib.messages',
|
'django.contrib.messages',
|
||||||
'django.contrib.staticfiles',
|
'django.contrib.staticfiles',
|
||||||
'django_thumbs',
|
'easy_thumbnails',
|
||||||
'widget_tweaks',
|
'widget_tweaks',
|
||||||
]
|
]
|
||||||
|
|
||||||
@ -137,3 +137,11 @@ AUTH_USER_MODEL = 'lostplaces_app.Explorer'
|
|||||||
# Templates to use for authentication
|
# Templates to use for authentication
|
||||||
LOGIN_REDIRECT_URL = 'home'
|
LOGIN_REDIRECT_URL = 'home'
|
||||||
LOGOUT_REDIRECT_URL = 'home'
|
LOGOUT_REDIRECT_URL = 'home'
|
||||||
|
|
||||||
|
THUMBNAIL_ALIASES = {
|
||||||
|
'': {
|
||||||
|
'thumbnail': {'size': (390, 220), 'crop': True},
|
||||||
|
'hero': {'size': (700, 400), 'crop': True},
|
||||||
|
'large': {'size': (1920, 1080), 'crop': True},
|
||||||
|
},
|
||||||
|
}
|
@ -24,7 +24,6 @@ from django.urls import path, include
|
|||||||
from django.views.generic.base import TemplateView
|
from django.views.generic.base import TemplateView
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('', TemplateView.as_view(template_name='home.html'), name='home'),
|
|
||||||
path('admin/', admin.site.urls),
|
path('admin/', admin.site.urls),
|
||||||
path('explorers/', include('django.contrib.auth.urls')),
|
path('explorers/', include('django.contrib.auth.urls')),
|
||||||
path('', include('lostplaces_app.urls')),
|
path('', include('lostplaces_app.urls')),
|
||||||
|
@ -11,6 +11,18 @@ class ExplorerCreationForm(UserCreationForm):
|
|||||||
class Meta:
|
class Meta:
|
||||||
model = Explorer
|
model = Explorer
|
||||||
fields = ('username', 'email')
|
fields = ('username', 'email')
|
||||||
|
voucher = forms.CharField(max_length=10, help_text='The Voucher you got from an administrator')
|
||||||
|
|
||||||
|
def is_valid(self):
|
||||||
|
super().is_valid()
|
||||||
|
sumitted_voucher = self.cleaned_data.get('voucher')
|
||||||
|
try:
|
||||||
|
fetched_voucher = Voucher.objects.get(code=sumitted_voucher)
|
||||||
|
except Voucher.DoesNotExist:
|
||||||
|
return False
|
||||||
|
|
||||||
|
fetched_voucher.delete()
|
||||||
|
return True
|
||||||
|
|
||||||
class ExplorerChangeForm(UserChangeForm):
|
class ExplorerChangeForm(UserChangeForm):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
@ -0,0 +1,18 @@
|
|||||||
|
# Generated by Django 3.0.9 on 2020-08-03 16:36
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('lostplaces_app', '0008_auto_20200801_1044'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='place',
|
||||||
|
name='submitted_when',
|
||||||
|
field=models.DateTimeField(auto_now_add=True, null=True),
|
||||||
|
),
|
||||||
|
]
|
@ -0,0 +1,20 @@
|
|||||||
|
# Generated by Django 3.0.9 on 2020-08-03 17:07
|
||||||
|
|
||||||
|
from django.db import migrations
|
||||||
|
import easy_thumbnails.fields
|
||||||
|
import lostplaces_app.models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('lostplaces_app', '0009_place_submitted_when'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AlterField(
|
||||||
|
model_name='placeimage',
|
||||||
|
name='filename',
|
||||||
|
field=easy_thumbnails.fields.ThumbnailerImageField(upload_to=lostplaces_app.models.generate_image_upload_path),
|
||||||
|
),
|
||||||
|
]
|
@ -9,7 +9,7 @@ import uuid
|
|||||||
from django.db import models
|
from django.db import models
|
||||||
from django.dispatch import receiver
|
from django.dispatch import receiver
|
||||||
from django.contrib.auth.models import AbstractUser
|
from django.contrib.auth.models import AbstractUser
|
||||||
from django_thumbs.fields import ImageThumbsField
|
from easy_thumbnails.fields import ThumbnailerImageField
|
||||||
|
|
||||||
# Create your models here.
|
# Create your models here.
|
||||||
|
|
||||||
@ -42,6 +42,7 @@ class Place (models.Model):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
name = models.CharField(max_length=50)
|
name = models.CharField(max_length=50)
|
||||||
|
submitted_when = models.DateTimeField(auto_now_add=True, null=True)
|
||||||
submitted_by = models.ForeignKey(
|
submitted_by = models.ForeignKey(
|
||||||
Explorer,
|
Explorer,
|
||||||
on_delete=models.SET_NULL,
|
on_delete=models.SET_NULL,
|
||||||
@ -78,11 +79,7 @@ class PlaceImage (models.Model):
|
|||||||
)
|
)
|
||||||
|
|
||||||
description = models.TextField(blank=True)
|
description = models.TextField(blank=True)
|
||||||
filename = ImageThumbsField(
|
filename = ThumbnailerImageField(upload_to=generate_image_upload_path)
|
||||||
upload_to=generate_image_upload_path,
|
|
||||||
max_length=50,
|
|
||||||
sizes=SIZES
|
|
||||||
)
|
|
||||||
place = models.ForeignKey(
|
place = models.ForeignKey(
|
||||||
Place,
|
Place,
|
||||||
on_delete=models.CASCADE,
|
on_delete=models.CASCADE,
|
||||||
|
@ -1,11 +1,3 @@
|
|||||||
@font-face {
|
|
||||||
font-family: Crimson;
|
|
||||||
src: url("fonts/Crimson/CrimsonText-Regular.ttf"), url("fonts/Crimson/CrimsonText-Bold.ttf"), url("fonts/Crimson/CrimsonText-Italic.ttf"); }
|
|
||||||
|
|
||||||
@font-face {
|
|
||||||
font-family: Montserrat;
|
|
||||||
src: url("fonts/Montserrat/Montserrat-Regular.otf"), url("fonts/Montserrat/Montserrat-Bold.otf"), url("fonts/Montserrat/Montserrat-Italic.otf"); }
|
|
||||||
|
|
||||||
.LP-Link {
|
.LP-Link {
|
||||||
color: #565656;
|
color: #565656;
|
||||||
text-decoration: none;
|
text-decoration: none;
|
||||||
@ -420,6 +412,9 @@
|
|||||||
.LP-HorizontalLine {
|
.LP-HorizontalLine {
|
||||||
color: #565656; }
|
color: #565656; }
|
||||||
|
|
||||||
|
.LP-Section {
|
||||||
|
clear: both; }
|
||||||
|
|
||||||
@media (max-width: 650px) {
|
@media (max-width: 650px) {
|
||||||
.LP-MainContainer {
|
.LP-MainContainer {
|
||||||
width: 100%; } }
|
width: 100%; } }
|
||||||
|
@ -4,13 +4,45 @@
|
|||||||
# {% block title %}Place erstellen{% endblock %}
|
# {% block title %}Place erstellen{% endblock %}
|
||||||
|
|
||||||
{% block maincontent %}
|
{% block maincontent %}
|
||||||
|
<form class="LP-Form" method="POST" enctype="multipart/form-data">
|
||||||
<h2>Place erstellen</h2>
|
<fieldset class="LP-Form__Fieldset">
|
||||||
<form method="post" enctype="multipart/form-data">
|
<legend class="LP-Form__Legend">Place erstellen</legend>
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ place_form.as_p }}
|
<div class="LP-Form__Composition LP-Form__Composition--breakable">
|
||||||
{{ place_image_form.as_p }}
|
<div class="LP-Form__Field">
|
||||||
<button type="submit">Abschicken</button>
|
{% include 'partials/form/inputField.html' with field=place_form.name %}
|
||||||
|
</div>
|
||||||
|
<div class="LP-Form__Field">
|
||||||
|
{% include 'partials/form/inputField.html' with field=place_form.location %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="LP-Form__Composition LP-Form__Composition--breakable">
|
||||||
|
<div class="LP-Form__Field">
|
||||||
|
{% include 'partials/form/inputField.html' with field=place_form.latitude %}
|
||||||
|
</div>
|
||||||
|
<div class="LP-Form__Field">
|
||||||
|
{% include 'partials/form/inputField.html' with field=place_form.longitude %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="LP-Form__Composition">
|
||||||
|
<div class="LP-Form__Field">
|
||||||
|
{% include 'partials/form/inputField.html' with field=place_form.description %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="LP-Form__Composition">
|
||||||
|
<div class="LP-Form__Field">
|
||||||
|
{% include 'partials/form/inputField.html' with field=place_image_form.filename %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="LP-Form__Composition">
|
||||||
|
<input type="submit" class="LP-Button" value="Abschicken"/>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% endblock maincontent %}
|
{% endblock maincontent %}
|
54
lostplaces/lostplaces_app/templates/home.html
Normal file
54
lostplaces/lostplaces_app/templates/home.html
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
{% 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 %}
|
||||||
|
|
||||||
|
<div class="LP-PlaceGrid">
|
||||||
|
<h1 class="LP-Headline LP-Headline">Explorere the latest locations</h1>
|
||||||
|
<ul class="LP-PlaceGrid__Grid">
|
||||||
|
{% for place in place_list %}
|
||||||
|
<li class="LP-PlaceGrid__Item">
|
||||||
|
<a href="{% url 'place_detail' pk=place.pk %}" class="LP-Link">
|
||||||
|
<article class="LP-PlaceTeaser">
|
||||||
|
<div class="LP-PlaceTeaser__Image">
|
||||||
|
<img class="LP-Image" src="{{ place.images.first.filename.thumbnail.url}}" />
|
||||||
|
</div>
|
||||||
|
<div class="LP-PlaceTeaser__Meta">
|
||||||
|
<div class="LP-PlaceTeaser__Info">
|
||||||
|
<span class="LP-PlaceTeaser__Title">
|
||||||
|
<h1 class="LP-Headline LP-Headline--teaser">{{place.name}}</h1>
|
||||||
|
</span>
|
||||||
|
<span class="LP-PlaceTeaser__Detail">
|
||||||
|
<p class="LP-Paragraph">{{place.location}}</p>
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="LP-PlaceTeaser__Description">
|
||||||
|
<p class="LP-Paragraph">{{place.description}}</p>
|
||||||
|
</div>
|
||||||
|
<div class="LP-PlaceTeaser__Icons">
|
||||||
|
<ul class="LP-Icon__List">
|
||||||
|
<li class="LP-Icon__Item"><img class="LP-Icon" src="{% static '/icons/favourite.svg' %}" /></li>
|
||||||
|
<li class="LP-Icon__Item"><img class="LP-Icon" src="{% static '/icons/location.svg' %}" /></li>
|
||||||
|
<li class="LP-Icon__Item"><img class="LP-Icon" src="{% static '/icons/flag.svg' %}" /></li>
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</article>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
{% endfor %}
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{% endblock maincontent %}
|
@ -10,7 +10,7 @@
|
|||||||
<a href="{% url 'place_detail' pk=place.pk %}" class="LP-Link">
|
<a href="{% url 'place_detail' pk=place.pk %}" class="LP-Link">
|
||||||
<article class="LP-Place">
|
<article class="LP-Place">
|
||||||
<div class="LP-Place__ImageContainer">
|
<div class="LP-Place__ImageContainer">
|
||||||
<img class="LP-Place__Image" src="{{ place.images.first.filename.url_thumbnail }}" />
|
<img class="LP-Place__Image" src="{{ place.images.first.filename.thumbnail.url }}" />
|
||||||
</div>
|
</div>
|
||||||
<div class="LP-Place__Assets">
|
<div class="LP-Place__Assets">
|
||||||
<div class="LP-Place__Info">
|
<div class="LP-Place__Info">
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{% extends 'global.html'%}
|
{% extends 'global.html'%}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
{% load thumbnail %}
|
||||||
|
|
||||||
{% block title %}{{place.name}}{% endblock %}
|
{% block title %}{{place.name}}{% endblock %}
|
||||||
|
|
||||||
@ -9,28 +10,50 @@
|
|||||||
|
|
||||||
<article class="LP-PlaceOverview">
|
<article class="LP-PlaceOverview">
|
||||||
<div class="LP-PlaceOverview__Info">
|
<div class="LP-PlaceOverview__Info">
|
||||||
<img class="LP-PlaceOveriew__Image" src="{{ place.images.first.filename.url_hero }}">
|
<div class="LP-PlaceOveriew__Image">
|
||||||
|
<img src="{{ place.images.first.filename.hero.url }}" class="LP-Image" />
|
||||||
|
</div>
|
||||||
<article class="LP-PlaceOverView__Description">
|
<article class="LP-PlaceOverView__Description">
|
||||||
<div class="LP-TextSection">
|
<div class="LP-TextSection">
|
||||||
<h1 class="LP-Headline LP-Headline--main">{{place.name}}</h1>
|
<h1 class="LP-Headline LP-Headline">{{place.name}}</h1>
|
||||||
<p class="LP-Text LP-Content">{{place.description}}</p>
|
<p class="LP-Paragraph LP-Paragraph">{{place.description}}</p>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
</div>
|
</div>
|
||||||
<article style="clear:both;">
|
<article class="LP-Section">
|
||||||
<h2 class="LP-Headline LP-Headline">Sicherheitsmaßnahmen</h2>
|
<h1 class="LP-Headline LP-Headline">Sicherheitsmaßnahmen</h1>
|
||||||
|
<div class="LP-Content__Wrapper">
|
||||||
<div class="LP-Content">
|
<div class="LP-Content">
|
||||||
<ul class="LP-SecurityMeasure__List">
|
<div class="LP-TagList">
|
||||||
<li class="LP-SecurityMeasure__Item"><span class="LP-Text">Kameras</span></li>
|
<ul class="LP-TagList__List">
|
||||||
<li class="LP-SecurityMeasure__Item"><span class="LP-Text">Zaun</span></li>
|
<li class="LP-TagList__Item">
|
||||||
<li class="LP-SecurityMeasure__Item"><span class="LP-Text">Wachhund</span></li>
|
<div class="LP-Tag">
|
||||||
<li class="LP-SecurityMeasure__Item"><span class="LP-Text">Alarmanlage</span></li>
|
<p class="LP-Paragraph LP-Paragraph">Kamera</p>
|
||||||
<li class="LP-SecurityMeasure__Item"><span class="LP-Text">Selbstschussanlage</span></li>
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="LP-TagList__Item">
|
||||||
|
<div class="LP-Tag">
|
||||||
|
<p class="LP-Paragraph LP-Paragraph">Wachhund</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="LP-TagList__Item">
|
||||||
|
<div class="LP-Tag">
|
||||||
|
<p class="LP-Paragraph LP-Paragraph">Zaun</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
|
<li class="LP-TagList__Item">
|
||||||
|
<div class="LP-Tag">
|
||||||
|
<p class="LP-Paragraph LP-Paragraph">Security</p>
|
||||||
|
</div>
|
||||||
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</article>
|
</article>
|
||||||
<article>
|
<article class="LP-Section">
|
||||||
<h2 class="LP-Headline LP-Headline">Karten</h2>
|
<h1 class="LP-Headline LP-Headline">Links</h1>
|
||||||
|
<div class="LP-Content__Wrapper">
|
||||||
<div class="LP-Content">
|
<div class="LP-Content">
|
||||||
<ul class="LP-LinkList__List">
|
<ul class="LP-LinkList__List">
|
||||||
<li class="LP-LinkList__Item"><a target="_blank" href="https://www.google.com/maps?q={{place.latitude}},{{place.longitude}}" class="LP-Link"><span class="LP-Text">Google Maps</span></a></li>
|
<li class="LP-LinkList__Item"><a target="_blank" href="https://www.google.com/maps?q={{place.latitude}},{{place.longitude}}" class="LP-Link"><span class="LP-Text">Google Maps</span></a></li>
|
||||||
@ -38,38 +61,21 @@
|
|||||||
<li class="LP-LinkList__Item"><a target="_blank" href="http://www.openstreetmap.org/?mlat={{place.latitude}}&mlon={{place.longitude}}&zoom=16" class="LP-Link"><span class="LP-Text">OSM</span></a></li>
|
<li class="LP-LinkList__Item"><a target="_blank" href="http://www.openstreetmap.org/?mlat={{place.latitude}}&mlon={{place.longitude}}&zoom=16" class="LP-Link"><span class="LP-Text">OSM</span></a></li>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</article>
|
|
||||||
<article>
|
|
||||||
<h2 class="LP-Headline LP-Headline">Fotoalben</h2>
|
|
||||||
<div class="LP-Content">
|
|
||||||
<ul class="LP-LinkList__List">
|
|
||||||
<li class="LP-LinkList__Item"><a target="_blank" href="https://gallery.commander1024.de/index.php?/category/verlassenes-wohnhaus-mesum" class="LP-Link"><span class="LP-Text">Commander1024</span></a></li>
|
|
||||||
<li class="LP-LinkList__Item"><a href="#" class="LP-Link LP-Link--iconized">
|
|
||||||
<div class="LP-Link__IconWrapper">
|
|
||||||
<svg class="LP-Link__Icon" version="1.1" id="Capa_1" xmlns="http://www.w3.org/2000/svg"
|
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 512 512"
|
|
||||||
xml:space="preserve">
|
|
||||||
<g>
|
|
||||||
<path d="M492,236H276V20c0-11.046-8.954-20-20-20c-11.046,0-20,8.954-20,20v216H20c-11.046,0-20,8.954-20,20s8.954,20,20,20h216
|
|
||||||
v216c0,11.046,8.954,20,20,20s20-8.954,20-20V276h216c11.046,0,20-8.954,20-20C512,244.954,503.046,236,492,236z" />
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
</div>
|
|
||||||
<span class="LP-Text">Album hinzufügen</span></a></li>
|
|
||||||
</ul>
|
|
||||||
</div>
|
</div>
|
||||||
</article>
|
</article>
|
||||||
<article class="">
|
<article class="LP-Section">
|
||||||
<h2 class="LP-Headline LP-Headline">Bilder</h2>
|
<h1 class="LP-Headline LP-Headline">Bilder</h1>
|
||||||
|
<div class="LP-Content__Wrapper">
|
||||||
<div class=" LP-Content">
|
<div class=" LP-Content">
|
||||||
<ul class="LP-PlaceOverView__ImageList">
|
<ul class="LP-PlaceOverView__ImageList">
|
||||||
{% for place_image in place.images.all %}
|
{% for place_image in place.images.all %}
|
||||||
<li class="LP-PlaceOverView__ImageItem">
|
<li class="LP-PlaceOverView__ImageItem">
|
||||||
<a href="{{ place_image.filename.url_large }}"> <img src="{{ place_image.filename.url_thumbnail }}"></a>
|
<a href="{{ place_image.filename.large.url }}" class="LP-Link"><img class="LP-Image" src="{{ place_image.filename.thumbnail.url }}"></a>
|
||||||
</li>
|
</li>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
|
</div>
|
||||||
</article>
|
</article>
|
||||||
</article>
|
</article>
|
||||||
{% endblock maincontent %}
|
{% endblock maincontent %}
|
@ -1,15 +1,48 @@
|
|||||||
{% extends 'global.html'%}
|
{% extends 'global.html'%}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
|
||||||
# {% block title %}Place erstellen{% endblock %}
|
# {% block title %}Place aktualisieren{% endblock %}
|
||||||
|
|
||||||
{% block maincontent %}
|
{% block maincontent %}
|
||||||
|
<form class="LP-Form" method="POST" enctype="multipart/form-data">
|
||||||
<h2>Place aktualisieren</h2>
|
<fieldset class="LP-Form__Fieldset">
|
||||||
<form method="post" enctype="multipart/form-data">
|
<legend class="LP-Form__Legend">Place aktualisieren</legend>
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form.as_p }}
|
<div class="LP-Form__Composition LP-Form__Composition--breakable">
|
||||||
<button type="submit">Abschicken</button>
|
<div class="LP-Form__Field">
|
||||||
|
{% include 'partials/form/inputField.html' with field=form.name %}
|
||||||
|
</div>
|
||||||
|
<div class="LP-Form__Field">
|
||||||
|
{% include 'partials/form/inputField.html' with field=form.location %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="LP-Form__Composition LP-Form__Composition--breakable">
|
||||||
|
<div class="LP-Form__Field">
|
||||||
|
{% include 'partials/form/inputField.html' with field=form.latitude %}
|
||||||
|
</div>
|
||||||
|
<div class="LP-Form__Field">
|
||||||
|
{% include 'partials/form/inputField.html' with field=form.longitude %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="LP-Form__Composition">
|
||||||
|
<div class="LP-Form__Field">
|
||||||
|
{% include 'partials/form/inputField.html' with field=form.description %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="LP-Form__Composition">
|
||||||
|
<div class="LP-Form__Field">
|
||||||
|
{% include 'partials/form/inputField.html' with field=form.filename %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="LP-Form__Composition">
|
||||||
|
<input type="submit" class="LP-Button" value="Abschicken"/>
|
||||||
|
</div>
|
||||||
|
</fieldset>
|
||||||
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
{% endblock maincontent %}
|
{% endblock maincontent %}
|
@ -1,6 +1,7 @@
|
|||||||
from django.urls import path
|
from django.urls import path
|
||||||
from .views import (
|
from .views import (
|
||||||
hello_world,
|
hello_world,
|
||||||
|
HomeView,
|
||||||
place_detail_view,
|
place_detail_view,
|
||||||
place_list_view,
|
place_list_view,
|
||||||
SignUpView,
|
SignUpView,
|
||||||
@ -10,7 +11,7 @@ from .views import (
|
|||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
path('hello_world/', hello_world), # You know what this is :P
|
path('hello_world/', hello_world), # You know what this is :P
|
||||||
path('voucher/', VoucherVerifyView.as_view(), name='enter_voucher'),
|
path('', HomeView.as_view(), name='home'),
|
||||||
path('signup/', SignUpView.as_view(), name='signup'),
|
path('signup/', SignUpView.as_view(), name='signup'),
|
||||||
path('place/<int:pk>/', place_detail_view, name='place_detail'),
|
path('place/<int:pk>/', place_detail_view, name='place_detail'),
|
||||||
path('place/create/', PlaceCreateView.as_view(), name='place_create'),
|
path('place/create/', PlaceCreateView.as_view(), name='place_create'),
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
''' Django views. '''
|
''' Django views. '''
|
||||||
|
|
||||||
from django.shortcuts import render, redirect, get_object_or_404
|
from django.shortcuts import render, redirect, get_object_or_404
|
||||||
from django.urls import reverse_lazy
|
from django.urls import reverse_lazy
|
||||||
from django.views.generic.edit import CreateView
|
from django.views.generic.edit import CreateView
|
||||||
@ -29,6 +28,16 @@ def place_detail_view(request, pk):
|
|||||||
def hello_world(request):
|
def hello_world(request):
|
||||||
return render(request, 'hello_world.html', {'text':'Hello World!'})
|
return render(request, 'hello_world.html', {'text':'Hello World!'})
|
||||||
|
|
||||||
|
class HomeView(View):
|
||||||
|
def get(self, request, *args, **kwargs):
|
||||||
|
place_list = Place.objects.all().order_by('submitted_when')[:10]
|
||||||
|
print(place_list)
|
||||||
|
context = {
|
||||||
|
'place_list': place_list
|
||||||
|
}
|
||||||
|
return render(request, 'home.html', context)
|
||||||
|
|
||||||
|
|
||||||
class PlaceUpdateView(UpdateView):
|
class PlaceUpdateView(UpdateView):
|
||||||
template_name = 'update_place.html'
|
template_name = 'update_place.html'
|
||||||
model = Place
|
model = Place
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
{% 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 %}
|
|
@ -29,6 +29,11 @@
|
|||||||
{% include 'partials/form/inputField.html' with field=form.password2 %}
|
{% include 'partials/form/inputField.html' with field=form.password2 %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="LP-Form__Composition">
|
||||||
|
<div class="LP-Form__Field">
|
||||||
|
{% include 'partials/form/inputField.html' with field=form.voucher %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="LP-Form__Composition">
|
<div class="LP-Form__Composition">
|
||||||
<input type="submit" class="LP-Button" value="Registrieren"/>
|
<input type="submit" class="LP-Button" value="Registrieren"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user