feat(demo): add dummy data

This commit is contained in:
Herculino Trotta
2025-04-01 01:05:28 -03:00
parent d26907ea94
commit 4955fbde33
2 changed files with 1015 additions and 26 deletions

View File

@@ -49,7 +49,7 @@ async def remove_expired_sessions(timestamp=None):
def reset_demo_data(timestamp=None):
"""
Wipes the database and loads fresh demo data if DEMO mode is active.
Runs daily at 6:00 AM.
Runs daily at 8:00 AM.
"""
if not settings.DEMO:
return # Exit if not in demo mode
@@ -59,13 +59,14 @@ def reset_demo_data(timestamp=None):
try:
# 1. Flush the database (wipe all data)
logger.info("Flushing the database...")
# Using --noinput prevents prompts. Specify database if not default.
management.call_command(
"flush", "--noinput", database=DEFAULT_DB_ALIAS, verbosity=1
)
logger.info("Database flushed successfully.")
# 2. Load data from the fixture
# TO-DO: Roll dates over based on today's date
fixture_name = "fixtures/demo_data.json"
logger.info(f"Loading data from fixture: {fixture_name}...")
management.call_command(

File diff suppressed because it is too large Load Diff