|
@@ -7,35 +7,37 @@ from .posts import get_fake_hidden_post, get_fake_post, get_fake_unapproved_post
|
|
corpus_short = EnglishCorpus(max_length=150)
|
|
corpus_short = EnglishCorpus(max_length=150)
|
|
|
|
|
|
|
|
|
|
-def get_fake_thread(fake, category, starter):
|
|
|
|
- thread = create_fake_thread(fake, category, starter)
|
|
|
|
|
|
+def get_fake_thread(fake, category, starter=None):
|
|
|
|
+ thread = create_fake_thread(fake, category)
|
|
thread.first_post = get_fake_post(fake, thread, starter)
|
|
thread.first_post = get_fake_post(fake, thread, starter)
|
|
thread.save(update_fields=["first_post"])
|
|
thread.save(update_fields=["first_post"])
|
|
return thread
|
|
return thread
|
|
|
|
|
|
|
|
|
|
-def get_fake_closed_thread(fake, category, starter):
|
|
|
|
- thread = get_fake_thread(fake, category, starter)
|
|
|
|
|
|
+def get_fake_closed_thread(fake, category, starter=None):
|
|
|
|
+ thread = get_fake_thread(fake, category)
|
|
thread.is_closed = True
|
|
thread.is_closed = True
|
|
thread.save(update_fields=["is_closed"])
|
|
thread.save(update_fields=["is_closed"])
|
|
return thread
|
|
return thread
|
|
|
|
|
|
|
|
|
|
-def get_fake_hidden_thread(fake, category, starter, hidden_by=None):
|
|
|
|
- thread = create_fake_thread(fake, category, starter)
|
|
|
|
|
|
+def get_fake_hidden_thread(fake, category, starter=None, hidden_by=None):
|
|
|
|
+ thread = create_fake_thread(fake, category)
|
|
thread.first_post = get_fake_hidden_post(fake, thread, starter, hidden_by)
|
|
thread.first_post = get_fake_hidden_post(fake, thread, starter, hidden_by)
|
|
- thread.save(update_fields=["first_post"])
|
|
|
|
|
|
+ thread.is_hidden = True
|
|
|
|
+ thread.save(update_fields=["first_post", "is_hidden"])
|
|
return thread
|
|
return thread
|
|
|
|
|
|
|
|
|
|
-def get_fake_unapproved_thread(fake, category, starter):
|
|
|
|
- thread = create_fake_thread(fake, category, starter)
|
|
|
|
|
|
+def get_fake_unapproved_thread(fake, category, starter=None):
|
|
|
|
+ thread = create_fake_thread(fake, category)
|
|
thread.first_post = get_fake_unapproved_post(fake, thread, starter)
|
|
thread.first_post = get_fake_unapproved_post(fake, thread, starter)
|
|
- thread.save(update_fields=["first_post"])
|
|
|
|
|
|
+ thread.is_unapproved = True
|
|
|
|
+ thread.save(update_fields=["first_post", "is_unapproved"])
|
|
return thread
|
|
return thread
|
|
|
|
|
|
|
|
|
|
-def create_fake_thread(fake, category, starter):
|
|
|
|
|
|
+def create_fake_thread(fake, category):
|
|
started_on = timezone.now()
|
|
started_on = timezone.now()
|
|
thread = Thread(
|
|
thread = Thread(
|
|
category=category,
|
|
category=category,
|