mirror of
https://github.com/jazzband/django-categories.git
synced 2026-03-16 22:30:24 +00:00
18 lines
497 B
Python
18 lines
497 B
Python
from django.db.models import ForeignKey, ManyToManyField
|
|
|
|
from categories.models import Category
|
|
|
|
|
|
|
|
class CategoryM2MField(ManyToManyField):
|
|
def __init__(self, **kwargs):
|
|
if 'to' in kwargs:
|
|
kwargs.pop('to')
|
|
super(CategoryM2MField, self).__init__(to=Category, **kwargs)
|
|
|
|
|
|
class CategoryFKField(ForeignKey):
|
|
def __init__(self, **kwargs):
|
|
if 'to' in kwargs:
|
|
kwargs.pop('to')
|
|
super(CategoryFKField, self).__init__(to=Category, **kwargs)
|