diff options
author | gnowgi <nagarjun@gnowledge.org> | 2012-06-29 00:36:52 -0700 |
---|---|---|
committer | gnowgi <nagarjun@gnowledge.org> | 2012-06-29 00:36:52 -0700 |
commit | 71829c19e5b711503d010e594563a0a14bbf8d54 (patch) | |
tree | 50fb6e490e5f8b3c2cffe2d032c34b81545cf03e | |
parent | f7ded0f46dfd50ee80e59a5f80fc0cd23f6455be (diff) | |
parent | ca3767f7b4ef17423e130f70bbdf986e2e0a222e (diff) | |
download | gnowsys-71829c19e5b711503d010e594563a0a14bbf8d54.tar.gz |
Merge pull request #61 from supriyasawant/master
markitup editor added to admin interface
-rw-r--r-- | demo/settings.py | 1 | ||||
-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 | ||||
-rw-r--r-- | objectapp/admin/gbobject.py | 7 | ||||
-rw-r--r-- | objectapp/admin/process.py | 9 | ||||
-rw-r--r-- | objectapp/admin/system.py | 7 |
11 files changed, 60 insertions, 8 deletions
diff --git a/demo/settings.py b/demo/settings.py index a0c2513..2935520 100644 --- a/demo/settings.py +++ b/demo/settings.py @@ -126,6 +126,7 @@ INSTALLED_APPS = ( 'mptt', 'reversion', 'tagging', + 'markitup', 'django_xmlrpc', 'grappelli.dashboard', 'grappelli', 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""" diff --git a/objectapp/admin/gbobject.py b/objectapp/admin/gbobject.py index 3fc445a..7828662 100644 --- a/objectapp/admin/gbobject.py +++ b/objectapp/admin/gbobject.py @@ -47,7 +47,7 @@ from django.utils.translation import ugettext_lazy as _ from django.core.urlresolvers import reverse, NoReverseMatch import reversion from tagging.models import Tag - +from markitup.widgets import AdminMarkItUpWidget from objectapp import settings from objectapp.managers import HIDDEN from objectapp.managers import PUBLISHED @@ -125,6 +125,11 @@ class GbobjectAdmin(reversion.VersionAdmin): get_authors.allow_tags = True get_authors.short_description = _('author(s)') + def formfield_for_dbfield(self, db_field, **kwargs): + if db_field.name == 'content': + kwargs['widget'] = AdminMarkItUpWidget() + return super(GbobjectAdmin, self).formfield_for_dbfield(db_field, **kwargs) + def get_objecttypes(self, gbobject): """Return the objecttypes linked in HTML""" try: diff --git a/objectapp/admin/process.py b/objectapp/admin/process.py index 21f9e07..2bfcc63 100644 --- a/objectapp/admin/process.py +++ b/objectapp/admin/process.py @@ -30,7 +30,7 @@ from django.utils.translation import ugettext_lazy as _ from django.core.urlresolvers import reverse, NoReverseMatch import reversion from tagging.models import Tag - +from markitup.widgets import AdminMarkItUpWidget from objectapp import settings from objectapp.managers import HIDDEN from objectapp.managers import PUBLISHED @@ -105,7 +105,12 @@ class ProcessAdmin(reversion.VersionAdmin): {'title': title, 'comments': comments} return title get_title.short_description = _('title') - + + def formfield_for_dbfield(self, db_field, **kwargs): + if db_field.name == 'content': + kwargs['widget'] = AdminMarkItUpWidget() + return super(ProcessAdmin, self).formfield_for_dbfield(db_field, **kwargs) + def get_authors(self, process): """Return the authors in HTML""" try: diff --git a/objectapp/admin/system.py b/objectapp/admin/system.py index 387a26c..20b91a7 100644 --- a/objectapp/admin/system.py +++ b/objectapp/admin/system.py @@ -13,7 +13,7 @@ from django.utils.translation import ugettext_lazy as _ from django.core.urlresolvers import reverse, NoReverseMatch import reversion from tagging.models import Tag - +from markitup.widgets import AdminMarkItUpWidget from objectapp import settings from objectapp.managers import HIDDEN from objectapp.managers import PUBLISHED @@ -77,6 +77,11 @@ class SystemAdmin(reversion.VersionAdmin): self.form.admin_site = admin_site super(SystemAdmin, self).__init__(model, admin_site) + def formfield_for_dbfield(self, db_field, **kwargs): + if db_field.name == 'content': + kwargs['widget'] = AdminMarkItUpWidget() + return super(SystemAdmin, self).formfield_for_dbfield(db_field, **kwargs) + # Custom Display def get_title(self, system): """Return the title with word count and number of comments""" |