from django.contrib import admin
from models import *

class OtherIngredientInline(admin.StackedInline):
    model = OtherIngredient
    extra = 5

class AlternativeNameInline(admin.StackedInline):
    model = AlternativeName
    extra = 3

class TokriImageInline(admin.StackedInline):
    model = TokriImage
    extra = 3

class VegetableLinkInline(admin.StackedInline):
    model = VegetableLink
    extra = 2

class RecipeTokriInline(admin.TabularInline):
    model = Recipe.tokri_ingredients.through

class RecipeAdmin(admin.ModelAdmin):
    inlines = [RecipeTokriInline, OtherIngredientInline]
    prepopulated_fields = {'slug': ('title',)}    

class TokriAdmin(admin.ModelAdmin):
    inlines = [AlternativeNameInline, TokriImageInline, VegetableLinkInline]
    prepopulated_fields = {'slug': ('name',)}    

admin.site.register(Recipe, RecipeAdmin)
admin.site.register(TokriVegetable, TokriAdmin)
admin.site.register(Season)
admin.site.register(Language)
admin.site.register(VegetableType)


'''
#class NicknameInline(admin.StackedInline):
#  model = Nickname
#  extra = 3

#class LinkInlineModelAdmin(admin.InlineModelAdmin):
#  pass

#class LinkInline(LinkInlineModelAdmin):
#  model = Link
#  extra = 3

class ProfileInline(admin.StackedInline):
  model = Person
  extra = 1

class PerformanceAdmin(admin.ModelAdmin):
  filter_horizontal = ('links', 'images')

class EventAdmin(admin.ModelAdmin):
  filter_horizontal = ('links',)

class ProfileAdmin(admin.ModelAdmin):
  filter_horizontal = ('links', 'files', 'images',)
#  inlines = [NicknameInline]
#  inlines = [LinkInline]

class VenueAdmin(admin.ModelAdmin):
  ordering = ('name',)
  prepopulated_fields = {'slug': ('name',)} 
  filter_horizontal = ('links', 'images')
  
class TheatreGroupAdmin(admin.ModelAdmin):
  prepopulated_fields = {'slug': ('name',)} 
  filter_horizontal = ('links', 'files', 'images')

class ProductionAdmin(admin.ModelAdmin):
  prepopulated_fields = {'slug': ('title',)} 
  filter_horizontal = ('links', 'files', 'images',)
  inlines = [ProfileInline]

class ScriptAdmin(admin.ModelAdmin):
  filter_horizontal = ('links', 'downloads')


#admin.site.register(Nickname3)
#admin.site.register(Nickname2)
admin.site.register(Performance, PerformanceAdmin) 
admin.site.register(Event, EventAdmin) 
admin.site.register(Location) 
admin.site.register(ProfileProfile) 
admin.site.register(ProfileGroup) 
admin.site.register(Script, ScriptAdmin) 
admin.site.register(Production, ProductionAdmin)
admin.site.register(Image)
admin.site.register(File)
admin.site.register(Link)
admin.site.register(RandomQuote)
admin.site.register(ProfileProduction)
admin.site.register(Nickname)
admin.site.register(TheatreGroup, TheatreGroupAdmin) 
admin.site.register(Venue, VenueAdmin) 
admin.site.register(Profile, ProfileAdmin) 
'''
