Fix view on site links in custom admin
Found a Django admin bug!
This commit is contained in:
parent
4ffdbb0f59
commit
977b13b556
1 changed files with 10 additions and 0 deletions
|
|
@ -94,6 +94,11 @@ class GovernmentPlanAdmin(admin.ModelAdmin):
|
||||||
)
|
)
|
||||||
return qs
|
return qs
|
||||||
|
|
||||||
|
def view_on_site(self, obj):
|
||||||
|
# Avoid Django's redirect through normal admin
|
||||||
|
# TODO: remove on https://github.com/django/django/pull/15526
|
||||||
|
return obj.get_absolute_url()
|
||||||
|
|
||||||
def get_actions(self, request):
|
def get_actions(self, request):
|
||||||
actions = super().get_actions(request)
|
actions = super().get_actions(request)
|
||||||
if not has_limited_access(request.user):
|
if not has_limited_access(request.user):
|
||||||
|
|
@ -205,6 +210,11 @@ class GovernmentPlanUpdateAdmin(admin.ModelAdmin):
|
||||||
qs = qs.filter(plan__in=get_allowed_plans(request))
|
qs = qs.filter(plan__in=get_allowed_plans(request))
|
||||||
return qs
|
return qs
|
||||||
|
|
||||||
|
def view_on_site(self, obj):
|
||||||
|
# Avoid Django's redirect through normal admin
|
||||||
|
# TODO: remove on https://github.com/django/django/pull/15526
|
||||||
|
return obj.get_absolute_url()
|
||||||
|
|
||||||
def save_model(self, request, obj, form, change):
|
def save_model(self, request, obj, form, change):
|
||||||
limited = has_limited_access(request.user)
|
limited = has_limited_access(request.user)
|
||||||
if not change and limited:
|
if not change and limited:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue