Skip to content

Commit

Permalink
Remove 'to' from kwargs in CategoryM2MField and CategoryFKField. 'to'…
Browse files Browse the repository at this point in the history
… is already specified, and causes errors when running unit tests
  • Loading branch information
Martin Ogden authored and coordt committed May 8, 2011
1 parent 1100ad3 commit 29ab094
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions categories/fields.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,18 @@
from django.db.models import ForeignKey, ManyToManyField

from categories.models import Category



class CategoryM2MField(ManyToManyField):
def __init__(self, **kwargs):
from categories.models import Category
if 'to' in kwargs:
kwargs.pop('to')
super(CategoryM2MField, self).__init__(to=Category, **kwargs)


class CategoryFKField(ForeignKey):
def __init__(self, **kwargs):
from categories.models import Category
super(CategoryFKField, self).__init__(to=Category, **kwargs)
if 'to' in kwargs:
kwargs.pop('to')
super(CategoryFKField, self).__init__(to=Category, **kwargs)

0 comments on commit 29ab094

Please sign in to comment.