-
Notifications
You must be signed in to change notification settings - Fork 26
/
admin.py
39 lines (33 loc) · 1.04 KB
/
admin.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
from django.contrib import admin
from budget.models import Budget, BudgetEstimate
class BudgetAdmin(admin.ModelAdmin):
date_hierarchy = 'start_date'
fieldsets = (
(None, {
'fields': ('name', 'slug', 'start_date'),
}),
('Metadata', {
'classes': ('collapse',),
'fields': ('created', 'updated', 'is_deleted')
})
)
list_display = ('name', 'start_date', 'is_deleted')
list_filter = ('is_deleted',)
prepopulated_fields = {
'slug': ('name',),
}
search_fields = ('name',)
class BudgetEstimateAdmin(admin.ModelAdmin):
fieldsets = (
(None, {
'fields': ('budget', 'category', 'amount'),
}),
('Metadata', {
'classes': ('collapse',),
'fields': ('created', 'updated', 'is_deleted')
})
)
list_display = ('category', 'budget', 'amount', 'is_deleted')
list_filter = ('is_deleted',)
admin.site.register(Budget, BudgetAdmin)
admin.site.register(BudgetEstimate, BudgetEstimateAdmin)