Skip to content
Snippets Groups Projects
Commit 65d43815 authored by Tore.Brede's avatar Tore.Brede
Browse files

GREG-247: Make the org unit list sorted alphabetically in the admin interface

parent cc646fec
No related branches found
No related tags found
1 merge request!318GREG-247: Make the org unit list sorted alphabetically in the admin interface
Pipeline #129523 failed
...@@ -123,10 +123,13 @@ class IdentifierAdmin(VersionAdmin): ...@@ -123,10 +123,13 @@ class IdentifierAdmin(VersionAdmin):
class OrganizationalUnitAdmin(VersionAdmin): class OrganizationalUnitAdmin(VersionAdmin):
list_display = ("id", "name_en", "parent") list_display = ("id", "name_en", "name_nb", "parent")
readonly_fields = ("id", "created", "updated") readonly_fields = ("id", "created", "updated")
search_fields = ("name_en", "id") search_fields = ("name_en", "name_nb", "id")
inlines = (OuIdentifierInline,) inlines = (OuIdentifierInline,)
# This is mainly to make the org unit list be sorted in the drop-down box
# in the role line under persons
ordering = ('name_nb',)
class OrganizationalUnitInline(admin.TabularInline): class OrganizationalUnitInline(admin.TabularInline):
......
...@@ -521,7 +521,7 @@ class OrganizationalUnit(BaseModel): ...@@ -521,7 +521,7 @@ class OrganizationalUnit(BaseModel):
) )
def __str__(self) -> str: def __str__(self) -> str:
return f"{self.name_en or self.name_nb}" return f"{self.name_nb} ({self.name_en})"
def fetch_tree(self): def fetch_tree(self):
""" """
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment