Coherent create/edit/delete templates for elections

This commit is contained in:
Antoine Bartuccio 2016-12-25 23:49:02 +01:00
parent cd97901db1
commit 61e67898e1
4 changed files with 8 additions and 50 deletions

View File

@ -1,15 +0,0 @@
{% extends "core/base.jinja" %}
{% block title %}
{% trans %}Create{% endtrans %}
{% endblock %}
{% block content %}
<h2>{% trans %}Create{% endtrans %}
<section class="election__add-candidature">
<form action="" method="post">{{form.as_p()}}
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
{% csrf_token %}
</form>
</section>
{% endblock content %}

View File

@ -1,12 +0,0 @@
{% extends "core/base.jinja" %}
{% block title %}
{% trans %}Delete{% endtrans %}
{% endblock %}
{% block content %}
<form action="" method="post">{% csrf_token %}
<p>{% trans %}Are you sure you want to delete {% endtrans %}"{{ object }}"?</p>
<input type="submit" value="Confirm" />
</form>
{% endblock content %}

View File

@ -1,15 +0,0 @@
{% extends "core/base.jinja" %}
{% block title %}
{% trans %}Edit{% endtrans %}
{% endblock %}
{% block content %}
<h2>{% trans %}Edit{% endtrans %}
<section class="election__add-candidature">
<form action="" method="post">{{form.as_p()}}
<p><input type="submit" value="{% trans %}Save{% endtrans %}" /></p>
{% csrf_token %}
</form>
</section>
{% endblock content %}

View File

@ -266,7 +266,7 @@ class CandidatureCreateView(CanCreateMixin, CreateView):
class ElectionCreateView(CanCreateMixin, CreateView):
model = Election
form_class = ElectionForm
template_name = 'election/create_template.jinja'
template_name = 'core/create.jinja'
def dispatch(self, request, *args, **kwargs):
if not request.user.is_subscribed():
@ -286,7 +286,7 @@ class ElectionCreateView(CanCreateMixin, CreateView):
class RoleCreateView(CanCreateMixin, CreateView):
model = Role
form_class = RoleForm
template_name = 'election/create_template.jinja'
template_name = 'core/create.jinja'
def dispatch(self, request, *arg, **kwargs):
self.election = get_object_or_404(Election, pk=kwargs['election_id'])
@ -322,7 +322,7 @@ class RoleCreateView(CanCreateMixin, CreateView):
class ElectionListCreateView(CanCreateMixin, CreateView):
model = ElectionList
form_class = ElectionListForm
template_name = 'election/create_template.jinja'
template_name = 'core/create.jinja'
def dispatch(self, request, *arg, **kwargs):
self.election = get_object_or_404(Election, pk=kwargs['election_id'])
@ -363,7 +363,7 @@ class ElectionListCreateView(CanCreateMixin, CreateView):
class ElectionUpdateView(CanEditMixin, UpdateView):
model = Election
form_class = ElectionForm
template_name = 'election/update_template.jinja'
template_name = 'core/edit.jinja'
pk_url_kwarg = 'election_id'
def get_success_url(self, **kwargs):
@ -373,7 +373,7 @@ class ElectionUpdateView(CanEditMixin, UpdateView):
class CandidatureUpdateView(CanEditMixin, UpdateView):
model = Candidature
form_class = CandidateForm
template_name = 'election/update_template.jinja'
template_name = 'core/edit.jinja'
pk_url_kwarg = 'candidature_id'
def dispatch(self, request, *arg, **kwargs):
@ -409,7 +409,7 @@ class CandidatureUpdateView(CanEditMixin, UpdateView):
class RoleUpdateView(CanEditMixin, UpdateView):
model = Role
form_class = RoleForm
template_name = 'election/update_template.jinja'
template_name = 'core/edit.jinja'
pk_url_kwarg = 'role_id'
def dispatch(self, request, *arg, **kwargs):
@ -448,7 +448,7 @@ class RoleUpdateView(CanEditMixin, UpdateView):
class CandidatureDeleteView(CanEditMixin, DeleteView):
model = Candidature
template_name = 'election/delete_template.jinja'
template_name = 'core/delete_confirm.jinja'
pk_url_kwarg = 'candidature_id'
def dispatch(self, request, *arg, **kwargs):
@ -464,7 +464,7 @@ class CandidatureDeleteView(CanEditMixin, DeleteView):
class RoleDeleteView(CanEditMixin, DeleteView):
model = Role
template_name = 'election/delete_template.jinja'
template_name = 'core/delete_confirm.jinja'
pk_url_kwarg = 'role_id'
def dispatch(self, request, *arg, **kwargs):