0383ad4d3e583e6e220c86889ab3edb7b1ef3bad
[philo.git] / admin / base.py
1 from django.contrib import admin
2 from django.contrib.contenttypes import generic
3 from philo.models import 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