Commit 6ea2c0aa authored by Michal Čihař's avatar Michal Čihař

Change logic for whiteboard storage

Always set project even if subproject is set. This easies filtering in
admin interface.
Signed-off-by: default avatarMichal Čihař <michal@cihar.com>
parent 610641c8
...@@ -43,7 +43,7 @@ class WhiteboardManager(models.Manager): ...@@ -43,7 +43,7 @@ class WhiteboardManager(models.Manager):
) )
if project: if project:
return base.filter(project=project) return base.filter(Q(project=project) & Q(subproject=None))
if subproject: if subproject:
if language: if language:
...@@ -96,9 +96,9 @@ class WhiteboardMessage(models.Model): ...@@ -96,9 +96,9 @@ class WhiteboardMessage(models.Model):
def clean(self): def clean(self):
if self.project and self.subproject: if self.project and self.subproject:
if self.subproject.project == self.project: if self.subproject.project != self.project:
self.project = None
else:
raise ValidationError( raise ValidationError(
_('Do not specify both component and project!') _('Do not specify both component and project!')
) )
if not self.project and self.subproject:
self.project = self.subproject.project
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