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
@@ -182,3 +183,19 @@ def delete(
182183 if delete_custom_values :
183184 self .custom_values .filter (field__choice_field = False ).delete ()
184185 super ().delete (using , keep_parents )
186+
187+ @property
188+ def custom_field_type (self ) -> CustomFieldTypeBaseModel | None :
189+ if self ._custom_field_type_attr and hasattr (self , self ._custom_field_type_attr ):
190+ return getattr (self , self ._custom_field_type_attr )
191+ return None
192+
193+ @property
194+ def default_custom_fields (self ) -> CustomFieldQuerySet :
195+ return CustomField .objects .default_for (self .__class__ )
196+
197+ @property
198+ def type_custom_fields (self ) -> CustomFieldQuerySet :
199+ if self .custom_field_type :
200+ return self .custom_field_type .custom_fields .all ()
201+ return CustomField .objects .none ()
You can’t perform that action at this time.
0 commit comments