Skip to content

Commit

Permalink
Removed the special many2many models. The user interface was just too…
Browse files Browse the repository at this point in the history
… odd to implement.
  • Loading branch information
Corey Oordt committed Feb 12, 2010
1 parent 69ef59d commit 7dfb2da
Showing 1 changed file with 0 additions and 22 deletions.
22 changes: 0 additions & 22 deletions categories/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,3 @@ def __unicode__(self):
return ' > '.join([force_unicode(i.name) for i in ancestors]+[self.name,])

mptt.register(Category, order_insertion_by=['name'])


class CategoryIntermediary(models.Model):
category = models.ForeignKey(Category)
is_primary = models.BooleanField(default=False)

class Meta:
abstract = True

from categories import registry
from django.contrib import admin

for model in registry.values():
field_name = model._meta.verbose_name.lower()
class_name = str('%sCategories' % model._meta.verbose_name.title())
attrs = {
'category': models.ForeignKey(Category),
'is_primary': models.BooleanField(default=False),
'__module__': model.__dict__['__module__'],
field_name: models.ForeignKey(model),
}
admin.site.register(type(class_name, (models.Model,), attrs))

0 comments on commit 7dfb2da

Please sign in to comment.