mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-25 06:26:37 +00:00
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:
parent
f4c12f89a2
commit
debac50ca3
@ -75,6 +75,7 @@ class CommaSepChoiceField(models.CharField):
|
|||||||
|
|
||||||
# Override these functions to prevent unwanted behaviors
|
# Override these functions to prevent unwanted behaviors
|
||||||
def to_python(self, value):
|
def to_python(self, value):
|
||||||
|
self.log.error(f'CommaSepChoiceField: to_python: was called with: {value!r}')
|
||||||
return value
|
return value
|
||||||
|
|
||||||
def get_internal_type(self):
|
def get_internal_type(self):
|
||||||
@ -154,6 +155,13 @@ class CommaSepChoiceField(models.CharField):
|
|||||||
if set(s_value) != set(value):
|
if set(s_value) != set(value):
|
||||||
self.log.warn(f'CommaSepChoiceField:get_prep_value: values did not match. '
|
self.log.warn(f'CommaSepChoiceField:get_prep_value: values did not match. '
|
||||||
f'CommaSepChoiceField({value}) versus CharField({s_value})')
|
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):
|
if not isinstance(value, list):
|
||||||
return ''
|
return ''
|
||||||
if data.all_choice in value:
|
if data.all_choice in value:
|
||||||
@ -161,7 +169,6 @@ class CommaSepChoiceField(models.CharField):
|
|||||||
ordered_unique = list(dict.fromkeys(value))
|
ordered_unique = list(dict.fromkeys(value))
|
||||||
return data.separator.join(ordered_unique)
|
return data.separator.join(ordered_unique)
|
||||||
|
|
||||||
# extra functions not used by any parent classes
|
|
||||||
def get_all_choices(self):
|
def get_all_choices(self):
|
||||||
choice_list = list()
|
choice_list = list()
|
||||||
if self.possible_choices is None:
|
if self.possible_choices is None:
|
||||||
@ -174,3 +181,6 @@ class CommaSepChoiceField(models.CharField):
|
|||||||
|
|
||||||
return choice_list
|
return choice_list
|
||||||
|
|
||||||
|
|
||||||
|
CommaSepChoice.__str__ = CommaSepChoiceField._tuple__str__
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user