diff options
author | supriya <supriya@dragbox.(none)> | 2012-06-29 11:20:00 +0530 |
---|---|---|
committer | supriya <supriya@dragbox.(none)> | 2012-06-29 11:20:00 +0530 |
commit | ca3767f7b4ef17423e130f70bbdf986e2e0a222e (patch) | |
tree | 50fb6e490e5f8b3c2cffe2d032c34b81545cf03e /gstudio | |
parent | f7ded0f46dfd50ee80e59a5f80fc0cd23f6455be (diff) | |
download | gnowsys-ca3767f7b4ef17423e130f70bbdf986e2e0a222e.tar.gz |
markitup added to admin interface
Diffstat (limited to 'gstudio')
-rw-r--r-- | gstudio/admin/attribute.py | 6 | ||||
-rw-r--r-- | gstudio/admin/metatype.py | 7 | ||||
-rw-r--r-- | gstudio/admin/objecttype.py | 6 | ||||
-rw-r--r-- | gstudio/admin/processtype.py | 7 | ||||
-rw-r--r-- | gstudio/admin/relation.py | 5 | ||||
-rw-r--r-- | gstudio/admin/relationtype.py | 6 | ||||
-rw-r--r-- | gstudio/admin/systemtype.py | 7 |
7 files changed, 40 insertions, 4 deletions
diff --git a/gstudio/admin/attribute.py b/gstudio/admin/attribute.py index 20dcfd9..babc9de 100644 --- a/gstudio/admin/attribute.py +++ b/gstudio/admin/attribute.py @@ -8,6 +8,7 @@ from gstudio.models import * import reversion from django.template.defaultfilters import slugify from gstudio.settings import GSTUDIO_VERSIONING +from markitup.widgets import AdminMarkItUpWidget if GSTUDIO_VERSIONING == True: parent_class = reversion.VersionAdmin @@ -29,7 +30,10 @@ class AttributeAdmin(parent_class): attribute.slug = slugify(attribute.title) attribute.save() - + def formfield_for_dbfield(self, db_field, **kwargs): + if db_field.name == 'content': + kwargs['widget'] = AdminMarkItUpWidget() + return super(AttributeAdmin, self).formfield_for_dbfield(db_field, **kwargs) diff --git a/gstudio/admin/metatype.py b/gstudio/admin/metatype.py index f110bac..5466cd5 100644 --- a/gstudio/admin/metatype.py +++ b/gstudio/admin/metatype.py @@ -2,7 +2,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ - +from markitup.widgets import AdminMarkItUpWidget from gstudio.admin.forms import MetatypeAdminForm import reversion from gstudio.settings import GSTUDIO_VERSIONING @@ -33,3 +33,8 @@ class MetatypeAdmin(parent_class): return '/%s/' % metatype.tree_path get_tree_path.allow_tags = True get_tree_path.short_description = _('tree path') + + def formfield_for_dbfield(self, db_field, **kwargs): + if db_field.name == 'content': + kwargs['widget'] = AdminMarkItUpWidget() + return super(MetatypeAdmin, self).formfield_for_dbfield(db_field, **kwargs) diff --git a/gstudio/admin/objecttype.py b/gstudio/admin/objecttype.py index 9fdb372..8d0eb4e 100644 --- a/gstudio/admin/objecttype.py +++ b/gstudio/admin/objecttype.py @@ -10,6 +10,7 @@ from django.conf.urls.defaults import patterns from django.conf import settings as project_settings from django.utils.translation import ugettext_lazy as _ from django.core.urlresolvers import reverse, NoReverseMatch +from markitup.widgets import AdminMarkItUpWidget from tagging.models import Tag @@ -111,6 +112,11 @@ class ObjecttypeAdmin(parent_class): get_metatypes.allow_tags = True get_metatypes.short_description = _('metatype(s)') + def formfield_for_dbfield(self, db_field, **kwargs): + if db_field.name == 'content': + kwargs['widget'] = AdminMarkItUpWidget() + return super(ObjecttypeAdmin, self).formfield_for_dbfield(db_field, **kwargs) + def get_tags(self, nodetype): """Return the tags linked in HTML""" try: diff --git a/gstudio/admin/processtype.py b/gstudio/admin/processtype.py index 1862de3..011c913 100644 --- a/gstudio/admin/processtype.py +++ b/gstudio/admin/processtype.py @@ -11,7 +11,7 @@ from django.conf.urls.defaults import patterns from django.conf import settings as project_settings from django.utils.translation import ugettext_lazy as _ from django.core.urlresolvers import reverse, NoReverseMatch - +from markitup.widgets import AdminMarkItUpWidget from tagging.models import Tag import reversion @@ -73,6 +73,11 @@ class ProcesstypeAdmin(parent_class): self.form.admin_site = admin_site super(ProcesstypeAdmin, self).__init__(model, admin_site) + def formfield_for_dbfield(self, db_field, **kwargs): + if db_field.name == 'content': + kwargs['widget'] = AdminMarkItUpWidget() + return super(ProcesstypeAdmin, self).formfield_for_dbfield(db_field, **kwargs) + # Custom Display def get_title(self, processtype): """Return the title with word count and number of comments""" diff --git a/gstudio/admin/relation.py b/gstudio/admin/relation.py index 7009afb..264a21b 100644 --- a/gstudio/admin/relation.py +++ b/gstudio/admin/relation.py @@ -2,6 +2,7 @@ from django.contrib import admin from django.core.urlresolvers import NoReverseMatch from django.utils.translation import ugettext_lazy as _ +from markitup.widgets import AdminMarkItUpWidget from gstudio.admin.forms import RelationAdminForm import reversion @@ -33,3 +34,7 @@ class RelationAdmin(parent_class): relation.slug = slugify(relation.title) relation.save() + def formfield_for_dbfield(self, db_field, **kwargs): + if db_field.name == 'content': + kwargs['widget'] = AdminMarkItUpWidget() + return super(RelationAdmin, self).formfield_for_dbfield(db_field, **kwargs) diff --git a/gstudio/admin/relationtype.py b/gstudio/admin/relationtype.py index 37e1a33..f83f108 100644 --- a/gstudio/admin/relationtype.py +++ b/gstudio/admin/relationtype.py @@ -10,6 +10,7 @@ from django.conf.urls.defaults import patterns from django.conf import settings as project_settings from django.utils.translation import ugettext_lazy as _ from django.core.urlresolvers import reverse, NoReverseMatch +from markitup.widgets import AdminMarkItUpWidget from tagging.models import Tag @@ -86,6 +87,11 @@ class RelationtypeAdmin(parent_class): def __init__(self, model, admin_site): self.form.admin_site = admin_site super(RelationtypeAdmin, self).__init__(model, admin_site) + + def formfield_for_dbfield(self, db_field, **kwargs): + if db_field.name == 'content': + kwargs['widget'] = AdminMarkItUpWidget() + return super(RelationtypeAdmin, self).formfield_for_dbfield(db_field, **kwargs) # Custom Display def get_title(self, relationtype): diff --git a/gstudio/admin/systemtype.py b/gstudio/admin/systemtype.py index 7041db0..7056184 100644 --- a/gstudio/admin/systemtype.py +++ b/gstudio/admin/systemtype.py @@ -11,7 +11,7 @@ from django.conf.urls.defaults import patterns from django.conf import settings as project_settings from django.utils.translation import ugettext_lazy as _ from django.core.urlresolvers import reverse, NoReverseMatch - +from markitup.widgets import AdminMarkItUpWidget from tagging.models import Tag import reversion @@ -77,6 +77,11 @@ class SystemtypeAdmin(parent_class): self.form.admin_site = admin_site super(SystemtypeAdmin, self).__init__(model, admin_site) + def formfield_for_dbfield(self, db_field, **kwargs): + if db_field.name == 'content': + kwargs['widget'] = AdminMarkItUpWidget() + return super(SystemtypeAdmin, self).formfield_for_dbfield(db_field, **kwargs) + # Custom Display def get_title(self, systemtype): """Return the title with word count and number of comments""" |