Skip to content

Commit

Permalink
Enabled new registry in the example app for testing.
Browse files Browse the repository at this point in the history
  • Loading branch information
Corey Oordt committed May 16, 2011
1 parent d90dccd commit fa2b680
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
14 changes: 14 additions & 0 deletions example/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,4 +125,18 @@
CATEGORIES_SETTINGS = {
'ALLOW_SLUG_CHANGE': True,
'RELATION_MODELS': ['simpletext.simpletext','flatpages.flatpage'],
'FK_REGISTRY': {
'flatpages.flatpage': 'category',
'simpletext.simpletext': (
'primary_category',
{'name': 'secondary_category', 'related_name': 'simpletext_sec_cat'},
),
},
'M2M_REGISTRY': {
'simpletext.simpletext': {'name': 'categories', 'related_name': 'm2mcats'},
'flatpages.flatpage': (
{'name': 'other_categories', 'related_name': 'other_cats'},
{'name': 'more_categories', 'related_name': 'more_cats'},
),
},
}
8 changes: 4 additions & 4 deletions example/simpletext/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
from django.contrib import admin


class SimpleTextAdmin(admin.ModelAdmin):
filter_horizontal = ['cats',]
# class SimpleTextAdmin(admin.ModelAdmin):
# filter_horizontal = ['cats',]
#


admin.site.register(SimpleText, SimpleTextAdmin)
admin.site.register(SimpleText) #, SimpleTextAdmin)
6 changes: 3 additions & 3 deletions example/simpletext/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __unicode__(self):
def get_absolute_url(self):
return ('simpletext_detail_view_name', [str(self.id)])

import categories
#import categories

categories.register_fk(SimpleText, 'primary_category', {'related_name':'simpletext_primary_set'})
categories.register_m2m(SimpleText, 'cats', )
#categories.register_fk(SimpleText, 'primary_category', {'related_name':'simpletext_primary_set'})
#categories.register_m2m(SimpleText, 'cats', )

0 comments on commit fa2b680

Please sign in to comment.