mirror of
https://github.com/jazzband/django-categories.git
synced 2026-03-16 22:30:24 +00:00
Remove 'to' from kwargs in CategoryM2MField and CategoryFKField. 'to' is already specified, and causes errors when running unit tests
This commit is contained in:
parent
1100ad3c50
commit
29ab0943c5
1 changed files with 9 additions and 3 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue