Commit 9176a03a authored by Sli's avatar Sli

Merge branch 'bugfix' into 'master'

Fix some SAS and forum errors

Closes #89

See merge request !263
parents 4ecad1c7 4a1bfc36
Pipeline #2219 failed with stage
in 50 minutes and 6 seconds
...@@ -42,6 +42,7 @@ from core.views import ( ...@@ -42,6 +42,7 @@ from core.views import (
CanEditMixin, CanEditMixin,
CanEditPropMixin, CanEditPropMixin,
CanCreateMixin, CanCreateMixin,
UserIsLoggedMixin,
can_view, can_view,
) )
from core.views.forms import MarkdownInput from core.views.forms import MarkdownInput
...@@ -273,7 +274,9 @@ class ForumTopicEditView(CanEditMixin, UpdateView): ...@@ -273,7 +274,9 @@ class ForumTopicEditView(CanEditMixin, UpdateView):
template_name = "core/edit.jinja" template_name = "core/edit.jinja"
class ForumTopicSubscribeView(CanViewMixin, SingleObjectMixin, RedirectView): class ForumTopicSubscribeView(
CanViewMixin, UserIsLoggedMixin, SingleObjectMixin, RedirectView
):
model = ForumTopic model = ForumTopic
pk_url_kwarg = "topic_id" pk_url_kwarg = "topic_id"
permanent = False permanent = False
......
...@@ -180,6 +180,12 @@ class PictureView(CanViewMixin, DetailView, FormMixin): ...@@ -180,6 +180,12 @@ class PictureView(CanViewMixin, DetailView, FormMixin):
if self.form.is_valid(): if self.form.is_valid():
for uid in self.form.cleaned_data["users"]: for uid in self.form.cleaned_data["users"]:
u = User.objects.filter(id=uid).first() u = User.objects.filter(id=uid).first()
if not u: # Don't use a non existing user
continue
if PeoplePictureRelation.objects.filter(
user=u, picture=self.form.cleaned_data["picture"]
).exists(): # Avoid existing relation
continue
PeoplePictureRelation( PeoplePictureRelation(
user=u, picture=self.form.cleaned_data["picture"] user=u, picture=self.form.cleaned_data["picture"]
).save() ).save()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment