# coding=utf-8
from django.contrib import admin
from django.contrib.auth.admin import UserAdmin
from django.contrib.auth.models import User

# 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)


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, ]


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)
