diff --git a/README.rst b/README.rst index 7b90176..e777080 100644 --- a/README.rst +++ b/README.rst @@ -4,6 +4,9 @@ django-autofixture |build| |package| +*** Compatible with Django version 2.X + + This app aims to provide a simple way of loading masses of randomly generated test data into your development database. You can use a management command to load test data through command line. diff --git a/autofixture/base.py b/autofixture/base.py index 93bdc3f..7fd43b4 100644 --- a/autofixture/base.py +++ b/autofixture/base.py @@ -407,7 +407,11 @@ def process_field(self, instance, field): value = self.get_value(field) if value is self.IGNORE_FIELD: return - setattr(instance, field.name, value) + elif isinstance(field, related.ManyToManyField): + instance.save() + getattr(instance, field.name).set(value) + else: + setattr(instance, field.name, value) def process_m2m(self, instance, field): # check django's version number to determine how intermediary models