#-*- coding:utf-8 -*-

from django.contrib import admin
from models import *

class LemmaAdmin(admin.ModelAdmin):    
    filter_horizontal = ('old_frames', 'frames',)
    search_fields  = ('entry',)
    list_filter    = ('old', 'vocabulary',)
    exclude = ('old_versions', 'frames', 'old_frames', 'skladnica_frames',
               'B_frames', 'nkjp_examples', 'frame_opinions', 'lemma_nkjp_examples',
               'status_history')
    
class ChangeAdmin(admin.ModelAdmin):
    search_fields  = ('entry__entry',)
    
class FrameAdmin(admin.ModelAdmin):    
    filter_horizontal = ('positions',)
    search_fields  = ('text_rep',)
    
class PositionAdmin(admin.ModelAdmin):    
    filter_horizontal = ('arguments',)
    search_fields  = ('text_rep',)
    
class ArgumentAdmin(admin.ModelAdmin):    
    filter_horizontal = ('atributes',)
    search_fields  = ('text_rep',)
    
class NKJP_ArgSelectionAdmin(admin.ModelAdmin):
    filter_horizontal = ('arguments',)
    
class NKJP_ExampleAdmin(admin.ModelAdmin):
    filter_horizontal = ('arguments',)
    list_filter    = ('source', 'opinion',)
    search_fields  = ('sentence', 'comment',)
    
class StatusChangeAdmin(admin.ModelAdmin):    
    search_fields  = ('lemma__entry',)
    list_filter    = ('status__status',)
    
class Old_FrameAdmin(admin.ModelAdmin):    
    ordering = ('old_frame_value',)
    search_fields    = ('sent_id',)
    
class Skladnica_ArgumentAdmin(admin.ModelAdmin):    
    ordering = ('text_id',)
    search_fields  = ('text_id',)
    
class Atribute_ValueAdmin(admin.ModelAdmin):    
    search_fields  = ('parameter__type__name', 'parameter__subparameters__name', 
                      'text', 'argument__text_rep', 'position__text_rep',)
    list_filter    = ('type',)
    
class AtributeAdmin(admin.ModelAdmin):
    search_fields  = ('values__text', 'values__parameter__type__name', 
                      'values__parameter__subparameters__name', 'values__argument__text_rep', 
                      'values__position__text_rep', 'type')
    
class Arg_PossibilityAdmin(admin.ModelAdmin):    
    ordering = ('position_category__category', 'argument__text_rep',)
    
class AspectRelationsGroupAdmin(admin.ModelAdmin):    
    search_fields  = ('members__name',)
    
class EntryAdmin(admin.ModelAdmin):    
    search_fields  = ('name', 'pos__tag',)
    list_filter    = ('pos__tag',)
    
class Frame_OpinionAdmin(admin.ModelAdmin):
    search_fields  = ('frame__text_rep', 'value__value',)
    
class B_FrameAdmin(admin.ModelAdmin):
    search_fields  = ('text_rep',)
    
class B_ArgumentAdmin(admin.ModelAdmin):
    search_fields  = ('text_rep',)

class XcpExampleAdmin(admin.ModelAdmin):
    search_fields  = ('arg_regex',)
    
class AttributeParameterModelAdmin(admin.ModelAdmin):
    search_fields  = ('name',)
    
class AttributeParameterAdmin(admin.ModelAdmin):
    search_fields  = ('type__name', 'subparameters__name',)
    
class AttributeSubparameterAdmin(admin.ModelAdmin):
    search_fields  = ('name',)
    
class MorfeuszExceptionAdmin(admin.ModelAdmin):
    search_fields  = ('orth',)
    
class InterpretationAdmin(admin.ModelAdmin):
    search_fields  = ('base',)

class Atribute_ModelAdmin(admin.ModelAdmin):
    filter_horizontal = ('possible_parameters',)
    save_as = True
    
#class ArgRealizationAdmin(admin.ModelAdmin):
#    list_filter = ('type',)

admin.site.register(Vocabulary)
admin.site.register(Lemma, LemmaAdmin)
admin.site.register(Lemma_Status)
admin.site.register(LemmaStatusType)
admin.site.register(StageOfWork)
admin.site.register(Frame, FrameAdmin)
admin.site.register(NKJP_Example, NKJP_ExampleAdmin)
admin.site.register(Position, PositionAdmin)
admin.site.register(PositionCategory)
admin.site.register(Argument, ArgumentAdmin)
admin.site.register(Argument_Model)    
admin.site.register(Atribute_Value, Atribute_ValueAdmin)
admin.site.register(Atribute_Model, Atribute_ModelAdmin)
admin.site.register(Atribute, AtributeAdmin)   
admin.site.register(Frame_Characteristic)
admin.site.register(Frame_Char_Model)
admin.site.register(Frame_Char_Value)
admin.site.register(Message)
admin.site.register(Change, ChangeAdmin)
admin.site.register(NKJP_ArgSelection, NKJP_ArgSelectionAdmin)
admin.site.register(NKJP_Source)
admin.site.register(NKJP_Opinion)
admin.site.register(Configuration)
admin.site.register(VocabularyFormat)
admin.site.register(Frame_Opinion, Frame_OpinionAdmin)
admin.site.register(Frame_Opinion_Value)
admin.site.register(StatusChange, StatusChangeAdmin)
admin.site.register(Old_Frame, Old_FrameAdmin)   
admin.site.register(Skladnica_Argument, Skladnica_ArgumentAdmin)
admin.site.register(Arg_Possibility, Arg_PossibilityAdmin)
admin.site.register(Entry, EntryAdmin)
admin.site.register(AspectRelationsGroup, AspectRelationsGroupAdmin)
admin.site.register(B_Frame, B_FrameAdmin)
admin.site.register(B_Argument, B_ArgumentAdmin)
admin.site.register(ArgRealization)
admin.site.register(RealizationType)
admin.site.register(ArgRealOpinion)
admin.site.register(POS)
admin.site.register(XcpExample, XcpExampleAdmin)
admin.site.register(AttributeType)
admin.site.register(AttrValueSelectionMode)
admin.site.register(AttrValuesSeparator)
admin.site.register(AttributeParameterModel, AttributeParameterModelAdmin)
admin.site.register(AttributeParameter, AttributeParameterAdmin)
admin.site.register(AttributeSubparameter)
admin.site.register(MorfeuszException, MorfeuszExceptionAdmin)
admin.site.register(Interpretation, InterpretationAdmin)
admin.site.register(NkjpPosTag)
admin.site.register(WalentyStat)
