Default owner to logged in user
This commit is contained in:
parent
60852475c7
commit
f8c7b879b1
1 changed files with 5 additions and 0 deletions
|
@ -24,5 +24,10 @@ class RedirectAdmin(admin.ModelAdmin):
|
||||||
f"{opts.app_label}.{codename}", obj
|
f"{opts.app_label}.{codename}", obj
|
||||||
) or self.has_change_permission(request, obj)
|
) or self.has_change_permission(request, obj)
|
||||||
|
|
||||||
|
def get_changeform_initial_data(self, request):
|
||||||
|
get_data = super().get_changeform_initial_data(request)
|
||||||
|
get_data["owner"] = request.user.pk
|
||||||
|
return get_data
|
||||||
|
|
||||||
|
|
||||||
admin.site.register(RedirectUser, UserAdmin)
|
admin.site.register(RedirectUser, UserAdmin)
|
||||||
|
|
Loading…
Reference in a new issue