Organisation: Make things as described in #9945

This commit is contained in:
PCoder 2021-11-28 20:29:44 +05:30
parent e71c225177
commit e238c5fed3
3 changed files with 127 additions and 15 deletions

View file

@ -160,8 +160,15 @@ class RangeAdmin(admin.ModelAdmin):
list_display = ['range_name', 'countries', 'mother_range']
class PeopleOrganizationInline(admin.TabularInline):
model = Person
class OrganizationAdmin(admin.ModelAdmin):
readonly_fields = ('org_num1', 'org_url')
inlines = [
PeopleOrganizationInline,
]
readonly_fields = ('org_num1',)
search_fields = ['organisation_search', 'org_alpha_search', 'organisation_2', 'organisation_3', 'subject']
list_display = ['organisation_english', 'country', 'city']
fieldsets = (
@ -184,7 +191,6 @@ class OrganizationAdmin(admin.ModelAdmin):
'classes': ('collapse',),
'fields': (('tel', 'email'),
'url',
'org_url',
'tags',
),
})

View file

@ -0,0 +1,78 @@
# Generated by Django 3.2.5 on 2021-11-28 14:58
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('app', '0042_rename_organization_organisation'),
]
operations = [
migrations.AlterField(
model_name='organisation',
name='acronym',
field=models.CharField(blank=True, max_length=128, null=True),
),
migrations.AlterField(
model_name='organisation',
name='city',
field=models.CharField(blank=True, max_length=64, null=True),
),
migrations.AlterField(
model_name='organisation',
name='email',
field=models.EmailField(blank=True, max_length=254, null=True),
),
migrations.AlterField(
model_name='organisation',
name='lat_long',
field=models.CharField(blank=True, max_length=128, null=True),
),
migrations.AlterField(
model_name='organisation',
name='organisation_2',
field=models.CharField(blank=True, max_length=256, null=True),
),
migrations.AlterField(
model_name='organisation',
name='organisation_3',
field=models.CharField(blank=True, max_length=256, null=True),
),
migrations.AlterField(
model_name='organisation',
name='organisation_english',
field=models.CharField(blank=True, max_length=256, null=True),
),
migrations.AlterField(
model_name='organisation',
name='po_box',
field=models.CharField(blank=True, max_length=128, null=True),
),
migrations.AlterField(
model_name='organisation',
name='postcode',
field=models.CharField(blank=True, max_length=64, null=True),
),
migrations.AlterField(
model_name='organisation',
name='street',
field=models.CharField(blank=True, max_length=256, null=True),
),
migrations.AlterField(
model_name='organisation',
name='subject',
field=models.CharField(blank=True, choices=[('Other', 'Other'), ('Environment', 'Environment'), ('Ecology', 'Ecology'), ('Agriculture', 'Agriculture'), ('Botany', 'Botany'), ('Science and technology', 'Science and technology'), ('Biodiversity', 'Biodiversity'), ('Climate / Global Change', 'Climate / Global Change'), ('Mountains', 'Mountains'), ('Biology', 'Biology'), ('Forestry', 'Forestry'), ('Conservation', 'Conservation'), ('Culture / arts', 'Culture / arts'), ('Geography', 'Geography'), ('Zoology', 'Zoology'), ('Development / poverty / human rights', 'Development / poverty / human rights'), ('Social Sciences', 'Social Sciences'), ('Earth Sciences', 'Earth Sciences'), ('Health', 'Health'), ('Hydrology / Water', 'Hydrology / Water'), ('Sustainability', 'Sustainability'), ('Economy / finance', 'Economy / finance'), ('Natural Resources', 'Natural Resources'), ('Education', 'Education'), ('Architecture, planning & design', 'Architecture, planning & design'), ('', '')], max_length=128, null=True),
),
migrations.AlterField(
model_name='organisation',
name='tel',
field=models.CharField(blank=True, max_length=128, null=True),
),
migrations.AlterField(
model_name='organisation',
name='url',
field=models.URLField(blank=True, null=True),
),
]

View file

@ -366,31 +366,59 @@ class Organisation(models.Model):
('Education > Graduate', 'Education > Graduate'),
('Collection > Botanical Garden', 'Collection > Botanical Garden'),
('Other', 'Other'),)
SUBJECT_CHOICES = (
('Other', 'Other'),
('Environment', 'Environment'),
('Ecology', 'Ecology'),
('Agriculture', 'Agriculture'),
('Botany', 'Botany'),
('Science and technology', 'Science and technology'),
('Biodiversity', 'Biodiversity'),
('Climate / Global Change', 'Climate / Global Change'),
('Mountains', 'Mountains'),
('Biology', 'Biology'),
('Forestry', 'Forestry'),
('Conservation', 'Conservation'),
('Culture / arts', 'Culture / arts'),
('Geography', 'Geography'),
('Zoology', 'Zoology'),
('Development / poverty / human rights', 'Development / poverty / human rights'),
('Social Sciences', 'Social Sciences'),
('Earth Sciences', 'Earth Sciences'),
('Health', 'Health'),
('Hydrology / Water', 'Hydrology / Water'),
('Sustainability', 'Sustainability'),
('Economy / finance', 'Economy / finance'),
('Natural Resources', 'Natural Resources'),
('Education', 'Education'),
('Architecture, planning & design', 'Architecture, planning & design'),
('', ''),
)
org_num1 = models.AutoField(primary_key=True)
organisation_search = models.TextField(blank=True, null=True)
org_alpha_search = models.TextField(blank=True, null=True)
organisation_english = models.TextField(blank=True, null=True)
organisation_2 = models.TextField(blank=True, null=True)
organisation_3 = models.TextField(blank=True, null=True)
organisation_english = models.CharField(max_length=256, blank=True, null=True)
organisation_2 = models.CharField(max_length=256, blank=True, null=True)
organisation_3 = models.CharField(max_length=256, blank=True, null=True)
organisation_original = models.TextField(blank=True, null=True)
acronym = models.TextField(blank=True, null=True)
street = models.TextField(blank=True, null=True)
po_box = models.TextField(blank=True, null=True)
postcode = models.TextField(blank=True, null=True)
city = models.TextField(blank=True, null=True)
acronym = models.CharField(max_length=128, blank=True, null=True)
street = models.CharField(max_length=256, blank=True, null=True)
po_box = models.CharField(max_length=128, blank=True, null=True)
postcode = models.CharField(max_length=64, blank=True, null=True)
city = models.CharField(max_length=64, blank=True, null=True)
region = models.TextField(blank=True, null=True)
search_url = models.TextField(blank=True, null=True)
lat_long = models.TextField(blank=True, null=True)
url = models.TextField(blank=True, null=True)
tel = models.TextField(blank=True, null=True)
email = models.TextField(blank=True, null=True)
lat_long = models.CharField(max_length=128, blank=True, null=True)
url = models.URLField(blank=True, null=True)
tel = models.CharField(max_length=128, blank=True, null=True)
email = models.EmailField(blank=True, null=True)
country = models.ForeignKey(Country, models.DO_NOTHING, blank=True, null=True, to_field='id')
tags = models.TextField(blank=True, null=True)
description = models.TextField(blank=True, null=True)
northing = models.TextField(blank=True, null=True)
easting = models.TextField(blank=True, null=True)
category = models.TextField(blank=True, null=True, choices=CATEGORY_CHOICES)
subject = models.TextField(blank=True, null=True)
subject = models.CharField(max_length=128, blank=True, null=True, choices=SUBJECT_CHOICES)
def __str__(self):
return self.organisation_english