Fix dumpdata output

I want a map of which functions are called,
when they are called,
and from which class they were defined.

These things are still not clear enough for me.
This commit is contained in:
tcely 2025-04-14 17:48:37 -04:00 committed by GitHub
parent f4c12f89a2
commit debac50ca3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -75,6 +75,7 @@ class CommaSepChoiceField(models.CharField):
# Override these functions to prevent unwanted behaviors
def to_python(self, value):
self.log.error(f'CommaSepChoiceField: to_python: was called with: {value!r}')
return value
def get_internal_type(self):
@ -154,6 +155,13 @@ class CommaSepChoiceField(models.CharField):
if set(s_value) != set(value):
self.log.warn(f'CommaSepChoiceField:get_prep_value: values did not match. '
f'CommaSepChoiceField({value}) versus CharField({s_value})')
return self.__class__._tuple__str__(data)
# extra functions not used by any parent classes
@staticmethod
def _tuple__str__(data):
value = data.selected_choices
if not isinstance(value, list):
return ''
if data.all_choice in value:
@ -161,7 +169,6 @@ class CommaSepChoiceField(models.CharField):
ordered_unique = list(dict.fromkeys(value))
return data.separator.join(ordered_unique)
# extra functions not used by any parent classes
def get_all_choices(self):
choice_list = list()
if self.possible_choices is None:
@ -174,3 +181,6 @@ class CommaSepChoiceField(models.CharField):
return choice_list
CommaSepChoice.__str__ = CommaSepChoiceField._tuple__str__