django-2.0: Don't assign directly to Many-to-Many field.

The old pattern of setting the value and then using .save() here has
been deprecated.  set() also saves the record.
This commit is contained in:
rht
2018-01-31 12:22:07 +05:00
committed by Tim Abbott
parent e4a62aa778
commit 71ff8c370e
6 changed files with 7 additions and 14 deletions

View File

@@ -57,8 +57,7 @@ Create default stream groups which the users can choose during sign up.
except DefaultStreamGroup.DoesNotExist:
default_stream_group = DefaultStreamGroup.objects.create(
name=options["name"], realm=realm, description=options["description"])
default_stream_group.streams = streams
default_stream_group.save()
default_stream_group.streams.set(streams)
default_stream_groups = DefaultStreamGroup.objects.all()
for default_stream_group in default_stream_groups: