Compare commits

..

9 Commits

Author SHA1 Message Date
ca1bc12e88 Resolved merge conflicts. 2020-08-02 22:16:31 +02:00
799644bf31 Merge remote-tracking branch 'origin/master' 2020-08-02 22:10:59 +02:00
57c0889c4e Added input field to the signup form and removed crap. 2020-08-02 22:05:25 +02:00
d229fe0fc8 New CSS 2020-08-02 15:57:19 +02:00
81034ef613 Revert "Building a voucher-verify form."
This reverts commit 9bd85aba7a.
2020-08-01 19:08:29 +02:00
f2f32351e1 Revert "Trying to add the invitations module."
This reverts commit bea6c606fd.
2020-08-01 19:05:37 +02:00
ba3f937086 Revert "Building a voucher-verify form."
This reverts commit 9bd85aba7a.
2020-08-01 19:05:13 +02:00
d2002c9e51 Merge commit 'bea6c60'
Accidently committed to master.
2020-08-01 19:01:03 +02:00
bea6c606fd Trying to add the invitations module. 2020-08-01 16:54:11 +02:00
5 changed files with 163 additions and 85 deletions

View File

@ -7,15 +7,11 @@ from django import forms
from django.contrib.auth.forms import UserCreationForm, UserChangeForm from django.contrib.auth.forms import UserCreationForm, UserChangeForm
from .models import Explorer, Place, PlaceImage, Voucher from .models import Explorer, Place, PlaceImage, Voucher
class VoucherVerifyForm(forms.ModelForm):
class Meta:
model = Voucher
fields = ['code']
class ExplorerCreationForm(UserCreationForm): class ExplorerCreationForm(UserCreationForm):
class Meta: class Meta:
model = Explorer model = Explorer
fields = ('username', 'email') fields = ('username', 'email')
voucher = forms.CharField(max_length=10)
class ExplorerChangeForm(UserChangeForm): class ExplorerChangeForm(UserChangeForm):
class Meta: class Meta:

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 { .LP-Link {
color: #565656; color: #565656;
text-decoration: none; text-decoration: none;
@ -13,7 +21,7 @@
display: inline; } display: inline; }
.LP-Headline { .LP-Headline {
font-family: "Trebuchet MS", Helvetica, sans-serif; font-family: Montserrat, Helvetica, sans-serif;
color: #565656; color: #565656;
font-size: 1.7rem; font-size: 1.7rem;
padding-top: 0px; padding-top: 0px;
@ -27,9 +35,9 @@
.LP-Headline--inline { .LP-Headline--inline {
display: inline; } display: inline; }
.LP-Text { .LP-Paragraph {
color: black; color: black;
font-family: "Times New Roman", Times, serif; font-family: Crimson, Times, serif;
font-size: 1.2rem; } font-size: 1.2rem; }
.LP-Icon { .LP-Icon {
@ -45,6 +53,78 @@
.LP-Icon__List .LP-Icon__Item { .LP-Icon__List .LP-Icon__Item {
padding: 0 3px; } 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: #C09F80; }
.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 {
margin-bottom: 29px;
border-bottom: 2px solid #76323F;
background-color: #f9f9f9;
border-radius: 3px 3px 0 0; }
.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 .LP-Input__Message:before {
content: '* '; }
.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 {
max-width: 100%;
max-height: 100%; }
.LP-Logo { .LP-Logo {
max-width: 100%; max-width: 100%;
max-height: 100%; max-height: 100%;
@ -61,36 +141,32 @@
.LP-TextSection .LP-Text { .LP-TextSection .LP-Text {
line-height: 1.4rem; } line-height: 1.4rem; }
.LP-Place {
width: 280px; }
.LP-Place .LP-Place__Image { .LP-Place .LP-Place__Image {
width: 280px;
height: 165px; height: 165px;
object-fit: cover; } object-fit: fill; }
.LP-Place .LP-Place__Meta {
.LP-Place .LP-Place__Assets {
display: flex; display: flex;
align-items: center; align-items: center;
justify-content: space-between; justify-content: space-between;
margin-top: 0.8rem;
padding: 0 10px;
padding-bottom: 10px; } padding-bottom: 10px; }
.LP-Place .LP-Place__Meta .LP-Paragraph {
.LP-Place .LP-Place__Info .LP-Place__Title { font-family: Montserrat, Helvetica, sans-serif;
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; padding: 0;
margin: 0; margin: 0;
margin-top: 5px; margin-top: 5px;
font-size: 0.9rem; } font-size: 0.9rem; }
.LP-Place .LP-Place__Meta .LP-Headline {
font-family: Montserrat, Helvetica, sans-serif;
color: #565656;
font-size: 1rem;
padding: 0px;
margin: 0px; }
.LP-Place .LP-Place__Description {
font-family: Roboto, Arial, sans-serif;
color: #565656;
display: none; }
.LP-SecurityMeasure__List { .LP-SecurityMeasure__List {
list-style-type: none; list-style-type: none;
@ -104,7 +180,7 @@
background-color: #D7CEC7; background-color: #D7CEC7;
border-radius: 2px; } border-radius: 2px; }
.LP-SecurityMeasure__List .LP-SecurityMeasure__Item .LP-Text { .LP-SecurityMeasure__List .LP-SecurityMeasure__Item .LP-Text {
font-family: "Trebuchet MS", Helvetica, sans-serif; font-family: Montserrat, Helvetica, sans-serif;
font-size: 1.2rem; } font-size: 1.2rem; }
.LP-Header { .LP-Header {
@ -161,10 +237,17 @@
.LP-Place__List { .LP-Place__List {
list-style-type: none; } list-style-type: none; }
.LP-Place__List .LP-Link .LP-Place:hover {
color: #565656;
background-color: #f9f9f9;
position: relative;
left: -2px; }
.LP-Place__List .LP-Link .LP-Place:hover > .LP-Place__Image {
border-left: 2px #565656 solid; }
.LP-Place__List .LP-Place__Item { .LP-Place__List .LP-Place__Item {
max-width: 900px; max-width: 900px;
min-width: 450px; min-width: 450px;
margin: 25px 0; } margin: 18px 0; }
.LP-Place__List .LP-Place__Item .LP-Place { .LP-Place__List .LP-Place__Item .LP-Place {
display: flex; display: flex;
flex-direction: row; flex-direction: row;
@ -247,6 +330,46 @@
.LP-Footer .LP-LinkList__List .LP-LinkList__Item .LP-Link:hover { .LP-Footer .LP-LinkList__List .LP-LinkList__Item .LP-Link:hover {
background-color: inherit; } background-color: inherit; }
.LP-Form {
max-width: 900px; }
.LP-Form .LP-Form__Fieldset {
border: none; }
.LP-Form .LP-Form__Fieldset .LP-Form__Legend {
margin: 0;
padding: 0; }
.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 200px; }
.LP-Form .LP-Form__Fieldset .LP-Form__Composition .LP-Form__Field--wide {
flex: 4 1 150px; }
.LP-Form .LP-Form__Fieldset .LP-Form__Composition .LP-Form__Field--narrow {
flex: 2 0 50px; }
.LP-Form .LP-Form__Fieldset .LP-Form__Composition .LP-Form__Field--narrower {
flex: 1 0 25px; }
.LP-Form .LP-Form__Fieldset .LP-Form__Composition .LP-Form__Field input {
width: 100%; }
@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 { .LP-MainContainer {
margin: 0 auto; margin: 0 auto;
max-width: 1280px; } max-width: 1280px; }

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 django.urls import path
from .views import ( from .views import (
hello_world, hello_world,
VoucherVerifyView,
place_detail_view, place_detail_view,
place_list_view, place_list_view,
SignUpView, SignUpView,
@ -11,7 +10,6 @@ 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('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'),

View File

@ -2,43 +2,18 @@
# -*- 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, UpdateView from django.views.generic.edit import CreateView
from django.views import View from django.views import View
from django.http import Http404 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 from .models import Place, PlaceImage, Voucher
# Create your views here. # 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): class SignUpView(CreateView):
form_class = ExplorerCreationForm form_class = ExplorerCreationForm
success_url = reverse_lazy('login') success_url = reverse_lazy('login')
@ -62,6 +37,7 @@ class PlaceUpdateView(UpdateView):
return reverse_lazy('place_detail', kwargs={'pk':self.get_object().pk}) return reverse_lazy('place_detail', kwargs={'pk':self.get_object().pk})
class PlaceCreateView(View): class PlaceCreateView(View):
def get(self, request, *args, **kwargs): def get(self, request, *args, **kwargs):
place_image_form = PlaceImageCreateForm() place_image_form = PlaceImageCreateForm()
place_form = PlaceForm() place_form = PlaceForm()