Compare commits

...

2 commits

2 changed files with 8 additions and 3 deletions

View file

@ -105,6 +105,7 @@ class PersonAdmin(admin.ModelAdmin):
}), }),
) )
list_display = ['id', 'full_name', 'organization'] list_display = ['id', 'full_name', 'organization']
#autocomplete_fields = ['organization'] #autocomplete_fields = ['organization']
form = autocomplete_fields_form # adjust width of autocomplete_fields organization form = autocomplete_fields_form # adjust width of autocomplete_fields organization
@ -112,7 +113,11 @@ class PersonAdmin(admin.ModelAdmin):
ordering = ['full_name'] ordering = ['full_name']
actions = [download_csv] actions = [download_csv]
def get_field_queryset(self, db, db_field, request):
queryset = super().get_field_queryset(db, db_field, request)
if db_field.name == 'organization':
queryset = queryset.order_by('country','organisation_english')
return queryset
class ResourceKeywordInline(admin.TabularInline): class ResourceKeywordInline(admin.TabularInline):
autocomplete_fields = ['keyword'] autocomplete_fields = ['keyword']
model = ResourceKeyword model = ResourceKeyword

View file

@ -426,11 +426,11 @@ class Organisation(models.Model):
if self.organisation_english: if self.organisation_english:
if self.organisation_2: if self.organisation_2:
name = f"{self.organisation_english} ({self.organisation_2})" name = f"{self.organisation_english} ({self.organisation_2})"
name = f"{self.country}-{self.organisation_english}-{self.organisation_2}-{self.organisation_3}-{self.acronym}" name = f"{self.country} < {self.organisation_english} < {self.organisation_2} < {self.organisation_3} < {self.acronym}"
else: else:
name = f"{self.organisation_english}" name = f"{self.organisation_english}"
name = f"{self.country}-{self.organisation_english}-{self.organisation_2}-{self.organisation_3}-{self.acronym}" name = f"{self.country} < {self.organisation_english} < {self.organisation_2} < {self.organisation_3} < {self.acronym}"
else: else: