Skip to content
New issue

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

Fix django 4 compat #120

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
6 changes: 5 additions & 1 deletion autofixture/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion autofixture/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@
from django.dispatch import Signal


instance_created = Signal(providing_args=['model', 'instance', 'committed'])
instance_created = Signal()