Skip to content

Commit

Permalink
add with_tags params to ForumFactory
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentporte committed Aug 7, 2024
1 parent cb8f9ed commit 0192545
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lacommunaute/forum/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ def upvoted_by(self, create, extracted, **kwargs):
for user in extracted:
UpVote.objects.create(voter=user, content_object=self)

@factory.post_generation
def with_tags(self, create, extracted, **kwargs):
if not create or not extracted:
return

if isinstance(extracted, list):
for tag in extracted:
self.tags.add(tag)


class CategoryForumFactory(ForumFactory):
type = Forum.FORUM_CAT
Expand Down

0 comments on commit 0192545

Please sign in to comment.