diff --git a/bookwyrm/models/list.py b/bookwyrm/models/list.py index b73d77086..75f34b9e8 100644 --- a/bookwyrm/models/list.py +++ b/bookwyrm/models/list.py @@ -37,7 +37,8 @@ class List(OrderedCollectionMixin, BookWyrmModel): group = models.ForeignKey( "Group", on_delete=models.CASCADE, - null=True + default=None, + blank=True ) books = models.ManyToManyField( "Edition", diff --git a/bookwyrm/templates/lists/form.html b/bookwyrm/templates/lists/form.html index 0019520e8..d2f17d63b 100644 --- a/bookwyrm/templates/lists/form.html +++ b/bookwyrm/templates/lists/form.html @@ -37,20 +37,16 @@ {% trans "Group" %}

{% trans "Group members can add to and remove from this list" %}

- - - - {% if user_groups %} {% csrf_token %}
diff --git a/bookwyrm/views/list.py b/bookwyrm/views/list.py index 9ef027538..fb224cdf5 100644 --- a/bookwyrm/views/list.py +++ b/bookwyrm/views/list.py @@ -62,10 +62,6 @@ class Lists(View): def post(self, request): """create a book_list""" form = forms.ListForm(request.POST) - # TODO: here we need to take the value of the group (the group.id) - # and fetch the actual group to add to the DB - # but only if curation type is 'group' other wise the value of - # group is None if not form.is_valid(): return redirect("lists") book_list = form.save() @@ -208,6 +204,9 @@ class List(View): if not form.is_valid(): return redirect("list", book_list.id) book_list = form.save() + if not book_list.curation == "group": + book_list.group = None + book_list.save() return redirect(book_list.local_path)