1 from django.contrib import admin
2 from django.contrib.contenttypes import generic
3 from philo.models import Tag, Attribute, Relationship
6 COLLAPSE_CLASSES = ('collapse', 'collapse-closed', 'closed',)
9 class AttributeInline(generic.GenericTabularInline):
10 ct_field = 'entity_content_type'
11 ct_fk_field = 'entity_object_id'
14 template = 'admin/philo/edit_inline/tabular_collapse.html'
16 classes = COLLAPSE_CLASSES
19 class RelationshipInline(generic.GenericTabularInline):
20 ct_field = 'entity_content_type'
21 ct_fk_field = 'entity_object_id'
24 template = 'admin/philo/edit_inline/tabular_collapse.html'
26 classes = COLLAPSE_CLASSES
29 class EntityAdmin(admin.ModelAdmin):
30 inlines = [AttributeInline, RelationshipInline]
34 class TagAdmin(admin.ModelAdmin):
35 prepopulated_fields = {"slug": ("name",)}
37 admin.site.register(Tag, TagAdmin)