from django.core import urlresolvers from django.contrib.contenttypes.models import ContentType def get_admin_url(self): content_type = ContentType.objects.get_for_model(self.__class__) return urlresolvers.reverse("admin:%s_%s_change" % (content_type.app_label, content_type.model), args=(self.id,))