Compare commits

..

4 Commits

5 changed files with 35 additions and 18 deletions

View File

@ -1,14 +1,14 @@
# lostplaces-backend # lostplaces-backend
lostplaces-backend is a django based Webproject. It once wants to become a software which allows a group of urban explorers to manage, document and share the locations of lost places while not exposing too much / any information to the public. lostplaces-backend is a django (3.x) based webproject. It once wants to become a software which allows a group of urban explorers to manage, document and share the locations of lost places while not exposing too much / any information to the public.
The software ist currently in early development status, neither scope, datalmodel(s) nor features are finalized yet. The software is currently in early development status, neither scope, datalmodel(s) nor features are finalized yet. Therefore we would not recommend to download or install this piece of software anywhere - except your local django dev server.
## Dependencies ## Dependencies
Right now it depends on the following non-core Python 3 libraries. These can be installed using the package manager of your distribution or into the venv locally. Right now it depends on the following non-core Python 3 libraries. These can be installed using the package manager of your distribution or into the venv locally.
* [django](https://www.djangoproject.com/) django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design. * [django](https://www.djangoproject.com/) django is a high-level Python Web framework that encourages rapid development and clean, pragmatic design.
* [easy-thumbnais](https://github.com/SmileyChris/easy-thumbnails) A powerful, yet easy to implement thumbnailing application for Django 1.11+ * [easy-thumbnails](https://github.com/SmileyChris/easy-thumbnails) A powerful, yet easy to implement thumbnailing application for Django 1.11+
### Setting up a (pipenv) virtual environment for development ### Setting up a (pipenv) virtual environment for development

View File

@ -49,7 +49,5 @@ class PlaceImageCreateForm(forms.ModelForm):
self.fields['filename'].required = False self.fields['filename'].required = False
class PlaceDeleteForm(forms.ModelForm): class PlaceDeleteForm(forms.Form):
class Meta: confirm_check = forms.CheckboxInput()
model = Place
fields = ['name']

View File

@ -0,0 +1,18 @@
{% 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

@ -1,12 +1,12 @@
{% extends 'global.html'%} {% extends 'global.html'%}
{% load static %} {% load static %}
# {% block title %}Place aktualisieren{% endblock %} # {% block title %}Update place{% endblock %}
{% block maincontent %} {% block maincontent %}
<form class="LP-Form" method="POST" enctype="multipart/form-data"> <form class="LP-Form" method="POST" enctype="multipart/form-data">
<fieldset class="LP-Form__Fieldset"> <fieldset class="LP-Form__Fieldset">
<legend class="LP-Form__Legend">Place aktualisieren</legend> <legend class="LP-Form__Legend">Update place</legend>
{% csrf_token %} {% csrf_token %}
<div class="LP-Form__Composition LP-Form__Composition--breakable"> <div class="LP-Form__Composition LP-Form__Composition--breakable">
<div class="LP-Form__Field"> <div class="LP-Form__Field">
@ -39,7 +39,7 @@
</div> </div>
<div class="LP-Form__Composition"> <div class="LP-Form__Composition">
<input type="submit" class="LP-Button" value="Abschicken"/> <input type="submit" class="LP-Button" value="Submit"/>
</div> </div>
</fieldset> </fieldset>

View File

@ -4,10 +4,9 @@
''' 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, UpdateView
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 ( from .forms import (
ExplorerCreationForm, ExplorerCreationForm,
@ -97,12 +96,14 @@ class PlaceCreateView(View):
place_image.save() place_image.save()
class PlaceDeleteView(View): class PlaceDeleteView(View):
template_name = 'delete_place.html' #template_name = 'delete_place.html'
model = Place #model = Place
form_class = PlaceDeleteForm #form_class = PlaceDeleteForm
def get(self, request, *args, **kwargs): def get(self, request, pk, *args, **kwargs):
place = Place(pk=pk)
print(pk, place.name)
place_delete_form = PlaceDeleteForm() place_delete_form = PlaceDeleteForm()
context = {'place_form': place_delete_form} context = {'place': place, 'form': place_delete_form}
return render(request, 'create_place.html', context) return render(request, 'delete_place.html', context)