From 821b2b5ee1aefb791e5746c208459940f5b3661d Mon Sep 17 00:00:00 2001 From: "N. Geisler" <ngeisler@fachschaft.informatik.tu-darmstadt.de> Date: Sat, 19 Oct 2019 02:48:14 +0200 Subject: [PATCH] allow AK wish submission create template for AK wish submission create form for AK wish submission create view for AK wish submission adapt urls and buttons --- AKSubmission/forms.py | 5 +++++ .../AKSubmission/submission_overview.html | 3 ++- .../templates/AKSubmission/submit_new.html | 4 +++- .../templates/AKSubmission/submit_new_wish.html | 16 ++++++++++++++++ AKSubmission/urls.py | 1 + AKSubmission/views.py | 13 ++++++++++--- 6 files changed, 37 insertions(+), 5 deletions(-) create mode 100644 AKSubmission/templates/AKSubmission/submit_new_wish.html diff --git a/AKSubmission/forms.py b/AKSubmission/forms.py index 68ecd133..9cd0f121 100644 --- a/AKSubmission/forms.py +++ b/AKSubmission/forms.py @@ -24,3 +24,8 @@ class AKForm(forms.ModelForm): widgets = { 'requirements': forms.CheckboxSelectMultiple, } + + +class AKWishForm(AKForm): + class Meta(AKForm.Meta): + exclude = ['owners'] diff --git a/AKSubmission/templates/AKSubmission/submission_overview.html b/AKSubmission/templates/AKSubmission/submission_overview.html index 7bab73f0..0fbaf807 100644 --- a/AKSubmission/templates/AKSubmission/submission_overview.html +++ b/AKSubmission/templates/AKSubmission/submission_overview.html @@ -19,7 +19,8 @@ <div class="jumbotron" style="margin-top:20px;"> <h2>{% trans "Submit" %}</h2> <a href="{% url 'submit:submit_ak' event_slug=event.slug %}" class="btn btn-primary">{% trans "New AK" %}</a> - <a href="#" class="btn btn-info">{% trans "New AK Wish" %}</a> + <a href="{% url 'submit:submit_ak_wish' event_slug=event.slug %}" + class="btn btn-info">{% trans "New AK Wish" %}</a> </div> diff --git a/AKSubmission/templates/AKSubmission/submit_new.html b/AKSubmission/templates/AKSubmission/submit_new.html index 49b02bdc..b60820ce 100644 --- a/AKSubmission/templates/AKSubmission/submit_new.html +++ b/AKSubmission/templates/AKSubmission/submit_new.html @@ -15,7 +15,9 @@ {% block content %} {% include "AKSubmission/messages.html" %} - <h2>{% trans 'New AK' %}</h2> + {% block headline %} + <h2>{% trans 'New AK' %}</h2> + {% endblock %} <form method="POST" class="post-form">{% csrf_token %} {% bootstrap_form form %} {% buttons %} diff --git a/AKSubmission/templates/AKSubmission/submit_new_wish.html b/AKSubmission/templates/AKSubmission/submit_new_wish.html new file mode 100644 index 00000000..b0315ab0 --- /dev/null +++ b/AKSubmission/templates/AKSubmission/submit_new_wish.html @@ -0,0 +1,16 @@ +{% extends 'AKSubmission/submit_new.html' %} + +{% load i18n %} + +{% block title %}{{ event.slug }} - {% trans "New AK Wish" %}{% endblock %} + +{% block breadcrumbs %} + <li class="breadcrumb-item"><a href="#">AKPlanning</a></li> + <li class="breadcrumb-item"><a href="#">{{ event.slug }}</a></li> + <li class="breadcrumb-item"><a href="#">{% trans "AK Submission" %}</a></li> + <li class="breadcrumb-item active">{% trans "New AK Wish" %}</li> +{% endblock %} + +{% block headline %} + <h2>{% trans 'New AK Wish' %}</h2> +{% endblock %} \ No newline at end of file diff --git a/AKSubmission/urls.py b/AKSubmission/urls.py index f723f0cc..d3c995a4 100644 --- a/AKSubmission/urls.py +++ b/AKSubmission/urls.py @@ -14,6 +14,7 @@ urlpatterns = [ path('aks/category/<int:category_pk>', views.AKListByCategoryView.as_view(), name='ak_list_by_category'), path('aks/tag/<int:tag_pk>', views.AKListByTagView.as_view(), name='ak_list_by_tag'), path('new/', views.AKSubmissionView.as_view(), name='submit_ak'), + path('new_wish/', views.AKWishSubmissionView.as_view(), name='submit_ak_wish'), ]) ), ] diff --git a/AKSubmission/views.py b/AKSubmission/views.py index e7aea578..13eb7c07 100644 --- a/AKSubmission/views.py +++ b/AKSubmission/views.py @@ -4,9 +4,11 @@ from django.urls import reverse_lazy from django.utils.translation import gettext_lazy as _ from django.views.generic import ListView, DetailView, CreateView -from AKModel.models import AK, AKCategory, AKTag, Event -from AKModel.views import FilterByEventSlugMixin, EventSlugMixin -from AKSubmission.forms import AKForm +from AKModel.models import AK, AKCategory, AKTag +from AKModel.models import Event +from AKModel.views import EventSlugMixin +from AKModel.views import FilterByEventSlugMixin +from AKSubmission.forms import AKForm, AKWishForm class SubmissionOverviewView(FilterByEventSlugMixin, ListView): @@ -87,3 +89,8 @@ class AKSubmissionView(EventSlugMixin, CreateView): # TODO return super().form_valid(form) + + +class AKWishSubmissionView(AKSubmissionView): + template_name = 'AKSubmission/submit_new_wish.html' + form_class = AKWishForm -- GitLab