Jeffrey Eliasen
2018-06-13 01:31:07 UTC
I am writing a serializer field type that inherits from `ChoiceField`. In
looking at the code, I see the following:
def __init__(self, choices, **kwargs):
self.choices = choices
# ...
super(ChoiceField, self).__init__(**kwargs)
... and later in the same class I see:
choices = property(_get_choices, _set_choices)
I need to override the behavior of _get_choices(), but I don't believe it
ever gets called as setting self.choices in __init__() *should* replace the
property. Am I misunderstanding something in how Python works, or does this
class contain a bug?
Thanks in advance!
looking at the code, I see the following:
def __init__(self, choices, **kwargs):
self.choices = choices
# ...
super(ChoiceField, self).__init__(**kwargs)
... and later in the same class I see:
choices = property(_get_choices, _set_choices)
I need to override the behavior of _get_choices(), but I don't believe it
ever gets called as setting self.choices in __init__() *should* replace the
property. Am I misunderstanding something in how Python works, or does this
class contain a bug?
Thanks in advance!
--
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
You received this message because you are subscribed to the Google Groups "Django REST framework" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-rest-framework+***@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.