Myoldmopar/Cait.Rocks

View on GitHub
recipes/admin.py

Summary

Maintainability
A
0 mins
Test Coverage
# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django.contrib import admin

from recipes.models.ingredient import Ingredient
from recipes.models.planning import Calendar
from recipes.models.recipe import Recipe


admin.site.register(Ingredient)


class CalendarAdmin(admin.ModelAdmin):
    model = Calendar
    list_display = ('nickname', 'creator')


admin.site.register(Calendar, CalendarAdmin)


class IngredientInline(admin.TabularInline):
    model = Ingredient
    extra = 0


class RecipeAdmin(admin.ModelAdmin):
    model = Recipe
    inlines = [IngredientInline]
    list_display = ('title', 'recipe_type', 'creator', 'created_date', 'modified_date')
    search_fields = ('title',)


admin.site.register(Recipe, RecipeAdmin)