from django.contrib import admin
from django.contrib.auth import get_user_model
from pint.registry import UnitRegistry

from .models import Activity, Ingredient, Recipe, RecipeIngredient

User = get_user_model()


class RecipeIngredientInline(admin.StackedInline):
    model = RecipeIngredient
    extra = 0


class RecipeAdmin(admin.ModelAdmin):
    inlines = [RecipeIngredientInline]
    list_display = ['name', 'user']
    raw_id_fields = ['user']


class IngredientAdmin(admin.ModelAdmin):
    list_display = ['name','user']


admin.site.register(Recipe, RecipeAdmin)
admin.site.register(Ingredient, IngredientAdmin)
admin.site.register(Activity)
from django.contrib import admin
from django.contrib.auth import get_user_model
from pint.registry import UnitRegistry

from .models import Activity, Ingredient, Recipe, RecipeIngredient

User = get_user_model()


class RecipeIngredientInline(admin.StackedInline):
    model = RecipeIngredient
    extra = 0


class RecipeAdmin(admin.ModelAdmin):
    inlines = [RecipeIngredientInline]
    list_display = ['name', 'user']
    raw_id_fields = ['user']


class IngredientAdmin(admin.ModelAdmin):
    list_display = ['name','user']


admin.site.register(Recipe, RecipeAdmin)
admin.site.register(Ingredient, IngredientAdmin)
admin.site.register(Activity)