1 from django.contrib import admin
2 from django.contrib.contenttypes import generic
3 from philo.models import Tag, Attribute
4 from philo.forms import AttributeForm, AttributeInlineFormSet
7 COLLAPSE_CLASSES = ('collapse', 'collapse-closed', 'closed',)
10 class AttributeInline(generic.GenericTabularInline):
11 ct_field = 'entity_content_type'
12 ct_fk_field = 'entity_object_id'
15 template = 'admin/philo/edit_inline/tabular_attribute.html'
17 classes = COLLAPSE_CLASSES
19 formset = AttributeInlineFormSet
20 exclude = ['value_object_id']
23 class EntityAdmin(admin.ModelAdmin):
24 inlines = [AttributeInline]
28 class TagAdmin(admin.ModelAdmin):
29 list_display = ('name', 'slug')
30 prepopulated_fields = {"slug": ("name",)}
31 search_fields = ["name"]
33 admin.site.register(Tag, TagAdmin)