Skip to content

Commit

Permalink
Improve the usability of the admin UI
Browse files Browse the repository at this point in the history
  • Loading branch information
msom committed Nov 26, 2024
1 parent c619fd2 commit c5bc306
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 3 deletions.
5 changes: 3 additions & 2 deletions app/access/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
@admin.register(User)
class UserAdmin(admin.ModelAdmin): # type:ignore[type-arg]
'''Admin View for User'''
list_display = ('provider', 'username', 'deleted_at')
actions = ["disable"]
list_display = ('username', 'deleted_at', 'provider')
list_filter = ('deleted_at', ('provider', admin.RelatedOnlyFieldListFilter))
actions = ('disable',)

@admin.action(description="Disable selected users")
def disable(self, request: HttpRequest, queryset: models.QuerySet[User]) -> None:
Expand Down
6 changes: 6 additions & 0 deletions app/distributions/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,13 @@
class AttributionAdmin(admin.ModelAdmin): # type:ignore[type-arg]
'''Admin View for Attribution'''

list_display = ('name_en', 'provider')
list_filter = (('provider', admin.RelatedOnlyFieldListFilter),)


@admin.register(Dataset)
class DatasetAdmin(admin.ModelAdmin): # type:ignore[type-arg]
'''Admin View for Dataset'''

list_display = ('slug', 'provider')
list_filter = (('provider', admin.RelatedOnlyFieldListFilter),)
2 changes: 2 additions & 0 deletions app/provider/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
@admin.register(Provider)
class ProviderAdmin(admin.ModelAdmin): # type:ignore[type-arg]
'''Admin View for Provider'''

list_display = ('acronym_en', 'name_en')
2 changes: 1 addition & 1 deletion app/provider/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ class Provider(models.Model):
_context = "Provider model"

def __str__(self) -> str:
return str(self.name_en)
return str(self.acronym_en)

'''
Note: The "blank=False" for a model field doesn't prevent DB changes.
Expand Down

0 comments on commit c5bc306

Please sign in to comment.