cookbook/recipes/admin.py

15 lines
370 B
Python

from django.contrib import admin
from .models import Recipe, Ingredient, IngredientUsage
class IngredientUsageInline(admin.TabularInline):
model = IngredientUsage
extra = 1
class RecipeAdmin(admin.ModelAdmin):
inlines = (IngredientUsageInline,)
fields = [ 'name', 'protocol' ]
admin.site.register(Recipe,RecipeAdmin)
admin.site.register(Ingredient)