Commits

Tay Ray Chuan  committed 7867a1e

satchmo_utils.urlhelper: add reverse_admin_url()

  • Participants
  • Parent commits 2c199b1

Comments (0)

Files changed (1)

File satchmo/apps/satchmo_utils/urlhelper.py

 def replace_urlpatterns(urlpatterns, replacelist):
     for replace in replacelist:
         replace_urlpattern(urlpatterns, replace)
+
+def reverse_admin_url(model, action, args=None, kwargs=None):
+    from django.core.urlresolvers import reverse
+    meta = model._meta
+    name = 'admin:%s_%s_%s' % (meta.app_label, meta.module_name, action)
+    return reverse(name, args=args, kwargs=kwargs)