Merge branch 'master' into voucher

This commit is contained in:
reverend 2020-08-03 17:30:31 +02:00
commit 4a6c3b7606
9 changed files with 341 additions and 171 deletions

View File

@ -10,6 +10,7 @@ pylint = "*"
django = "*"
django-thumbs-v2 = "*"
image = "*"
django-widget-tweaks = "*"
# Commented out to not explicitly specify Python3 subversion.
# [requires]
# python_version = "3.8"

View File

@ -41,7 +41,8 @@ INSTALLED_APPS = [
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django_thumbs'
'django_thumbs',
'widget_tweaks',
]
MIDDLEWARE = [

View File

@ -7,11 +7,6 @@ from django import forms
from django.contrib.auth.forms import UserCreationForm, UserChangeForm
from .models import Explorer, Place, PlaceImage, Voucher
class VoucherVerifyForm(forms.ModelForm):
class Meta:
model = Voucher
fields = ['code']
class ExplorerCreationForm(UserCreationForm):
class Meta:
model = Explorer

View File

@ -1,3 +1,11 @@
@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 {
color: #565656;
text-decoration: none;
@ -13,7 +21,7 @@
display: inline; }
.LP-Headline {
font-family: "Trebuchet MS", Helvetica, sans-serif;
font-family: Montserrat, Helvetica, sans-serif;
color: #565656;
font-size: 1.7rem;
padding-top: 0px;
@ -27,9 +35,9 @@
.LP-Headline--inline {
display: inline; }
.LP-Text {
.LP-Paragraph {
color: black;
font-family: "Times New Roman", Times, serif;
font-family: Crimson, Times, serif;
font-size: 1.2rem; }
.LP-Icon {
@ -45,12 +53,99 @@
.LP-Icon__List .LP-Icon__Item {
padding: 0 3px; }
.LP-Button {
background-color: #C09F80;
color: #565656;
border: none;
padding: 8px 14px;
border-radius: 2px;
font-weight: bold; }
.LP-Button:active {
background-color: #76323F;
color: #f9f9f9; }
.LP-Button--cancel {
background-color: #f9f9f9; }
.LP-Form .LP-Form__Checkbox {
display: none; }
.LP-Form .LP-Form__CheckBox__CheckMark {
height: 1em;
width: 1em;
border: 1px solid black;
padding: 0 calc(.5em + 2px);
margin-right: .7em; }
.LP-Input {
display: flex;
flex-direction: column;
margin-bottom: -30px;
padding: 10px 0; }
.LP-Input .LP-Input__Field {
border: none;
border-bottom: 1px solid #565656;
padding: 8px;
margin-bottom: 30px; }
.LP-Input .LP-Input__Field:focus, .LP-Input .LP-Input__Field:active, .LP-Input .LP-Input__Field:invalid {
margin-bottom: 29px;
border-bottom: 2px solid #76323F;
background-color: #f9f9f9;
border-radius: 3px 3px 0 0;
box-shadow: none; }
.LP-Input .LP-Input__Label {
font-family: Montserrat, Helvetica, sans-serif;
font-size: 16px; }
.LP-Input .LP-Input__Message {
font-family: Montserrat, Helvetica, sans-serif;
font-style: italic;
font-size: 13px;
padding: 3px;
position: relative;
top: -30px; }
.LP-Input--error .LP-Input__Field {
margin-bottom: 25px;
border-bottom: 2px solid #76323F;
margin-bottom: 29px; }
.LP-Input--error .LP-Input__Message {
color: #76323F; }
.LP-Input--disabled .LP-Input__Field, .LP-Input--disabled .LP-Input__Field:disabled {
background-color: transparent;
border-bottom: 1px dashed #565656;
cursor: not-allowed; }
label + .LP-Input--disabled .LP-Input__Field, label + .LP-Input--disabled .LP-Input__Field:disabled {
color: red; }
.LP-Input--disabled .LP-Input__Field:focus, .LP-Input--disabled .LP-Input__Field:active, .LP-Input--disabled .LP-Input__Field:disabled:focus, .LP-Input--disabled .LP-Input__Field:disabled:active {
margin-bottom: 30px;
border-radius: 0; }
.LP-Input--disabled .LP-Input__Field ~ .LP-Input__Message, .LP-Input--disabled .LP-Input__Field:disabled ~ .LP-Input__Message {
visibility: hidden; }
.LP-Input--disabled .LP-Input__Label {
color: #565656; }
.LP-Image {
object-fit: cover;
width: 100%;
height: auto;
vertical-align: top; }
.LP-Logo {
max-width: 100%;
max-height: 100%;
width: auto;
object-fit: contain; }
.LP-Tag {
padding: 8px 14px;
background-color: #D7CEC7;
border-radius: 2px;
width: max-content; }
.LP-Tag .LP-Paragraph {
padding: 0;
margin: 0;
font-family: Montserrat, Helvetica, sans-serif;
font-size: 1em;
display: inline; }
.LP-Content {
padding: 35px; }
@ -61,72 +156,90 @@
.LP-TextSection .LP-Text {
line-height: 1.4rem; }
.LP-Place .LP-Place__Image {
width: 280px;
height: 165px;
object-fit: cover; }
.LP-PlaceTeaser {
width: 280px; }
.LP-PlaceTeaser .LP-PlaceTeaser__Image {
height: 165px;
width: 280px;
overflow: hidden; }
.LP-PlaceTeaser .LP-PlaceTeaser__Image .LP-Image {
max-width: unset;
max-height: unset;
object-fit: cover; }
.LP-PlaceTeaser .LP-PlaceTeaser__Meta {
display: flex;
align-items: center;
justify-content: space-between;
padding-bottom: 10px; }
.LP-PlaceTeaser .LP-PlaceTeaser__Meta .LP-Paragraph {
font-family: Montserrat, Helvetica, sans-serif;
padding: 0;
margin: 0;
margin-top: 5px;
font-size: 0.9rem; }
.LP-PlaceTeaser .LP-PlaceTeaser__Meta .LP-Headline {
font-family: Montserrat, Helvetica, sans-serif;
color: #565656;
font-size: 1rem;
padding: 0px;
margin: 0px; }
.LP-PlaceTeaser .LP-PlaceTeaser__Description {
font-family: Roboto, Arial, sans-serif;
color: #565656;
display: none; }
.LP-Place .LP-Place__Assets {
display: flex;
align-items: center;
justify-content: space-between;
margin-top: 0.8rem;
padding: 0 10px;
padding-bottom: 10px; }
@media (min-width: 650px) {
.LP-PlaceTeaser--extended {
display: flex;
flex-direction: row;
width: auto;
padding-right: 25px;
height: 165px; }
.LP-PlaceTeaser--extended .LP-PlaceTeaser__Meta {
margin: 0;
padding: 5px;
padding-left: 25px;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: flex-start; }
.LP-PlaceTeaser--extended .LP-PlaceTeaser__Meta .LP-PlaceTeaser__Info .LP-Headline {
font-size: 28px; }
.LP-PlaceTeaser--extended .LP-PlaceTeaser__Meta .LP-PlaceTeaser__Icons {
margin-top: auto; }
.LP-PlaceTeaser--extended .LP-PlaceTeaser__Meta .LP-PlaceTeaser__Icons ul {
padding: 0;
margin: 0; }
.LP-PlaceTeaser--extended .LP-PlaceTeaser__Description {
display: block;
max-height: 55px;
overflow: hidden; }
.LP-PlaceTeaser--extended .LP-PlaceTeaser__Image {
height: 165px;
width: 280px;
flex-shrink: 0;
flex-grow: 0; } }
.LP-Place .LP-Place__Info .LP-Place__Title {
font-family: "Trebuchet MS", Helvetica, sans-serif;
color: #565656;
font-size: 1rem;
padding: 0px;
margin: 0px; }
.LP-Place .LP-Place__Info .LP-Place__Description {
font-family: Roboto, Arial, sans-serif;
color: #565656; }
.LP-Place .LP-Place__Info .LP-Place__Detail {
font-family: "Trebuchet MS", Helvetica, sans-serif;
padding: 0;
margin: 0;
margin-top: 5px;
font-size: 0.9rem; }
.LP-SecurityMeasure__List {
.LP-TagList .LP-TagList__List {
list-style-type: none;
display: flex;
flex-wrap: wrap;
padding: 0;
margin: 0; }
.LP-SecurityMeasure__List .LP-SecurityMeasure__Item {
margin: 5px 5px;
padding: 5px 8px;
background-color: #D7CEC7;
border-radius: 2px; }
.LP-SecurityMeasure__List .LP-SecurityMeasure__Item .LP-Text {
font-family: "Trebuchet MS", Helvetica, sans-serif;
font-size: 1.2rem; }
.LP-TagList .LP-TagList__List .LP-TagList__Item {
margin: 6px; }
.LP-Header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 70px; }
.LP-Header__Logo {
max-width: 300px;
width: 35%;
object-fit: contain; }
.LP-Header .LP-Header__Logo {
margin: 25px; }
.LP-Menu__List {
.LP-Menu .LP-Menu__List {
list-style-type: none;
display: inline-flex;
justify-content: space-around; }
display: flex;
flex-direction: row;
justify-content: space-between;
padding: 0;
margin: 0; }
.LP-Menu__Item {
padding: 10px 15px;
margin: 0 15px;
.LP-Menu .LP-Menu__Item {
padding: 15px 0;
margin: 0;
width: 100px;
text-align: center;
background-color: transparent; }
@ -138,65 +251,80 @@
.LP-Menu .LP-Link__Text:hover {
color: #76323F; }
.LP-Introduction .LP-Headline {
font-size: 2rem; }
@media (max-width: 750px) {
.LP-Menu .LP-Menu__List {
display: flex;
flex-direction: row;
justify-content: flex-start; } }
.LP-Introduction .LP-Text {
font-size: 1.3rem; }
@media (max-width: 450px) {
.LP-Menu .LP-Menu__List {
justify-content: space-between; } }
.LP-Place__Grid {
.LP-Header {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 70px;
height: 60px; }
.LP-Header__Logo {
height: 60px;
margin: 25px;
object-fit: cover;
max-height: 100%;
overflow: hidden; }
.LP-Header__Logo .LP-Image {
height: 60px; }
@media (max-width: 750px) {
.LP-Header__Logo {
width: 60px; }
.LP-Header__Logo .LP-Image {
object-position: 0 0;
object-fit: cover; } }
@media (max-width: 450px) {
.LP-Header__Logo {
display: none; }
.LP-Header__Navigation {
width: 100%; } }
.LP-PlaceGrid .LP-PlaceGrid__Grid {
margin: 0;
padding: 0;
list-style-type: none;
display: flex;
flex-direction: row;
flex-wrap: wrap; }
.LP-Place__Grid > .LP-Place__Item {
margin: 0 15px;
margin-bottom: 50px; }
.LP-Place__Grid .LP-Link .LP-Place__Description {
display: none; }
.LP-Place__Grid .LP-Link .LP-Place:hover {
box-shadow: 0 0 8px #565656; }
.LP-PlaceGrid .LP-PlaceGrid__Grid .LP-PlaceGrid__Item {
margin: 18px; }
.LP-PlaceGrid .LP-PlaceGrid__Grid .LP-Link .LP-PlaceTeaser:hover {
box-shadow: 0 0 2px #565656; }
.LP-Place__List {
.LP-PlaceList .LP-PlaceList__List {
list-style-type: none; }
.LP-Place__List .LP-Place__Item {
.LP-PlaceList .LP-PlaceList__List .LP-Link .LP-Place:hover {
color: #565656;
background-color: #f9f9f9;
position: relative;
left: -2px; }
.LP-PlaceList .LP-PlaceList__List .LP-Link .LP-Place:hover > .LP-Place__Image {
border-left: 2px #565656 solid; }
.LP-PlaceList .LP-PlaceList__List .LP-PlaceList__Item {
max-width: 900px;
min-width: 450px;
margin: 25px 0; }
.LP-Place__List .LP-Place__Item .LP-Place {
display: flex;
flex-direction: row;
width: auto;
padding-right: 25px; }
.LP-Place__List .LP-Place__Item .LP-Place .LP-Place__Assets {
margin: 0;
padding: 0;
padding-left: 25px;
display: flex;
flex-direction: column;
justify-content: space-between;
align-items: flex-start; }
.LP-Place__List .LP-Place__Item .LP-Place .LP-Place__Assets .LP-Place__Info .LP-Place__Title {
font-size: 28px; }
.LP-Place__List .LP-Place__Item .LP-Place .LP-Place__Assets .LP-Icon__List {
justify-self: flex-end; }
.LP-Place__List .LP-Place__Item .LP-Place > .LP-Place__Image {
height: 168px;
width: 280px; }
margin: 18px 0; }
.LP-LinkList__List {
list-style-type: none;
display: grid;
grid-template-columns: repeat(auto-fit, 300px);
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
margin: 0;
padding: 0; }
.LP-LinkList__List .LP-LinkList__Item {
border-left: 1px solid #C09F80;
width: 100%;
margin-top: 12px;
height: 55px; }
margin-top: 12px; }
.LP-LinkList__List .LP-LinkList__Item .LP-Link {
padding: 1em 0 1em 1em;
width: calc(100% - $-link-padding);
@ -247,6 +375,44 @@
.LP-Footer .LP-LinkList__List .LP-LinkList__Item .LP-Link:hover {
background-color: inherit; }
.LP-Form .LP-Form__Fieldset {
border: none; }
.LP-Form .LP-Form__Fieldset .LP-Form__Legend {
margin: 0;
padding: 0;
font-family: Montserrat, Helvetica, sans-serif;
font-size: 21px; }
.LP-Form .LP-Form__Fieldset .LP-Form__Composition {
display: flex;
flex-direction: row;
justify-content: space-between; }
.LP-Form .LP-Form__Fieldset .LP-Form__Composition .LP-Form__Field {
flex: 3 1 100px;
padding: 6px 15px; }
.LP-Form .LP-Form__Fieldset .LP-Form__Composition .LP-Form__Field--wider {
flex: 5 1; }
.LP-Form .LP-Form__Fieldset .LP-Form__Composition .LP-Form__Field--wide {
flex: 4 1; }
.LP-Form .LP-Form__Fieldset .LP-Form__Composition .LP-Form__Field--narrow {
flex: 2 0; }
.LP-Form .LP-Form__Fieldset .LP-Form__Composition .LP-Form__Field--narrower {
flex: 1 0; }
@media (max-width: 650px) {
.LP-Form .LP-Form__Fieldset .LP-Form__Composition--breakable {
display: flex;
flex-direction: column;
justify-content: space-between; } }
@media (max-width: 450px) {
.LP-Form .LP-Form__Fieldset .LP-Form__Composition {
display: flex;
flex-direction: column;
justify-content: space-between; }
.LP-Form .LP-Form__Fieldset .LP-Form__Composition .LP-Form__Field {
flex: 3 1 100px;
padding: 12px 15px; } }
.LP-MainContainer {
margin: 0 auto;
max-width: 1280px; }
@ -254,45 +420,50 @@
.LP-HorizontalLine {
color: #565656; }
@media (max-width: 650px) {
.LP-MainContainer {
width: 100%; } }
.LP-PlaceOverview .LP-PlaceOverview__Info .LP-PlaceOveriew__Image {
width: 700px;
height: 450px;
box-shadow: 0 0 10px #565656;
object-fit: cover;
object-position: 0 0;
float: right;
margin-left: 35px;
margin-bottom: 35px; }
margin-bottom: 35px;
overflow: hidden; }
.LP-PlaceOverview .LP-PlaceOverview__Info .LP-PlaceOverView__Description {
padding: 0px;
position: relative;
top: -15px; }
.LP-PlaceOverview .LP-PlaceOverview__Info .LP-PlaceOverView__Description .LP-Headline {
position: relative;
top: 15px; }
.LP-PlaceOverview .LP-PlaceOverView__ImageList {
list-style-type: none;
display: grid;
grid-template-columns: repeat(auto-fit, 300px);
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
margin: 0px;
padding: 0px; }
.LP-PlaceOverview .LP-PlaceOverView__ImageList .LP-PlaceOverView__ImageItem img {
box-shadow: 0 0 5px #565656;
height: 200px;
width: 290px;
object-fit: cover;
.LP-PlaceOverview .LP-PlaceOverView__ImageList .LP-PlaceOverView__ImageItem {
margin-top: 10px; }
.LP-PlaceOverview .LP-PlaceOverView__ImageList .LP-PlaceOverView__ImageItem .LP-Link {
overflow: hidden; }
.LP-PlaceOverview .LP-PlaceOverView__ImageList .LP-PlaceOverView__ImageItem .LP-Image {
box-shadow: 0 0 5px #565656;
height: 200px;
width: 290px;
object-fit: cover; }
@media (max-width: 1290px) {
@media (max-width: 1000px) {
.LP-PlaceOverview .LP-PlaceOverview__Info .LP-TextSection {
margin-top: -100px; }
.LP-PlaceOverview .LP-PlaceOverview__Info .LP-Headline {
position: relative;
top: -400px;
margin-bottom: 100px;
width: 100vw;
display: block; }
margin-top: 30px; }
.LP-PlaceOverview .LP-PlaceOverview__Info .LP-PlaceOveriew__Image {
float: none;
width: calc(100vw - 30px);
width: 100%;
height: auto;
margin: 0;
padding: 0;
margin-left: 7px; } }
padding: 0; } }

View File

@ -0,0 +1,16 @@
{% load widget_tweaks %}
<div class="LP-Input {% if field.errors %} LP-Input--error {% endif %}">
<label for="{{field.id_for_label}}" class="LP-Input__Label">{{field.label}}</label>
{% render_field field class="LP-Input__Field"%}
<span class="LP-Input__Message">
{% if field.errors %}
{% for error in field.errors%}
{{error}}
{% endfor %}
{% elif field.help_text%}
{{ field.help_text }}
{% endif %}
</span>
</div>

View File

@ -1,15 +0,0 @@
{% extends 'global.html'%}
{% load static %}
# {% block title %}Voucher-Überprüfung{% endblock %}
{% block maincontent %}
<h2>Voucher-Überprüfung</h2>
<form method="post">
{% csrf_token %}
{{ voucher_form.as_p }}
<button type="submit">Überprüfen</button>
</form>
{% endblock maincontent %}

View File

@ -1,7 +1,6 @@
from django.urls import path
from .views import (
hello_world,
VoucherVerifyView,
hello_world,
place_detail_view,
place_list_view,
SignUpView,

View File

@ -5,40 +5,16 @@
from django.shortcuts import render, redirect, get_object_or_404
from django.urls import reverse_lazy
from django.views.generic.edit import CreateView, UpdateView
from django.views.generic.edit import CreateView
from django.views import View
from django.http import Http404
from django.views.generic.edit import UpdateView
from .forms import ExplorerCreationForm, PlaceForm, PlaceImageCreateForm, VoucherVerifyForm
from .forms import ExplorerCreationForm, PlaceForm, PlaceImageCreateForm
from .models import Place, PlaceImage, Voucher
# Create your views here.
class VoucherVerifyView(View):
formclass = VoucherVerifyForm
fields = ['code']
def get(self, request, *args, **kwargs):
voucher_form = VoucherVerifyForm()
return render(request, 'voucher-verify.html', {'voucher_form': voucher_form})
def post(self, request, *args, **kwargs):
voucher_form = VoucherVerifyForm(request.POST)
if voucher_form.is_valid():
# Compare voucher from form with available vouchers in Voucher.
for voucher in Voucher.objects.all():
print(voucher.code)
if voucher.code == voucher_form.cleaned_data.get('code'):
kwargs_to_pass = {
'voucher_pk': voucher.pk
}
return redirect(reverse_lazy('signup'), kwargs=kwargs_to_pass)
else:
return redirect(reverse_lazy('enter_voucher'))
else:
return redirect(reverse_lazy('enter_voucher'))
class SignUpView(CreateView):
form_class = ExplorerCreationForm
success_url = reverse_lazy('login')
@ -62,6 +38,7 @@ class PlaceUpdateView(UpdateView):
return reverse_lazy('place_detail', kwargs={'pk':self.get_object().pk})
class PlaceCreateView(View):
def get(self, request, *args, **kwargs):
place_image_form = PlaceImageCreateForm()
place_form = PlaceForm()

View File

@ -1,15 +1,40 @@
{% extends 'global.html'%}
{% load static %}
{% load widget_tweaks %}
# {% block title %}Registrierung{% endblock %}
{% block maincontent %}
<h2>Registrierung</h2>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Sign up</button>
<form class="LP-Form" method="POST">
<fieldset class="LP-Form__Fieldset">
<legend class="LP-Form__Legend">Registrierung</legend>
{% csrf_token %}
<div class="LP-Form__Composition LP-Form__Composition--breakable">
<div class="LP-Form__Field">
{% include 'partials/form/inputField.html' with field=form.username %}
</div>
<div class="LP-Form__Field">
{% include 'partials/form/inputField.html' with field=form.email %}
</div>
</div>
<div class="LP-Form__Composition">
<div class="LP-Form__Field">
{% include 'partials/form/inputField.html' with field=form.password1 %}
</div>
</div>
<div class="LP-Form__Composition">
<div class="LP-Form__Field">
{% include 'partials/form/inputField.html' with field=form.password2 %}
</div>
</div>
<div class="LP-Form__Composition">
<input type="submit" class="LP-Button" value="Registrieren"/>
</div>
</fieldset>
</form>
{% endblock maincontent %}