Remove editable fields for organisation, improve organisation display
This commit is contained in:
parent
43996a75d3
commit
61ffae3899
3 changed files with 36 additions and 10 deletions
|
@ -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('<a href="{0}" target="_blank">{1}</a>',
|
||||
str(instance.url).strip("#"),
|
||||
|
|
|
@ -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)
|
||||
|
|
16
gmba_django/settings/nico.py
Normal file
16
gmba_django/settings/nico.py
Normal file
|
@ -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': '<password>',
|
||||
'HOST': 'localhost',
|
||||
# 'PORT': '<db_port>',
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue