|
@@ -175,12 +175,13 @@ def createall():
|
|
user.secondary_groups.append(groups[u-1])
|
|
user.secondary_groups.append(groups[u-1])
|
|
user.primary_group_id = u
|
|
user.primary_group_id = u
|
|
db.session.add(user)
|
|
db.session.add(user)
|
|
|
|
+ db.session.commit()
|
|
|
|
|
|
# create 2 categories
|
|
# create 2 categories
|
|
for i in range(1, 3):
|
|
for i in range(1, 3):
|
|
category_title = "Test Category %s" % i
|
|
category_title = "Test Category %s" % i
|
|
category = Forum(is_category=True, title=category_title,
|
|
category = Forum(is_category=True, title=category_title,
|
|
- description="Test Description")
|
|
|
|
|
|
+ description="Test Description")
|
|
db.session.add(category)
|
|
db.session.add(category)
|
|
|
|
|
|
# create 2 forums in each category
|
|
# create 2 forums in each category
|
|
@@ -192,22 +193,25 @@ def createall():
|
|
forum = Forum(title=forum_title, description="Test Description",
|
|
forum = Forum(title=forum_title, description="Test Description",
|
|
parent_id=i)
|
|
parent_id=i)
|
|
db.session.add(forum)
|
|
db.session.add(forum)
|
|
|
|
+ db.session.commit()
|
|
|
|
|
|
# create 1 topic in each forum
|
|
# create 1 topic in each forum
|
|
for k in [2, 3, 5, 6]: # Forum ids are not sequential because categories.
|
|
for k in [2, 3, 5, 6]: # Forum ids are not sequential because categories.
|
|
topic = Topic()
|
|
topic = Topic()
|
|
- topic.first_post = Post()
|
|
|
|
|
|
+ first_post = Post()
|
|
|
|
|
|
topic.title = "Test Title %s" % k
|
|
topic.title = "Test Title %s" % k
|
|
topic.user_id = 1
|
|
topic.user_id = 1
|
|
topic.forum_id = k
|
|
topic.forum_id = k
|
|
- topic.first_post.content = "Test Content"
|
|
|
|
- topic.first_post.user_id = 1
|
|
|
|
- topic.first_post.topic_id = k
|
|
|
|
-
|
|
|
|
db.session.add(topic)
|
|
db.session.add(topic)
|
|
db.session.commit()
|
|
db.session.commit()
|
|
|
|
|
|
|
|
+ first_post.content = "Test Content"
|
|
|
|
+ first_post.user_id = 1
|
|
|
|
+ first_post.topic_id = topic.id
|
|
|
|
+ db.session.add(first_post)
|
|
|
|
+ db.session.commit()
|
|
|
|
+
|
|
# Invalidate relevant caches
|
|
# Invalidate relevant caches
|
|
topic.invalidate_cache()
|
|
topic.invalidate_cache()
|
|
topic.forum.invalidate_cache()
|
|
topic.forum.invalidate_cache()
|