- Remove user ForeignKey from all 7 models (single-user app) - Update all views, handlers, forms, admin, API, seed, and tests - Add MonthlyGoal model with goals and promises sections - Goals/promises: add, toggle (strikethrough), delete via LiveView
28 lines
659 B
Python
28 lines
659 B
Python
from django.contrib import admin
|
|
|
|
from .models import Category, Expense, Subcategory
|
|
|
|
|
|
class SubcategoryInline(admin.TabularInline):
|
|
model = Subcategory
|
|
extra = 1
|
|
|
|
|
|
@admin.register(Category)
|
|
class CategoryAdmin(admin.ModelAdmin):
|
|
list_display = ["name", "order"]
|
|
inlines = [SubcategoryInline]
|
|
|
|
|
|
@admin.register(Subcategory)
|
|
class SubcategoryAdmin(admin.ModelAdmin):
|
|
list_display = ["name", "category", "order"]
|
|
list_filter = ["category"]
|
|
|
|
|
|
@admin.register(Expense)
|
|
class ExpenseAdmin(admin.ModelAdmin):
|
|
list_display = ["concept", "amount", "category", "subcategory", "created_at"]
|
|
list_filter = ["category", "created_at"]
|
|
search_fields = ["concept"]
|