Skip to content

Commit baf4f1d

Browse files
committed
Fixed a bug in case the organization doesn't exist
1 parent 3f077bd commit baf4f1d

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

backend/conduit/articles/models.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,13 +162,17 @@ def remove_tag(self, tag):
162162

163163
def add_organization(self, articles):
164164
self.needsReview = False
165-
self.org_articles.append(articles)
166-
return True
165+
if articles not in self.org_articles:
166+
self.org_articles.append(articles)
167+
return True
168+
return False
167169

168170
def remove_organization(self, articles):
169171
self.needsReview = False
170-
self.org_articles.remove(articles)
171-
return True
172+
if articles in self.org_articles:
173+
self.org_articles.remove(articles)
174+
return True
175+
return False
172176

173177
def add_needReviewTag(self, tag):
174178
self.needReviewTags.append(tag)

0 commit comments

Comments
 (0)