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

@@ -92,8 +92,7 @@ def maybe_send_to_registration(request: HttpRequest, email: Text, full_name: Tex
del request.session["multiuse_object_key"]
request.session.modified = True
if streams_to_subscribe is not None:
prereg_user.streams = streams_to_subscribe
prereg_user.save()
prereg_user.streams.set(streams_to_subscribe)
return redirect("".join((
create_confirmation_link(prereg_user, request.get_host(), Confirmation.USER_REGISTRATION),