Remove 'to' from kwargs in CategoryM2MField and CategoryFKField. 'to' is already specified, and causes errors when running unit tests

This commit is contained in:
Martin Ogden 2011-03-17 18:20:53 +08:00 committed by Corey Oordt
parent 1100ad3c50
commit 29ab0943c5

View file

@ -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)