1 2 3 4 5 6 7 8 9 | from django.db.models import permalink
@permalink
def get_admin_url(obj):
"Returns the URL to the object in the Django admin site."
from django.contrib.contenttypes.models import ContentType
content_type = ContentType.objects.get_for_model(obj)
return ('django.contrib.admin.views.main.change_stage',
[content_type.app_label, content_type.model, str(obj.pk)])
|
More like this
- Get admin url for a model by timbroder 2 years ago
- Changelist filter by ForeignKey by overclocked 1 year, 2 months ago
- ExtendibleModelAdminMixin by dokterbob 2 years, 2 months ago
- Default to current/all sites in admin (updated!) by dokterbob 3 years, 4 months ago
- Front end admin toolbar by eallik 2 years, 2 months ago
Comments