How to get edit url for model instance

Sep 28, 2013 · by Tim Kamanin

Use this:

urlresolvers.reverse("admin:%s_%s_change" % (self.model._meta.app_label, self.model._meta.module_name), args=(object_id,))

to redirect to object edit page after performing some action, use this snippet:

return redirect(urlresolvers.reverse("admin:%s_%s_change" % (self.model._meta.app_label, self.model._meta.module_name), args=(object_id,)))

Want to get more 🔥 tips like this one?

Subscribe to get notified about new dev tutorials