using raw_ids in admin instead of dropdown as otherwise it ll not scale
[worddb.git] / words / admin.py
blob966b5d99d425b739878fc6695730939c0feb6c44
1 from django.contrib import admin
3 from worddb.words.models import Word, Meaning, Pronunciation, ChangeSheet
4 from worddb.words.models import Etymology, Short
6 # WordAdmin # {{{
7 # Inlines # {{{
8 class ShortInline(admin.TabularInline):
9 model = Short
10 extra = 1
12 class EtymologyInline(admin.TabularInline):
13 model = Etymology
14 extra = 1
16 class MeaningInline(admin.TabularInline):
17 model = Meaning
18 extra = 1
19 # }}}
20 class WordAdmin(admin.ModelAdmin):
21 model = Word
22 raw_id_fields = (
23 'synonyms', 'thesaurus', 'antonyms', 'translations',
24 'rhymes', 'relateds',
26 fieldsets = [
27 (None, { 'fields': ['word', 'language', 'forms'] }),
29 'Deleted?',
31 'fields': ['not_a_word', 'not_a_word_marked_on'],
32 'classes': ['collapse wid'],
36 'Relations',
38 'fields': [
39 'synonyms', 'thesaurus', 'antonyms',
40 'translations', 'rhymes', 'relateds',
42 'classes': ['collapse'],
46 inlines = [ShortInline, MeaningInline, EtymologyInline]
47 admin.site.register(Word, WordAdmin)
48 # }}}
50 # ChangeSheetAdmin # {{{
51 class ChangeSheetAdmin(admin.ModelAdmin):
52 model = ChangeSheet
53 raw_id_fields = ( 'word', 'user' )
54 admin.site.register(ChangeSheet, ChangeSheetAdmin)
55 # }}}
57 # EtymologyAdmin # {{{
58 class EtymologyAdmin(admin.ModelAdmin):
59 model = Etymology
60 raw_id_fields = ( 'word', )
61 admin.site.register(Etymology, EtymologyAdmin)
62 # }}}
64 # MeaningAdmin # {{{
65 class MeaningAdmin(admin.ModelAdmin):
66 model = Meaning
67 raw_id_fields = ( 'word', )
68 fieldsets = [
69 (None, { 'fields': ['word', 'meaning', 'usage', 'language', 'pol'] }),
71 'Deleted?',
73 'fields': ['is_deleted', 'deleted_on'],
74 'classes': ['collapse wid'],
78 admin.site.register(Meaning, MeaningAdmin)
79 # }}}
81 # PronunciationAdmin # {{{
82 class PronunciationAdmin(admin.ModelAdmin):
83 model = Pronunciation
84 fieldsets = [
85 (None, { 'fields': ['spelling', 'pronunciation_key',] }),
87 'Deleted?',
89 'fields': ['is_deleted', 'deleted_on'],
90 'classes': ['collapse wid'],
94 admin.site.register(Pronunciation, PronunciationAdmin)
95 # }}}
97 # PronunciationAdmin # {{{
98 class ShortAdmin(admin.ModelAdmin):
99 model = Short
100 raw_id_fields = ( 'word', )
101 admin.site.register(Short, ShortAdmin)
102 # }}}