Resource: Show inline dependent data
This commit is contained in:
parent
5568764933
commit
a6c7c9e2e7
3 changed files with 60 additions and 27 deletions
28
app/admin.py
28
app/admin.py
|
@ -62,7 +62,24 @@ class PersonAdmin(admin.ModelAdmin):
|
|||
list_display_links = ['id']
|
||||
|
||||
|
||||
class ResourceKeywordInline(admin.TabularInline):
|
||||
model = ResourceKeyword
|
||||
|
||||
|
||||
class ResourceRangeInline(admin.TabularInline):
|
||||
model = ResourceRange
|
||||
|
||||
|
||||
class ResourcePeopleInline(admin.TabularInline):
|
||||
model = ResourcesPeople
|
||||
|
||||
|
||||
class ResourceAdmin(admin.ModelAdmin):
|
||||
inlines = [
|
||||
ResourceKeywordInline,
|
||||
ResourceRangeInline,
|
||||
ResourcePeopleInline
|
||||
]
|
||||
search_fields = ['title', 'url', 'citation', 'abstract']
|
||||
readonly_fields = ['id']
|
||||
list_display = ['title', 'citation', 'type']
|
||||
|
@ -77,16 +94,15 @@ class ResourceAdmin(admin.ModelAdmin):
|
|||
('lat', 'lon'),
|
||||
'doi',
|
||||
'wiki_data_id',
|
||||
'inventory',
|
||||
'abstract'
|
||||
)
|
||||
}),
|
||||
('Boolean fields', {
|
||||
('Research network', {
|
||||
'classes': ('collapse',),
|
||||
'fields': (('gloria', 'gnomo', 'lter', 'ltser', 'miren', 'team', 'inventory'),),
|
||||
}),
|
||||
('Keywords', {
|
||||
'classes': ('collapse',),
|
||||
'fields': (),
|
||||
'fields': (('gloria', 'gnomo', 'lter', 'ltser', 'miren', 'team'),),
|
||||
}),
|
||||
|
||||
('PEGASuS', {
|
||||
'classes': ('collapse',),
|
||||
'fields': (
|
||||
|
|
18
app/migrations/0040_alter_resource_type.py
Normal file
18
app/migrations/0040_alter_resource_type.py
Normal file
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.2.5 on 2021-11-28 13:20
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('app', '0039_auto_20211128_0811'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='resource',
|
||||
name='type',
|
||||
field=models.TextField(blank=True, choices=[('', 'Atlas'), ('Book', 'Book'), ('Book chapter', 'Book chapter'), ('Case study', 'Case study'), ('Conservation project', 'Conservation project'), ('Dataset', 'Dataset'), ('Development project', 'Development project'), ('Journal article', 'Journal article'), ('LTER', 'LTER'), ('Map', 'Map'), ('Network', 'Network'), ('PEGASuS', 'PEGASuS'), ('Presentation', 'Presentation'), ('Report', 'Report'), ('Research project', 'Research project'), ('Research Site', 'Research Site'), ('Thesis', 'Thesis'), ('Video', 'Video'), ('Website', 'Website'), ('Working Group', 'Working Group')], null=True),
|
||||
),
|
||||
]
|
|
@ -162,27 +162,26 @@ class Resource(models.Model):
|
|||
("*****", "*****"),
|
||||
)
|
||||
TYPE_CHOICES = (
|
||||
("" ,"" ),
|
||||
("Atlas" ,"Atlas" ),
|
||||
("Book" ,"Book" ),
|
||||
("Book chapter" ,"Book chapter" ),
|
||||
("Case study" ,"Case study" ),
|
||||
("Conservation project","Conservation project"),
|
||||
("Dataset" ,"Dataset" ),
|
||||
("Development project" ,"Development project" ),
|
||||
("Journal article" ,"Journal article" ),
|
||||
("LTER" ,"LTER" ),
|
||||
("Map" ,"Map" ),
|
||||
("Network" ,"Network" ),
|
||||
("PEGASuS" ,"PEGASuS" ),
|
||||
("Presentation" ,"Presentation" ),
|
||||
("Report" ,"Report" ),
|
||||
("Research project" ,"Research project" ),
|
||||
("Research Site" ,"Research Site" ),
|
||||
("Thesis" ,"Thesis" ),
|
||||
("Video" ,"Video" ),
|
||||
("Website" ,"Website" ),
|
||||
("Working Group" ,"Working Group" ),
|
||||
("", "Atlas"),
|
||||
("Book", "Book"),
|
||||
("Book chapter", "Book chapter"),
|
||||
("Case study", "Case study"),
|
||||
("Conservation project", "Conservation project"),
|
||||
("Dataset", "Dataset"),
|
||||
("Development project", "Development project"),
|
||||
("Journal article", "Journal article"),
|
||||
("LTER", "LTER"),
|
||||
("Map", "Map"),
|
||||
("Network", "Network"),
|
||||
("PEGASuS", "PEGASuS"),
|
||||
("Presentation", "Presentation"),
|
||||
("Report", "Report"),
|
||||
("Research project", "Research project"),
|
||||
("Research Site", "Research Site"),
|
||||
("Thesis", "Thesis"),
|
||||
("Video", "Video"),
|
||||
("Website", "Website"),
|
||||
("Working Group", "Working Group"),
|
||||
)
|
||||
|
||||
id = models.AutoField(primary_key=True)
|
||||
|
|
Loading…
Reference in a new issue