Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion populate_db.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@
# EventLocation
from app.models.event_location import EventLocation

# Custom Placeholder
from app.models.custom_placeholder import CustomPlaceholder

# User Permissions
from app.models.user_permission import UserPermission
SALES = 'sales'
Expand Down Expand Up @@ -174,7 +177,7 @@ def create_event_sub_topics():
"Religion & Spirituality": ["Mysticism and Occult"],
"Government & Politics": ["Non-partisan"]
}
eventopics=db.session.query(EventTopic).all()
eventopics = db.session.query(EventTopic).all()
for keysub_topic in event_sub_topic:
for subtopic in event_sub_topic[keysub_topic]:
get_or_create(EventSubTopic, name=subtopic, event_topic_id=next(x for x in eventopics if x.name==keysub_topic).id)
Expand Down Expand Up @@ -311,6 +314,15 @@ def create_admin_message_settings():
)


def create_custom_placeholders():
custom_placeholder, _ = get_or_create(
CustomPlaceholder, name='Hills',
original_image_url='https://www.w3schools.com/html/pic_mountain.jpg',
event_sub_topic_id=1
)
db.session.add(custom_placeholder)


def populate():
"""
Create defined Roles, Services and Permissions.
Expand Down Expand Up @@ -347,6 +359,8 @@ def populate():
create_event_locations()
print('Creating admin message settings...')
create_admin_message_settings()
print('Creating custom placeholders...')
create_custom_placeholders()


def populate_without_print():
Expand All @@ -369,6 +383,7 @@ def populate_without_print():
create_event_types()
create_event_locations()
create_admin_message_settings()
create_custom_placeholders()

db.session.commit()

Expand Down
2 changes: 1 addition & 1 deletion tests/hook_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3658,7 +3658,7 @@ def event_sub_topic_custom_placeholder_get_detail(transaction):
event_sub_topic = EventSubTopicFactory()
db.session.add(event_sub_topic)

custom_placeholder = CustomPlaceholderFactory(event_sub_topic_id=1)
custom_placeholder = CustomPlaceholderFactory()
db.session.add(custom_placeholder)
db.session.commit()

Expand Down