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']
|
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):
|
class ResourceAdmin(admin.ModelAdmin):
|
||||||
|
inlines = [
|
||||||
|
ResourceKeywordInline,
|
||||||
|
ResourceRangeInline,
|
||||||
|
ResourcePeopleInline
|
||||||
|
]
|
||||||
search_fields = ['title', 'url', 'citation', 'abstract']
|
search_fields = ['title', 'url', 'citation', 'abstract']
|
||||||
readonly_fields = ['id']
|
readonly_fields = ['id']
|
||||||
list_display = ['title', 'citation', 'type']
|
list_display = ['title', 'citation', 'type']
|
||||||
|
@ -77,16 +94,15 @@ class ResourceAdmin(admin.ModelAdmin):
|
||||||
('lat', 'lon'),
|
('lat', 'lon'),
|
||||||
'doi',
|
'doi',
|
||||||
'wiki_data_id',
|
'wiki_data_id',
|
||||||
|
'inventory',
|
||||||
|
'abstract'
|
||||||
)
|
)
|
||||||
}),
|
}),
|
||||||
('Boolean fields', {
|
('Research network', {
|
||||||
'classes': ('collapse',),
|
'classes': ('collapse',),
|
||||||
'fields': (('gloria', 'gnomo', 'lter', 'ltser', 'miren', 'team', 'inventory'),),
|
'fields': (('gloria', 'gnomo', 'lter', 'ltser', 'miren', 'team'),),
|
||||||
}),
|
|
||||||
('Keywords', {
|
|
||||||
'classes': ('collapse',),
|
|
||||||
'fields': (),
|
|
||||||
}),
|
}),
|
||||||
|
|
||||||
('PEGASuS', {
|
('PEGASuS', {
|
||||||
'classes': ('collapse',),
|
'classes': ('collapse',),
|
||||||
'fields': (
|
'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,8 +162,7 @@ class Resource(models.Model):
|
||||||
("*****", "*****"),
|
("*****", "*****"),
|
||||||
)
|
)
|
||||||
TYPE_CHOICES = (
|
TYPE_CHOICES = (
|
||||||
("" ,"" ),
|
("", "Atlas"),
|
||||||
("Atlas" ,"Atlas" ),
|
|
||||||
("Book", "Book"),
|
("Book", "Book"),
|
||||||
("Book chapter", "Book chapter"),
|
("Book chapter", "Book chapter"),
|
||||||
("Case study", "Case study"),
|
("Case study", "Case study"),
|
||||||
|
|
Loading…
Reference in a new issue