File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed
django_features/custom_fields/models Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change 1414from django_extensions .db .models import TimeStampedModel
1515
1616from django_features .custom_fields .models .field import CustomField
17+ from django_features .custom_fields .models .field import CustomFieldQuerySet
1718from django_features .custom_fields .models .value import CustomValue
1819
1920
@@ -184,3 +185,19 @@ def delete(
184185 if delete_custom_values :
185186 self .custom_values .filter (field__choice_field = False ).delete ()
186187 super ().delete (using , keep_parents )
188+
189+ @property
190+ def custom_field_type (self ) -> CustomFieldTypeBaseModel | None :
191+ if self ._custom_field_type_attr and hasattr (self , self ._custom_field_type_attr ):
192+ return getattr (self , self ._custom_field_type_attr )
193+ return None
194+
195+ @property
196+ def default_custom_fields (self ) -> CustomFieldQuerySet :
197+ return CustomField .objects .default_for (self .__class__ )
198+
199+ @property
200+ def type_custom_fields (self ) -> CustomFieldQuerySet :
201+ if self .custom_field_type :
202+ return self .custom_field_type .custom_fields .all ()
203+ return CustomField .objects .none ()
You can’t perform that action at this time.
0 commit comments