28 lines
959 B
Python
28 lines
959 B
Python
from django.contrib import admin
|
|
|
|
from .models import FoodFavourite, FoodLogEntry, FoodPortion, FoodProduct
|
|
|
|
|
|
@admin.register(FoodProduct)
|
|
class FoodProductAdmin(admin.ModelAdmin):
|
|
list_display = ('product_name', 'brand', 'barcode', 'source', 'owner', 'fetched_at')
|
|
list_filter = ('source', 'fetched_at')
|
|
search_fields = ('product_name', 'brand', 'barcode')
|
|
|
|
|
|
@admin.register(FoodLogEntry)
|
|
class FoodLogEntryAdmin(admin.ModelAdmin):
|
|
list_display = ('date', 'user', 'meal', 'product_name_snapshot', 'amount', 'unit', 'calories_kcal')
|
|
list_filter = ('date', 'meal', 'user')
|
|
search_fields = ('product_name_snapshot', 'brand_snapshot', 'barcode_snapshot')
|
|
|
|
|
|
@admin.register(FoodFavourite)
|
|
class FoodFavouriteAdmin(admin.ModelAdmin):
|
|
list_display = ('user', 'product', 'created_at')
|
|
|
|
|
|
@admin.register(FoodPortion)
|
|
class FoodPortionAdmin(admin.ModelAdmin):
|
|
list_display = ('user', 'product', 'label', 'amount', 'unit', 'is_default')
|