Commit 755997a9 authored by Jens Langhammer's avatar Jens Langhammer

admin: add generic create and delete template

parent 5c5c865c
{% extends "generic/create.html" %}
{% load i18n %}
{% block title %}
{% blocktrans with type=request.GET.type %}Create {{ type }}{% endblocktrans %}
{% endblock %}
{% block above_form %}
<h1>{% blocktrans with type=request.GET.type %}Create {{ type }}{% endblocktrans %}</h1>
{% endblock %}
\ No newline at end of file
{% extends "administration/base.html" %}
{% load i18n %}
{% load utils %}
{% block content %}
<div class="container">
{% block above_form %}
<h1>{% trans 'Delete' %}</h1>
{% endblock %}
<div class="">
<form method="post" class="form-horizontal">
{% csrf_token %}
<p>Are you sure you want to delete "{{ object }}"?</p>
<a href="{% back %}" class="btn btn-default">{% trans 'Back' %}</a>
<input type="submit" class="btn btn-danger" value="{% trans 'Delete' %}" />
</form>
</div>
</div>
{% endblock %}
\ No newline at end of file
{% extends "administration/base.html" %}
{% load crispy_forms_tags %}
{% load i18n %}
{% load utils %}
{% block content %}
<div class="container">
......@@ -10,6 +10,7 @@
<div class="">
<form action="" method="post" class="form-horizontal">
{% include 'blocks/form.html' with form=form %}
<a class="btn btn-default" href="{% back %}">{% trans "Cancel" %}</a>
<input type="submit" class="btn btn-primary" value="{% trans 'Create' %}" />
</form>
</div>
......
......@@ -28,7 +28,7 @@ class RuleListView(AdminRequiredMixin, ListView):
class RuleCreateView(SuccessMessageMixin, AdminRequiredMixin, CreateView):
"""Create new Rule"""
template_name = 'administration/rule/create.html'
template_name = 'generic/create_inheritance.html'
success_url = reverse_lazy('passbook_admin:rules')
success_message = _('Successfully created Rule')
......@@ -55,18 +55,16 @@ class RuleUpdateView(SuccessMessageMixin, AdminRequiredMixin, UpdateView):
return form_class
def get_object(self, queryset=None):
obj = Rule.objects.get(pk=self.kwargs.get('pk'))
return obj.cast()
return Rule.objects.filter(pk=self.kwargs.get('pk')).select_subclasses().first()
class RuleDeleteView(SuccessMessageMixin, AdminRequiredMixin, DeleteView):
"""Delete rule"""
model = Rule
template_name = 'generic/delete.html'
success_url = reverse_lazy('passbook_admin:rules')
success_message = _('Successfully updated Rule')
def get_object(self, queryset=None):
obj = Rule.objects.get(pk=self.kwargs.get('pk'))
return obj.cast()
return Rule.objects.filter(pk=self.kwargs.get('pk')).select_subclasses().first()
......@@ -28,7 +28,7 @@ class SourceListView(AdminRequiredMixin, ListView):
class SourceCreateView(SuccessMessageMixin, AdminRequiredMixin, CreateView):
"""Create new Source"""
template_name = 'administration/source/create.html'
template_name = 'generic/create_inheritance.html'
success_url = reverse_lazy('passbook_admin:sources')
success_message = _('Successfully created Source')
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment