Skip to content
Snippets Groups Projects
Commit 42812334 authored by Bryan BRANCOTTE's avatar Bryan BRANCOTTE
Browse files

prevent changing user of an UserPreferences instance

parent cd70b512
No related branches found
No related tags found
No related merge requests found
Pipeline #150727 passed
VERSION = '1.8.6'
\ No newline at end of file
VERSION = '1.8.7'
\ No newline at end of file
......@@ -61,6 +61,11 @@ class UserPreferencesAdmin(admin.ModelAdmin):
else get_user_preference_class()._meta.get_fields()
) if field.many_to_many]
def get_readonly_fields(self, request, obj=None):
if obj:
return self.readonly_fields + ('user',)
return self.readonly_fields
def username(self, obj):
return mark_safe("<i>default preferences</i>") if obj.user is None else obj.user
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment