summaryrefslogtreecommitdiff
path: root/recipe/admin.py
diff options
context:
space:
mode:
authorMike Crute <mcrute@gmail.com>2013-04-20 11:58:17 -0400
committerMike Crute <mcrute@gmail.com>2013-04-20 11:58:17 -0400
commit3a8a5dd687e44f4adb9750decd290d36cf9a1772 (patch)
tree1e5178a10a27e2585d9db1e82f598d5891d2600a /recipe/admin.py
parent0ce0ee1ef411b3300030cc13a2052e31850fa475 (diff)
downloadgreenbox-3a8a5dd687e44f4adb9750decd290d36cf9a1772.tar.bz2
greenbox-3a8a5dd687e44f4adb9750decd290d36cf9a1772.tar.xz
greenbox-3a8a5dd687e44f4adb9750decd290d36cf9a1772.zip
Split out admin stuff
Diffstat (limited to 'recipe/admin.py')
-rw-r--r--recipe/admin.py33
1 files changed, 33 insertions, 0 deletions
diff --git a/recipe/admin.py b/recipe/admin.py
new file mode 100644
index 0000000..12bf0fa
--- /dev/null
+++ b/recipe/admin.py
@@ -0,0 +1,33 @@
1from django.contrib import admin
2from recipe.models import Unit, Ingredient, Recipe, RecipeIngredient
3
4
5class UnitAdmin(admin.ModelAdmin):
6
7 list_display = ('name', 'abbreviation')
8 ordering = ('name',)
9
10
11class IngredientInline(admin.TabularInline):
12
13 model = RecipeIngredient
14 extra = 12
15
16
17class RecipeAdmin(admin.ModelAdmin):
18
19 list_display = ('title',)
20 inlines = (IngredientInline,)
21 search_fields = ('title',)
22 prepopulated_fields = { "slug": ("title",) }
23
24
25class IngredientAdmin(admin.ModelAdmin):
26
27 list_display = ('name',)
28 search_fields = ('name',)
29
30
31admin.site.register(Unit, UnitAdmin)
32admin.site.register(Ingredient, IngredientAdmin)
33admin.site.register(Recipe, RecipeAdmin)