|
|
@ -3,6 +3,7 @@ from collections import defaultdict |
|
|
|
from copy import deepcopy |
|
|
|
from copy import deepcopy |
|
|
|
|
|
|
|
|
|
|
|
from django.conf import settings |
|
|
|
from django.conf import settings |
|
|
|
|
|
|
|
from django.utils.functional import lazy |
|
|
|
from django.utils.translation import gettext as _ |
|
|
|
from django.utils.translation import gettext as _ |
|
|
|
|
|
|
|
|
|
|
|
from common.db.models import ChoicesMixin |
|
|
|
from common.db.models import ChoicesMixin |
|
|
@ -29,15 +30,15 @@ class AllTypes(ChoicesMixin): |
|
|
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
@classmethod |
|
|
|
def choices(cls): |
|
|
|
def choices(cls): |
|
|
|
|
|
|
|
return lazy(cls.get_choices, list)() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
|
|
|
|
def get_choices(cls): |
|
|
|
choices = [] |
|
|
|
choices = [] |
|
|
|
for tp in cls.includes: |
|
|
|
for tp in cls.includes: |
|
|
|
choices.extend(tp.get_choices()) |
|
|
|
choices.extend(tp.get_choices()) |
|
|
|
return choices |
|
|
|
return choices |
|
|
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
|
|
|
|
def get_choices(cls): |
|
|
|
|
|
|
|
return cls.choices() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@classmethod |
|
|
|
@classmethod |
|
|
|
def filter_choices(cls, category): |
|
|
|
def filter_choices(cls, category): |
|
|
|
choices = dict(cls.category_types()).get(category, cls).get_choices() |
|
|
|
choices = dict(cls.category_types()).get(category, cls).get_choices() |
|
|
|