We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Consider the following example:
class Fruit(BaseEntity): title = models.CharField(max_length=50) class Customer(models.Model): name = models.CharField(max_length=50) fruits = odels.ManyToManyField(Fruit)
Trying to edit Customer in django admin will complain:
Caught AttributeError while rendering: Fruit does not have attribute named "attrs".
The problem is that django ModelMultipleChoiceField does this:
def prepare_value(self, value): if hasattr(value, '__iter__'): return [super(ModelMultipleChoiceField, self).prepare_value(v) for v in value] return super(ModelMultipleChoiceField, self).prepare_value(value)
I.e. since Fruit has __iter__ method, prepare_value tries to iterate it and it goes wrong.
__iter__
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Consider the following example:
Trying to edit Customer in django admin will complain:
The problem is that django ModelMultipleChoiceField does this:
I.e. since Fruit has
__iter__
method, prepare_value tries to iterate it and it goes wrong.The text was updated successfully, but these errors were encountered: