From: zuber Date: Wed, 19 Aug 2009 14:20:24 +0000 (+0200) Subject: Dodanie inclusion taga {% toolbar %} wstawiajÄ…cego toolbar z ustawieniami z interfejs... X-Git-Url: https://git.mdrn.pl/redakcja.git/commitdiff_plain/3d0adb378d1e6699875f1de5ed68989fb3a25877?ds=inline;hp=-c Dodanie inclusion taga {% toolbar %} wstawiajÄ…cego toolbar z ustawieniami z interfejsu administracyjnego do aplikacji toolbar. --- 3d0adb378d1e6699875f1de5ed68989fb3a25877 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} +