Fixing a double declaration of the monthname filter, and renaming ap_monthname to...
[philo.git] / admin / base.py
1 from django.contrib import admin
2 from django.contrib.contenttypes import generic
3 from philo.models import Tag, Attribute, Relationship
4
5
6 COLLAPSE_CLASSES = ('collapse', 'collapse-closed', 'closed',)
7
8
9 class AttributeInline(generic.GenericTabularInline):
10         ct_field = 'entity_content_type'
11         ct_fk_field = 'entity_object_id'
12         model = Attribute
13         extra = 1
14         template = 'admin/philo/edit_inline/tabular_collapse.html'
15         allow_add = True
16
17
18 class RelationshipInline(generic.GenericTabularInline):
19         ct_field = 'entity_content_type'
20         ct_fk_field = 'entity_object_id'
21         model = Relationship
22         extra = 1
23         template = 'admin/philo/edit_inline/tabular_collapse.html'
24         allow_add = True
25
26
27 class EntityAdmin(admin.ModelAdmin):
28         inlines = [AttributeInline, RelationshipInline]
29         save_on_top = True
30
31
32 class TagAdmin(admin.ModelAdmin):
33         prepopulated_fields = {"slug": ("name",)}
34
35 admin.site.register(Tag, TagAdmin)