Compare commits

...

4 Commits

Author SHA1 Message Date
86d7212060 Adjusted templates 2020-08-10 20:10:22 +02:00
30e6c6fda6 static menu items 2020-08-10 20:01:03 +02:00
98a3c9f22c Unified template names 2020-08-10 20:00:54 +02:00
675cdc5721 Adjusted delete view 2020-08-10 19:54:17 +02:00
10 changed files with 57 additions and 43 deletions

View File

@ -100,7 +100,8 @@ body {
border: none;
padding: 8px 14px;
border-radius: 2px;
font-weight: bold; }
font-weight: bold;
cursor: pointer; }
.LP-Button:active {
background-color: #76323F;
color: #f9f9f9; }

View File

@ -1,18 +0,0 @@
{% extends 'global.html'%}
{% load static %}
{% block title %}Lost Place Deletion{% endblock %}
{% block maincontent %}
<form class="" method="POST" enctype="multipart/form-data">
<fieldset class="">
<legend class="">Delete place</legend>
{% csrf_token %}
<p>Are you sure you want to delete {{place.name}}?</p>
{{ form.as_p }}
<div class="">
<input type="submit" class="LP-Button" value="Delete"/>
</div>
</fieldset>
</form>
{% endblock maincontent %}

View File

@ -35,11 +35,13 @@
<section class="LP-Main__Sidebar">
<nav class="LP-Menu LP-Menu--sidebar">
<ul class="LP-Menu__List">
{% block additional_menu_items %}
{% endblock additional_menu_items %}
<li class="LP-Menu__Item"><a href="/" class="LP-Link"><span class="LP-Link__Text">Home</span></a></li>
<li class="LP-Menu__Item"><a href="" class="LP-Link"><span class="LP-Link__Text">About</span></a></li>
<li class="LP-Menu__Item"><a href="" class="LP-Link"><span class="LP-Link__Text">Contact</span></a></li>
<li class="LP-Menu__Item"><a href="" class="LP-Link"><span class="LP-Link__Text">Contact</span></a></li>
{% block additional_menu_items %}
{% endblock additional_menu_items %}
<li class="LP-Menu__Item LP-Menu__Item--additional"><a href="{% url 'place_create'%}" class="LP-Link"><span class="LP-Link__Text">Create place</span></a></li>
<li class="LP-Menu__Item LP-Menu__Item--additional"><a href="{% url 'place_list'%}" class="LP-Link"><span class="LP-Link__Text">See all places</span></a></li>
</ul>
</nav>
</section>

View File

@ -0,0 +1,20 @@
{% extends 'global.html'%}
{% load static %}
{% block title %}Lost Place Deletion{% endblock %}
{% block maincontent %}
<form class="LP-Form" method="POST">
<fieldset class="LP-Form__Fieldset">
<legend class="LP-Form__Legend">Place löschen</legend>
{% csrf_token %}
<div class="LP-Form__Composition LP-Form__Composition--breakable">
<p class="LP-Paragraph">Are you sure you want to delete "{{place.name}}"?</p>
<div class="LP-Form__Composition">
<input type="submit" class="LP-Button" value="Löschen"/>
</div>
</div>
</fieldset>
</form>
{% endblock maincontent %}

View File

@ -4,7 +4,7 @@
''' Django views. '''
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, UpdateView, DeleteView
from django.views import View
from django.http import Http404
@ -24,10 +24,10 @@ class SignUpView(CreateView):
template_name = 'signup.html'
def place_list_view(request,):
return render(request, 'placeList.html', {'place_list':Place.objects.all()})
return render(request, 'place/place_list.html', {'place_list':Place.objects.all()})
def place_detail_view(request, pk):
return render(request, 'placeOverview.html', {'place':Place.objects.get(pk=pk)})
return render(request, 'place/place_detail.html', {'place':Place.objects.get(pk=pk)})
def hello_world(request):
return render(request, 'hello_world.html', {'text':'Hello World!'})
@ -41,7 +41,7 @@ class HomeView(View):
return render(request, 'home.html', context)
class PlaceUpdateView(UpdateView):
template_name = 'update_place.html'
template_name = 'place/place_update.html'
model = Place
form_class = PlaceForm
@ -58,7 +58,7 @@ class PlaceCreateView(View):
'place_form': place_form,
'place_image_form': place_image_form
}
return render(request, 'create_place.html', context)
return render(request, 'place/place_create.html', context)
def post(self, request, *args, **kwargs):
place_form = PlaceForm(request.POST)
@ -85,7 +85,7 @@ class PlaceCreateView(View):
context = {
'form': form_place
}
return render(request, 'create_place.html', context)
return render(request, 'place/place_create.html', context)
def _apply_multipart_image_upload(self, files, place, submitter):
for image in files:
@ -96,14 +96,10 @@ class PlaceCreateView(View):
)
place_image.save()
class PlaceDeleteView(View):
#template_name = 'delete_place.html'
#model = Place
#form_class = PlaceDeleteForm
class PlaceDeleteView(DeleteView):
template_name = 'place/place_delete.html'
model = Place
form_class = PlaceDeleteForm
def get(self, request, pk, *args, **kwargs):
place = Place.objects.get(pk=pk)
place_delete_form = PlaceDeleteForm()
context = {'place': place, 'form': place_delete_form}
return render(request, 'delete_place.html', context)
def get_success_url(self):
return reverse_lazy('place_list')

View File

@ -5,11 +5,24 @@
{% block maincontent %}
<h2>Login</h2>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Login</button>
<form class="LP-Form" method="POST" enctype="multipart/form-data">
<fieldset class="LP-Form__Fieldset">
<legend class="LP-Form__Legend">Login</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.password %}
</div>
</div>
<div class="LP-Form__Composition">
<input type="submit" class="LP-Button" value="Login"/>
</div>
</fieldset>
</form>
{% endblock maincontent %}