Customizing projects admin
This commit is contained in:
		
							parent
							
								
									d96487c943
								
							
						
					
					
						commit
						92445132fe
					
				
					 1 changed files with 16 additions and 1 deletions
				
			
		| 
						 | 
					@ -3,6 +3,21 @@ from django.contrib import admin
 | 
				
			||||||
from .models import Project, Grant, GrantReport
 | 
					from .models import Project, Grant, GrantReport
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
admin.site.register(Project)
 | 
					class ProjectGrantInline(admin.TabularInline):
 | 
				
			||||||
 | 
					    model = Grant.projects.through
 | 
				
			||||||
 | 
					    extra = 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class ProjectAdmin(admin.ModelAdmin):
 | 
				
			||||||
 | 
					    list_display = ('id', 'name', 'code', 'iacuc_number', 'description', 'sort_order')
 | 
				
			||||||
 | 
					    list_display_links = ('id', 'name')
 | 
				
			||||||
 | 
					    search_fields = ('name', 'code', 'iacuc_number', 'description')
 | 
				
			||||||
 | 
					    list_per_page = 25
 | 
				
			||||||
 | 
					    fields = ('name', 'code', 'iacuc_number', 'description', 'sort_order')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    inlines = [ProjectGrantInline]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					admin.site.register(Project, ProjectAdmin)
 | 
				
			||||||
admin.site.register(Grant)
 | 
					admin.site.register(Grant)
 | 
				
			||||||
admin.site.register(GrantReport)
 | 
					admin.site.register(GrantReport)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue