Updated motion category template.
This commit is contained in:
parent
ff848a865a
commit
d9fbaf9aa7
@ -527,7 +527,7 @@ class MotionSupporter(models.Model):
|
|||||||
|
|
||||||
class Category(models.Model):
|
class Category(models.Model):
|
||||||
name = models.CharField(max_length=255, verbose_name=ugettext_lazy("Category name"))
|
name = models.CharField(max_length=255, verbose_name=ugettext_lazy("Category name"))
|
||||||
prefix = models.CharField(max_length=32, verbose_name=ugettext_lazy("Category prefix"))
|
prefix = models.CharField(max_length=32, verbose_name=ugettext_lazy("Prefix"))
|
||||||
|
|
||||||
def __unicode__(self):
|
def __unicode__(self):
|
||||||
return self.name
|
return self.name
|
||||||
@ -536,6 +536,8 @@ class Category(models.Model):
|
|||||||
if link == 'update' or link == 'edit':
|
if link == 'update' or link == 'edit':
|
||||||
return reverse('motion_category_update', args=[str(self.id)])
|
return reverse('motion_category_update', args=[str(self.id)])
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
ordering = ['prefix']
|
||||||
|
|
||||||
## class Comment(models.Model):
|
## class Comment(models.Model):
|
||||||
## motion_version = models.ForeignKey(MotionVersion)
|
## motion_version = models.ForeignKey(MotionVersion)
|
||||||
|
@ -5,7 +5,7 @@
|
|||||||
|
|
||||||
{% block title %}
|
{% block title %}
|
||||||
{{ block.super }} –
|
{{ block.super }} –
|
||||||
{% if motion %}
|
{% if category %}
|
||||||
{% trans "Edit category" %}
|
{% trans "Edit category" %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% trans "New category" %}
|
{% trans "New category" %}
|
||||||
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>
|
<h1>
|
||||||
{% if motion %}
|
{% if category %}
|
||||||
{% trans "Edit category" %}
|
{% trans "Edit category" %}
|
||||||
{% else %}
|
{% else %}
|
||||||
{% trans "New category" %}
|
{% trans "New category" %}
|
||||||
@ -24,7 +24,7 @@
|
|||||||
{% include "form.html" %}
|
{% include "form.html" %}
|
||||||
<p>
|
<p>
|
||||||
{% include "formbuttons_saveapply.html" %}
|
{% include "formbuttons_saveapply.html" %}
|
||||||
<a href='{% url 'motion_list' %}' class="btn">
|
<a href='{% url 'motion_category_list' %}' class="btn">
|
||||||
{% trans 'Cancel' %}
|
{% trans 'Cancel' %}
|
||||||
</a>
|
</a>
|
||||||
</p>
|
</p>
|
||||||
|
@ -6,9 +6,37 @@
|
|||||||
{% block title %}{{ block.super }} – {% trans "Motions" %}{% endblock %}
|
{% block title %}{{ block.super }} – {% trans "Motions" %}{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<h1>{% trans "Categories" %}</h1>
|
<h1>
|
||||||
|
{% trans "Categories" %}
|
||||||
|
<small class="pull-right">
|
||||||
|
{% if perms.motion.can_manage_motion %}
|
||||||
|
<a href="{% url 'motion_category_create' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New motion' %}"><i class="icon-plus icon-white"></i> {% trans 'New' %}</a>
|
||||||
|
{% endif %}
|
||||||
|
<a href="{% url 'motion_list' %}" class="btn btn-mini"><i class="icon-chevron-left"></i> {% trans "Back to overview" %}</a>
|
||||||
|
</small>
|
||||||
|
</h1>
|
||||||
|
|
||||||
|
<table class="table table-striped table-bordered">
|
||||||
|
<tr>
|
||||||
|
<th class="mini_width">{% trans "Prefix" %}</th>
|
||||||
|
<th>{% trans "Category name" %}</th>
|
||||||
|
<th class="mini_width">{% trans "Actions" %}</th>
|
||||||
|
</tr>
|
||||||
{% for category in category_list %}
|
{% for category in category_list %}
|
||||||
<p><a href="{% model_url category 'update' %}">{{ category }}</a></p>
|
<tr>
|
||||||
|
<td>{{ category.prefix }}</td>
|
||||||
|
<td><a href="{% model_url category 'update' %}">{{ category }}</a></td>
|
||||||
|
<td><span style="width: 1px; white-space: nowrap;">
|
||||||
|
<a href="{% model_url category 'update' %}" title="{% trans 'Edit' %}" class="btn btn-mini">
|
||||||
|
<i class="icon-pencil"></i>
|
||||||
|
</a>
|
||||||
|
{# TODO: motion_category_delete #}
|
||||||
|
<a href="{% url 'motion_delete' category.id %}" title="{% trans 'Delete' %}" class="btn btn-mini">
|
||||||
|
<i class="icon-remove"></i>
|
||||||
|
</a>
|
||||||
|
</span>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
{% empty %}
|
{% empty %}
|
||||||
<p>No Categories</p>
|
<p>No Categories</p>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
@ -10,9 +10,10 @@
|
|||||||
{% trans "Motions" %}
|
{% trans "Motions" %}
|
||||||
<small class="pull-right">
|
<small class="pull-right">
|
||||||
{% if perms.motion.can_create_motion %}
|
{% if perms.motion.can_create_motion %}
|
||||||
<a href="{% url 'motion_new' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New motion' %}"><i class="icon-plus icon-white"></i> {% trans "New" %}</a>
|
<a href="{% url 'motion_new' %}" class="btn btn-mini btn-primary" rel="tooltip" data-original-title="{% trans 'New motion' %}"><i class="icon-plus icon-white"></i> {% trans 'New' %}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if perms.motion.can_manage_motion %}
|
{% if perms.motion.can_manage_motion %}
|
||||||
|
<a href="{% url 'motion_category_list' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'New motion' %}"><i class="icon-th-large"></i> {% trans 'Category' %}</a>
|
||||||
{# <a href="{% url 'motion_import' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Import motions' %}"><i class="icon-import"></i> {% trans 'Import' %}</a>#}
|
{# <a href="{% url 'motion_import' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Import motions' %}"><i class="icon-import"></i> {% trans 'Import' %}</a>#}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
<a href="{% url 'motion_list_pdf' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print all motions as PDF' %}"><i class="icon-print"></i> PDF</a>
|
<a href="{% url 'motion_list_pdf' %}" class="btn btn-mini" rel="tooltip" data-original-title="{% trans 'Print all motions as PDF' %}"><i class="icon-print"></i> PDF</a>
|
||||||
|
@ -479,6 +479,7 @@ category_list = CategoryListView.as_view()
|
|||||||
class CategoryCreateView(CreateView):
|
class CategoryCreateView(CreateView):
|
||||||
permission_required = 'motion.can_manage_motion'
|
permission_required = 'motion.can_manage_motion'
|
||||||
model = Category
|
model = Category
|
||||||
|
success_url_name = 'motion_category_list'
|
||||||
|
|
||||||
category_create = CategoryCreateView.as_view()
|
category_create = CategoryCreateView.as_view()
|
||||||
|
|
||||||
@ -486,6 +487,7 @@ category_create = CategoryCreateView.as_view()
|
|||||||
class CategoryUpdateView(UpdateView):
|
class CategoryUpdateView(UpdateView):
|
||||||
permission_required = 'motion.can_manage_motion'
|
permission_required = 'motion.can_manage_motion'
|
||||||
model = Category
|
model = Category
|
||||||
|
success_url_name = 'motion_category_list'
|
||||||
|
|
||||||
category_update = CategoryUpdateView.as_view()
|
category_update = CategoryUpdateView.as_view()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user