Fix TaxonRange
This commit is contained in:
parent
688adfac42
commit
2e9ebadf29
2 changed files with 10 additions and 2 deletions
10
app/admin.py
10
app/admin.py
|
@ -102,7 +102,15 @@ class SpeciesAdmin(admin.ModelAdmin):
|
|||
|
||||
|
||||
class TaxonRangeAdmin(admin.ModelAdmin):
|
||||
search_fields = ['subrange_or_region', 'distribution', 'source', 'remarks']
|
||||
model = TaxonRange
|
||||
search_fields = ['range__range_name', 'taxon', 'subrange_or_region', 'distribution', 'source', 'remarks']
|
||||
list_display = ['range_name', 'taxon']
|
||||
|
||||
def range_name(self, obj):
|
||||
return str(obj.range.range_name) if obj and obj.range and obj.range.range_name else 'None'
|
||||
|
||||
def taxon(self, obj):
|
||||
return str(obj.taxon) if obj.taxon else 'None'
|
||||
|
||||
|
||||
class RangeNameTranslationAdmin(admin.ModelAdmin):
|
||||
|
|
|
@ -674,7 +674,7 @@ class TaxonRange(models.Model):
|
|||
remarks = models.TextField(blank=True, null=True)
|
||||
|
||||
def __str__(self):
|
||||
return self.range.name
|
||||
return self.taxon if self.taxon else '--'
|
||||
|
||||
|
||||
class PeopleResource(models.Model):
|
||||
|
|
Loading…
Reference in a new issue