kopia lustrzana https://github.com/OpenDroneMap/WebODM
Hide quota field when adding new users
rodzic
9ee1474df7
commit
b9868baa3d
10
app/admin.py
10
app/admin.py
|
@ -268,9 +268,19 @@ class ProfileInline(admin.StackedInline):
|
|||
model = Profile
|
||||
can_delete = False
|
||||
|
||||
# Hide "quota" profile field when adding (show during editing)
|
||||
def get_fields(self, request, obj=None):
|
||||
if obj is None:
|
||||
fields = list(super().get_fields(request, obj))
|
||||
fields.remove('quota')
|
||||
return fields
|
||||
else:
|
||||
return super().get_fields(request, obj)
|
||||
|
||||
class UserAdmin(BaseUserAdmin):
|
||||
inlines = [ProfileInline]
|
||||
|
||||
|
||||
# Re-register UserAdmin
|
||||
admin.site.unregister(User)
|
||||
admin.site.register(User, UserAdmin)
|
||||
|
|
Ładowanie…
Reference in New Issue