Permalink
Browse files

Separated PlaceholderAdmin into a mixin class to be used together wit…

…h admin.ModelAdmin
  • Loading branch information...
jrief committed Feb 27, 2014
1 parent 3bc4a25 commit d67a00407d8da4e76c8f724ce4722f94ec60eb33
Showing with 9 additions and 2 deletions.
  1. +9 −2 cms/admin/placeholderadmin.py
@@ -111,7 +111,7 @@ def edit_field(self, request, object_id, language):
return render_to_response('admin/cms/page/plugin/change_form.html', context, RequestContext(request))
-class PlaceholderAdmin(ModelAdmin):
+class PlaceholderAdminMixin(object):
def get_urls(self):
"""
Register the plugin specific urls (add/edit/copy/remove/move)
@@ -130,7 +130,7 @@ def get_urls(self):
pat(r'clear-placeholder/([0-9]+)/$', self.clear_placeholder),
pat(r'move-plugin/$', self.move_plugin),
)
- return url_patterns + super(PlaceholderAdmin, self).get_urls()
+ return url_patterns + super(PlaceholderAdminMixin, self).get_urls()
def has_add_plugin_permission(self, request, placeholder, plugin_type):
if not permissions.has_plugin_permission(request.user, plugin_type, "add"):
@@ -547,3 +547,10 @@ def clear_placeholder(self, request, placeholder_id):
}
return TemplateResponse(request, "admin/cms/page/plugin/delete_confirmation.html", context,
current_app=self.admin_site.name)
+
+
+class PlaceholderAdmin(PlaceholderAdminMixin, ModelAdmin):
+ def __init__(self, *args, **kwargs):
+ warnings.warn("Class PlaceholderAdmin is deprecated and will be removed in 3.1. "
+ "Instead, combine PlaceholderAdminMixin with admin.ModelAdmin.", DeprecationWarning)
+ super(PlaceholderAdmin, self).__init__(*args, **kwargs)

0 comments on commit d67a004

Please sign in to comment.