-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbase.py
More file actions
30 lines (23 loc) · 865 Bytes
/
base.py
File metadata and controls
30 lines (23 loc) · 865 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
from django.contrib.contenttypes.fields import GenericRelation
from django.db import models
from django.utils.translation import gettext_lazy as _
from app.custom_field.models import CustomField
from app.custom_field.models import CustomValue
from django_features.custom_fields.models import CustomFieldBaseModel
from django_features.custom_fields.models import CustomFieldTypeBaseModel
class CustomTypeBaseModel(CustomFieldTypeBaseModel):
custom_fields = GenericRelation(
CustomField,
object_id_field="type_id",
content_type_field="type_content_type",
)
class Meta:
abstract = True
class CustomBaseModel(CustomFieldBaseModel):
custom_values = models.ManyToManyField(
blank=True,
to=CustomValue,
verbose_name=_("Benutzerdefinierte Werte"),
)
class Meta:
abstract = True