Beef up admin representation
This commit is contained in:
parent
3ee15528e8
commit
b78d7882d5
7 changed files with 144 additions and 16 deletions
|
@ -9,8 +9,8 @@ class ProjectGrantInline(admin.TabularInline):
|
|||
|
||||
|
||||
class ProjectAdmin(admin.ModelAdmin):
|
||||
list_display = ('id', 'name', 'code', 'iacuc_number', 'description', 'sort_order')
|
||||
list_display_links = ('id', 'name')
|
||||
list_display = ('name', 'code', 'iacuc_number', 'description', 'sort_order')
|
||||
list_display_links = ('name',)
|
||||
search_fields = ('name', 'code', 'iacuc_number', 'description')
|
||||
list_per_page = 25
|
||||
fields = ('name', 'code', 'iacuc_number', 'description', 'sort_order')
|
||||
|
@ -18,6 +18,25 @@ class ProjectAdmin(admin.ModelAdmin):
|
|||
inlines = [ProjectGrantInline]
|
||||
|
||||
|
||||
class GrantAdmin(admin.ModelAdmin):
|
||||
list_display = ('title', 'code', 'description', 'sort_order')
|
||||
list_display_links = ('title',)
|
||||
search_fields = ('title', 'code', 'description', 'description')
|
||||
list_per_page = 25
|
||||
fields = ('title', 'code', 'description', 'projects', 'sort_order')
|
||||
|
||||
|
||||
class GrantReportAdmin(admin.ModelAdmin):
|
||||
list_display = ('title', 'report_type', 'description', 'due_date',
|
||||
'submitted_date', 'attachment', 'sort_order')
|
||||
list_display_links = ('title',)
|
||||
search_fields = ('title', 'report_type', 'description', 'due_date',
|
||||
'submitted_date', 'attachment')
|
||||
list_per_page = 25
|
||||
fields = ('title', 'report_type', 'description', 'due_date',
|
||||
'submitted_date', 'attachment', 'sort_order')
|
||||
|
||||
|
||||
admin.site.register(Project, ProjectAdmin)
|
||||
admin.site.register(Grant)
|
||||
admin.site.register(GrantReport)
|
||||
admin.site.register(Grant, GrantAdmin)
|
||||
admin.site.register(GrantReport, GrantReportAdmin)
|
||||
|
|
|
@ -28,4 +28,8 @@ class Migration(migrations.Migration):
|
|||
'ordering': ['sort_order'],
|
||||
},
|
||||
),
|
||||
migrations.AlterUniqueTogether(
|
||||
name='grantreport',
|
||||
unique_together=set([('grant', 'title', 'due_date')]),
|
||||
),
|
||||
]
|
||||
|
|
|
@ -50,4 +50,5 @@ class GrantReport(models.Model):
|
|||
return self.title
|
||||
|
||||
class Meta:
|
||||
unique_together = ('grant', 'title', 'due_date',)
|
||||
ordering = ['sort_order']
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue