Switched nodelist crawl to return the more generic 'results' of the crawl, rather...
[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         classes = COLLAPSE_CLASSES
17
18
19 class RelationshipInline(generic.GenericTabularInline):
20         ct_field = 'entity_content_type'
21         ct_fk_field = 'entity_object_id'
22         model = Relationship
23         extra = 1
24         template = 'admin/philo/edit_inline/tabular_collapse.html'
25         allow_add = True
26         classes = COLLAPSE_CLASSES
27
28
29 class EntityAdmin(admin.ModelAdmin):
30         inlines = [AttributeInline, RelationshipInline]
31         save_on_top = True
32
33
34 class TagAdmin(admin.ModelAdmin):
35         list_display = ('name', 'slug')
36         prepopulated_fields = {"slug": ("name",)}
37
38 admin.site.register(Tag, TagAdmin)