generated from 2martens/django-template
Added all models to Admin
This commit is contained in:
parent
5823abeee6
commit
780155c241
|
@ -3,9 +3,17 @@ from django.contrib import admin
|
|||
from django.contrib.auth.admin import UserAdmin
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
from food_planner.models import Profile
|
||||
|
||||
# Register your models here.
|
||||
from food_planner.models import Ingredient
|
||||
from food_planner.models import Pantry
|
||||
from food_planner.models import Product
|
||||
from food_planner.models import Profile
|
||||
from food_planner.models import Recipe
|
||||
from food_planner.models import RecipeStep
|
||||
from food_planner.models import StoredIngredient
|
||||
from food_planner.models import UsedIngredient
|
||||
from food_planner.models import Vendor
|
||||
|
||||
admin.site.unregister(User)
|
||||
|
||||
|
||||
|
@ -13,9 +21,33 @@ class ProfileInline(admin.StackedInline):
|
|||
model = Profile
|
||||
|
||||
|
||||
class RecipeStepsInline(admin.StackedInline):
|
||||
model = RecipeStep
|
||||
|
||||
|
||||
class IngredientsInline(admin.StackedInline):
|
||||
model = UsedIngredient
|
||||
|
||||
|
||||
class StoredIngredientsInline(admin.StackedInline):
|
||||
model = StoredIngredient
|
||||
|
||||
|
||||
class UserProfileAdmin(UserAdmin):
|
||||
inlines = [ProfileInline, ]
|
||||
|
||||
|
||||
admin.site.register(User, UserProfileAdmin)
|
||||
class RecipeAdmin(admin.ModelAdmin):
|
||||
inlines = [IngredientsInline, RecipeStepsInline, ]
|
||||
|
||||
|
||||
class PantryAdmin(admin.ModelAdmin):
|
||||
inlines = [StoredIngredientsInline, ]
|
||||
|
||||
|
||||
admin.site.register(User, UserProfileAdmin)
|
||||
admin.site.register(Recipe, RecipeAdmin)
|
||||
admin.site.register(Ingredient)
|
||||
admin.site.register(Vendor)
|
||||
admin.site.register(Pantry, PantryAdmin)
|
||||
admin.site.register(Product)
|
||||
|
|
Loading…
Reference in New Issue