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

GREG-214: Adding acronyms as well to dropdown for untis

parent bb8aceea
No related branches found
No related tags found
1 merge request!284GREG-214: Switching to showing orgreg ID in dropdown for units
Pipeline #116276 failed
......@@ -6,6 +6,7 @@ type OuData = {
nb: string
en: string
orgreg_id?: string
acronym_nob?: string
}
function useOus(): OuData[] | undefined {
......
......@@ -243,7 +243,8 @@ const StepPersonForm = forwardRef(
.sort(i18n.language === 'en' ? enSort : nbSort)
.map((ou) => (
<MenuItem key={ou.id.toString()} value={ou.id}>
{getOuName(ou)} ({ou.orgreg_id ?? ''})
{getOuName(ou)} ({ou.acronym_nob ?? ''}) (
{ou.orgreg_id ?? ''})
</MenuItem>
))}
</TextField>
......
......@@ -29,4 +29,4 @@ class SponsorOrgUnitsSerializer(ModelSerializer):
class Meta:
model = OrganizationalUnit
fields = ["id", "nb", "en", "orgreg_id"]
fields = ["id", "nb", "en", "orgreg_id", "acronym_nob"]
......@@ -482,6 +482,15 @@ class OrganizationalUnit(BaseModel):
.first()
)
@property
def acronym_nob(self) -> Optional[str]:
"""Gets the Norwegian bokmaal acronym if it exists"""
return (
self.identifiers.filter(name="acronym_nob")
.values_list("value", flat=True)
.first()
)
def __repr__(self) -> str:
return "{}(id={!r}, name_en={!r}, parent={!r})".format(
self.__class__.__name__, self.pk, self.name_en, self.parent
......
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