mirror of
https://github.com/ae-utbm/sith.git
synced 2024-11-22 06:03:20 +00:00
Coherent create/edit/delete templates for elections
This commit is contained in:
parent
cd97901db1
commit
61e67898e1
@ -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 %}
|
|
@ -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 %}
|
|
@ -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 %}
|
|
@ -266,7 +266,7 @@ class CandidatureCreateView(CanCreateMixin, CreateView):
|
|||||||
class ElectionCreateView(CanCreateMixin, CreateView):
|
class ElectionCreateView(CanCreateMixin, CreateView):
|
||||||
model = Election
|
model = Election
|
||||||
form_class = ElectionForm
|
form_class = ElectionForm
|
||||||
template_name = 'election/create_template.jinja'
|
template_name = 'core/create.jinja'
|
||||||
|
|
||||||
def dispatch(self, request, *args, **kwargs):
|
def dispatch(self, request, *args, **kwargs):
|
||||||
if not request.user.is_subscribed():
|
if not request.user.is_subscribed():
|
||||||
@ -286,7 +286,7 @@ class ElectionCreateView(CanCreateMixin, CreateView):
|
|||||||
class RoleCreateView(CanCreateMixin, CreateView):
|
class RoleCreateView(CanCreateMixin, CreateView):
|
||||||
model = Role
|
model = Role
|
||||||
form_class = RoleForm
|
form_class = RoleForm
|
||||||
template_name = 'election/create_template.jinja'
|
template_name = 'core/create.jinja'
|
||||||
|
|
||||||
def dispatch(self, request, *arg, **kwargs):
|
def dispatch(self, request, *arg, **kwargs):
|
||||||
self.election = get_object_or_404(Election, pk=kwargs['election_id'])
|
self.election = get_object_or_404(Election, pk=kwargs['election_id'])
|
||||||
@ -322,7 +322,7 @@ class RoleCreateView(CanCreateMixin, CreateView):
|
|||||||
class ElectionListCreateView(CanCreateMixin, CreateView):
|
class ElectionListCreateView(CanCreateMixin, CreateView):
|
||||||
model = ElectionList
|
model = ElectionList
|
||||||
form_class = ElectionListForm
|
form_class = ElectionListForm
|
||||||
template_name = 'election/create_template.jinja'
|
template_name = 'core/create.jinja'
|
||||||
|
|
||||||
def dispatch(self, request, *arg, **kwargs):
|
def dispatch(self, request, *arg, **kwargs):
|
||||||
self.election = get_object_or_404(Election, pk=kwargs['election_id'])
|
self.election = get_object_or_404(Election, pk=kwargs['election_id'])
|
||||||
@ -363,7 +363,7 @@ class ElectionListCreateView(CanCreateMixin, CreateView):
|
|||||||
class ElectionUpdateView(CanEditMixin, UpdateView):
|
class ElectionUpdateView(CanEditMixin, UpdateView):
|
||||||
model = Election
|
model = Election
|
||||||
form_class = ElectionForm
|
form_class = ElectionForm
|
||||||
template_name = 'election/update_template.jinja'
|
template_name = 'core/edit.jinja'
|
||||||
pk_url_kwarg = 'election_id'
|
pk_url_kwarg = 'election_id'
|
||||||
|
|
||||||
def get_success_url(self, **kwargs):
|
def get_success_url(self, **kwargs):
|
||||||
@ -373,7 +373,7 @@ class ElectionUpdateView(CanEditMixin, UpdateView):
|
|||||||
class CandidatureUpdateView(CanEditMixin, UpdateView):
|
class CandidatureUpdateView(CanEditMixin, UpdateView):
|
||||||
model = Candidature
|
model = Candidature
|
||||||
form_class = CandidateForm
|
form_class = CandidateForm
|
||||||
template_name = 'election/update_template.jinja'
|
template_name = 'core/edit.jinja'
|
||||||
pk_url_kwarg = 'candidature_id'
|
pk_url_kwarg = 'candidature_id'
|
||||||
|
|
||||||
def dispatch(self, request, *arg, **kwargs):
|
def dispatch(self, request, *arg, **kwargs):
|
||||||
@ -409,7 +409,7 @@ class CandidatureUpdateView(CanEditMixin, UpdateView):
|
|||||||
class RoleUpdateView(CanEditMixin, UpdateView):
|
class RoleUpdateView(CanEditMixin, UpdateView):
|
||||||
model = Role
|
model = Role
|
||||||
form_class = RoleForm
|
form_class = RoleForm
|
||||||
template_name = 'election/update_template.jinja'
|
template_name = 'core/edit.jinja'
|
||||||
pk_url_kwarg = 'role_id'
|
pk_url_kwarg = 'role_id'
|
||||||
|
|
||||||
def dispatch(self, request, *arg, **kwargs):
|
def dispatch(self, request, *arg, **kwargs):
|
||||||
@ -448,7 +448,7 @@ class RoleUpdateView(CanEditMixin, UpdateView):
|
|||||||
|
|
||||||
class CandidatureDeleteView(CanEditMixin, DeleteView):
|
class CandidatureDeleteView(CanEditMixin, DeleteView):
|
||||||
model = Candidature
|
model = Candidature
|
||||||
template_name = 'election/delete_template.jinja'
|
template_name = 'core/delete_confirm.jinja'
|
||||||
pk_url_kwarg = 'candidature_id'
|
pk_url_kwarg = 'candidature_id'
|
||||||
|
|
||||||
def dispatch(self, request, *arg, **kwargs):
|
def dispatch(self, request, *arg, **kwargs):
|
||||||
@ -464,7 +464,7 @@ class CandidatureDeleteView(CanEditMixin, DeleteView):
|
|||||||
|
|
||||||
class RoleDeleteView(CanEditMixin, DeleteView):
|
class RoleDeleteView(CanEditMixin, DeleteView):
|
||||||
model = Role
|
model = Role
|
||||||
template_name = 'election/delete_template.jinja'
|
template_name = 'core/delete_confirm.jinja'
|
||||||
pk_url_kwarg = 'role_id'
|
pk_url_kwarg = 'role_id'
|
||||||
|
|
||||||
def dispatch(self, request, *arg, **kwargs):
|
def dispatch(self, request, *arg, **kwargs):
|
||||||
|
Loading…
Reference in New Issue
Block a user