diff --git a/app/admin.py b/app/admin.py index f1d5bc4..25ec099 100644 --- a/app/admin.py +++ b/app/admin.py @@ -58,9 +58,8 @@ class PersonAdmin(admin.ModelAdmin): ), }), ) - list_display = ['id', 'full_name', 'country', 'organization'] - list_editable = ['full_name', 'country', 'organization'] - list_display_links = ['id'] + list_display = ['id', 'full_name' ] +# list_display_links = ['id'] class ResourceKeywordInline(admin.TabularInline): @@ -178,7 +177,7 @@ class OrganizationAdmin(admin.ModelAdmin): ] readonly_fields = ('org_num1',) search_fields = ['organisation_search', 'org_alpha_search', 'organisation_2', 'organisation_3', 'subject'] - list_display = ['organisation_english', 'country', 'city'] + list_display = ['organisation_english', 'organisation_2'] fieldsets = ( (None, { 'fields': ( @@ -205,6 +204,8 @@ class OrganizationAdmin(admin.ModelAdmin): }) ) + ordering = [ 'organisation_english' ] + def org_url(self, instance): return format_html('{1}', str(instance.url).strip("#"), diff --git a/app/models.py b/app/models.py index 5c0c0ac..c5a1720 100644 --- a/app/models.py +++ b/app/models.py @@ -278,7 +278,7 @@ class GMBA_SpeciesGroup(models.Model): class PeopleStatus(models.Model): id = models.AutoField(primary_key=True) status = models.TextField(blank=True, null=True) - + def __str__(self): return self.status @@ -422,7 +422,16 @@ class Organisation(models.Model): subject = models.CharField(max_length=128, blank=True, null=True, choices=SUBJECT_CHOICES) def __str__(self): - return self.organisation_english if self.organisation_english else '' + if self.organisation_english: + if self.organisation_2: + name = f"{self.organisation_english} ({self.organisation_2})" + else: + name = f"{self.organisation_english}" + else: + name = 'NO NAME DEFINED!!!' + + return name + class RangeOnlineInfo(models.Model): @@ -455,7 +464,7 @@ class AddElevation(models.Model): elev_min = models.TextField(blank=True, null=True) elev_max = models.TextField(blank=True, null=True) elev_range = models.TextField(blank=True, null=True) - + def __str__(self): return '%s - %s' % (self.gmba_v2_id, self.elev_range) @@ -488,10 +497,10 @@ class Keyword(models.Model): mother = models.ForeignKey("self", models.DO_NOTHING, blank=True, null=True, to_field='keyword_id', related_name='mother_keyword') keyword = models.TextField(blank=True, null=True) - + def __str__(self): return '%s > %s' % (self.mother, self.keyword) if self.mother.keyword != '->' else self.keyword - + class ResourceKeyword(models.Model): id = models.AutoField(primary_key=True) @@ -728,7 +737,7 @@ class ScalesPeople(models.Model): def __str__(self): return self.person.full_name - + class Species(models.Model): id = models.AutoField(primary_key=True) diff --git a/gmba_django/settings/nico.py b/gmba_django/settings/nico.py new file mode 100644 index 0000000..a74c6e4 --- /dev/null +++ b/gmba_django/settings/nico.py @@ -0,0 +1,16 @@ +from .base import * + +DEBUG = True + +ALLOWED_HOSTS = os.environ.get('ALLOWED_HOSTS', "").split(",") + +DATABASES = { + 'default': { + 'ENGINE': 'django.db.backends.postgresql_psycopg2', + 'NAME': 'gmba', + 'USER': 'nico', +# 'PASSWORD': '', + 'HOST': 'localhost', +# 'PORT': '', + } +}