From 3d0adb378d1e6699875f1de5ed68989fb3a25877 Mon Sep 17 00:00:00 2001 From: zuber Date: Wed, 19 Aug 2009 16:20:24 +0200 Subject: [PATCH] =?utf8?q?Dodanie=20inclusion=20taga=20{%=20toolbar=20%}?= =?utf8?q?=20wstawiaj=C4=85cego=20toolbar=20z=20ustawieniami=20z=20interfe?= =?utf8?q?jsu=20administracyjnego=20do=20aplikacji=20toolbar.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- apps/toolbar/models.py | 5 +++-- apps/toolbar/templates/toolbar/toolbar.html | 18 ++++++++++++++++++ apps/toolbar/templatetags/toolbar_tags.py | 13 +++++++++++++ 3 files changed, 34 insertions(+), 2 deletions(-) create mode 100644 apps/toolbar/templates/toolbar/toolbar.html diff --git a/apps/toolbar/models.py b/apps/toolbar/models.py index ad4752af..8e2387dc 100644 --- a/apps/toolbar/models.py +++ b/apps/toolbar/models.py @@ -8,7 +8,7 @@ class ButtonGroup(models.Model): position = models.IntegerField(default=0) class Meta: - ordering = ['name'] + ordering = ('position', 'name',) verbose_name, verbose_name_plural = _('button group'), _('button groups') def __unicode__(self): @@ -25,8 +25,9 @@ class Button(models.Model): group = models.ManyToManyField(ButtonGroup) class Meta: - ordering = ['label'] + ordering = ('position', 'label',) verbose_name, verbose_name_plural = _('button'), _('buttons') def __unicode__(self): return self.label + diff --git a/apps/toolbar/templates/toolbar/toolbar.html b/apps/toolbar/templates/toolbar/toolbar.html new file mode 100644 index 00000000..2e612885 --- /dev/null +++ b/apps/toolbar/templates/toolbar/toolbar.html @@ -0,0 +1,18 @@ +
+
    + {% for group in groups %} +
  1. {{ group.name }}
  2. + {% endfor %} +
+
 
+
+ {% for group in groups %} + + {% endfor %} +
 
+
+
\ No newline at end of file diff --git a/apps/toolbar/templatetags/toolbar_tags.py b/apps/toolbar/templatetags/toolbar_tags.py index e69de29b..69b5b380 100644 --- a/apps/toolbar/templatetags/toolbar_tags.py +++ b/apps/toolbar/templatetags/toolbar_tags.py @@ -0,0 +1,13 @@ +from django import template + +from toolbar import models + + +register = template.Library() + + +@register.inclusion_tag('toolbar/toolbar.html') +def toolbar(): + groups = models.ButtonGroup.objects.all() + return {'groups': groups} + -- 2.20.1