From 9bbfcaec3e58c99635b5abe7484e44b41e60d5fc Mon Sep 17 00:00:00 2001 From: zuber Date: Wed, 19 Aug 2009 15:59:50 +0200 Subject: [PATCH] =?utf8?q?Dodanie=20aplikacji=20toolbar=20przechowuj=C4=85?= =?utf8?q?cej=20ustawienia=20toolbara=20z=20edytora=20dla=20redaktor=C3=B3?= =?utf8?q?w=20technicznych.=20Refs=20#53.?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- apps/toolbar/__init__.py | 0 apps/toolbar/admin.py | 25 ++++++++++++++++++ apps/toolbar/models.py | 32 +++++++++++++++++++++++ apps/toolbar/templatetags/__init__.py | 0 apps/toolbar/templatetags/toolbar_tags.py | 0 project/settings.py | 3 ++- 6 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 apps/toolbar/__init__.py create mode 100644 apps/toolbar/admin.py create mode 100644 apps/toolbar/models.py create mode 100644 apps/toolbar/templatetags/__init__.py create mode 100644 apps/toolbar/templatetags/toolbar_tags.py diff --git a/apps/toolbar/__init__.py b/apps/toolbar/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/apps/toolbar/admin.py b/apps/toolbar/admin.py new file mode 100644 index 00000000..2c8cd28c --- /dev/null +++ b/apps/toolbar/admin.py @@ -0,0 +1,25 @@ +from django.contrib import admin +from django.utils.translation import ugettext_lazy as _ + +from toolbar import models + + +class ButtonGroupAdmin(admin.ModelAdmin): + list_display = ('name', 'slug', 'position',) + search_fields = ('name', 'slug',) + prepopulated_fields = {'slug': ('name',)} + list_editable = ('position',) + +admin.site.register(models.ButtonGroup, ButtonGroupAdmin) + + +class ButtonAdmin(admin.ModelAdmin): + list_display = ('label', 'slug', 'tag', 'key', 'position',) + list_filter = ('group',) + search_fields = ('label', 'slug', 'tag', 'key',) + prepopulated_fields = {'slug': ('label',)} + filter_horizontal = ('group',) + list_editable = ('position',) + +admin.site.register(models.Button, ButtonAdmin) + diff --git a/apps/toolbar/models.py b/apps/toolbar/models.py new file mode 100644 index 00000000..ad4752af --- /dev/null +++ b/apps/toolbar/models.py @@ -0,0 +1,32 @@ +from django.db import models +from django.utils.translation import ugettext_lazy as _ + + +class ButtonGroup(models.Model): + name = models.CharField(max_length=32) + slug = models.SlugField() + position = models.IntegerField(default=0) + + class Meta: + ordering = ['name'] + verbose_name, verbose_name_plural = _('button group'), _('button groups') + + def __unicode__(self): + return self.name + + +class Button(models.Model): + label = models.CharField(max_length=32) + slug = models.SlugField() + tag = models.CharField(max_length=128) + key = models.IntegerField(blank=True, null=True) + position = models.IntegerField(default=0) + + group = models.ManyToManyField(ButtonGroup) + + class Meta: + ordering = ['label'] + verbose_name, verbose_name_plural = _('button'), _('buttons') + + def __unicode__(self): + return self.label diff --git a/apps/toolbar/templatetags/__init__.py b/apps/toolbar/templatetags/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/apps/toolbar/templatetags/toolbar_tags.py b/apps/toolbar/templatetags/toolbar_tags.py new file mode 100644 index 00000000..e69de29b diff --git a/project/settings.py b/project/settings.py index 5632527f..c5b0c2db 100644 --- a/project/settings.py +++ b/project/settings.py @@ -101,7 +101,8 @@ INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.admindocs', - 'explorer' + 'explorer', + 'toolbar', ) REPOSITORY_PATH = '/Users/zuber/Projekty/platforma/files/books' -- 2.20.1