Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixes search for generator by field class. Now search is performed no…

…t only in

field class, but also in all bases of field class.
  • Loading branch information...
commit 777ffcf71fbc2cd54a4d2c3573045d9b8821ec96 1 parent a45e519
@sirex authored
Showing with 6 additions and 2 deletions.
  1. +6 −2 mockups/factory.py
View
8 mockups/factory.py
@@ -85,8 +85,12 @@ def get_generator(self, field, **kwargs):
return generators.ChoiceFieldGenerator(field)
elif field.default is not models.NOT_PROVIDED:
return None # bail out
- elif field.__class__ in self.fieldclass_to_generator:
- obj = self.fieldclass_to_generator.get(field.__class__)
+ # check if any of bases exests in self.fieldclass_to_generator
+ elif (set(field.__class__.__mro__).
+ intersection(self.fieldclass_to_generator)):
+ for cls in field.__class__.__mro__:
+ if cls in self.fieldclass_to_generator:
+ obj = self.fieldclass_to_generator.get(cls)
else:
return None # No matching generator found
Please sign in to comment.
Something went wrong with that request. Please try again.