Added descriptions to item categories

This commit is contained in:
Raphael Michel
2016-04-21 21:48:53 +02:00
parent 38f0e6e6d6
commit 765ae39fa0
5 changed files with 38 additions and 2 deletions

View File

@@ -0,0 +1,26 @@
# -*- coding: utf-8 -*-
# Generated by Django 1.9.4 on 2016-04-21 19:43
from __future__ import unicode_literals
from django.db import migrations, models
import pretix.base.i18n
class Migration(migrations.Migration):
dependencies = [
('pretixbase', '0019_auto_20160326_1139'),
]
operations = [
migrations.AddField(
model_name='itemcategory',
name='description',
field=pretix.base.i18n.I18nTextField(blank=True, verbose_name='Category description'),
),
migrations.AlterField(
model_name='questionanswer',
name='options',
field=models.ManyToManyField(blank=True, related_name='answers', to='pretixbase.QuestionOption'),
),
]

View File

@@ -36,6 +36,9 @@ class ItemCategory(LoggedModel):
max_length=255,
verbose_name=_("Category name"),
)
description = I18nTextField(
blank=True, verbose_name=_("Category description")
)
position = models.IntegerField(
default=0
)

View File

@@ -16,7 +16,8 @@ class CategoryForm(I18nModelForm):
model = ItemCategory
localized_fields = '__all__'
fields = [
'name'
'name',
'description'
]

View File

@@ -10,6 +10,7 @@
<fieldset>
<legend>{% trans "General information" %}</legend>
{% bootstrap_field form.name layout="horizontal" %}
{% bootstrap_field form.description layout="horizontal" %}
</fieldset>
<div class="form-group submit-group">
<button type="submit" class="btn btn-primary btn-save">

View File

@@ -56,7 +56,12 @@
{% csrf_token %}
{% for tup in items_by_category %}
<section>
{% if tup.0 %}<h3>{{ tup.0.name }}</h3>{% endif %}
{% if tup.0 %}
<h3>{{ tup.0.name }}</h3>
{% if tup.0.description %}
<p>{{ tup.0.description }}</p>
{% endif %}
{% endif %}
{% for item in tup.1 %}
{% if item.has_variations %}
<div class="item-with-variations">