93 lines
2.1 KiB
Python
93 lines
2.1 KiB
Python
#!/usr/bin/env python
|
|
"""
|
|
Script to create basic files for all apps
|
|
"""
|
|
import os
|
|
from pathlib import Path
|
|
|
|
# Define apps and their display names
|
|
APPS = {
|
|
'accounts': 'Accounts',
|
|
'organizations': 'Organizations',
|
|
'journeys': 'Journeys',
|
|
'surveys': 'Surveys',
|
|
'complaints': 'Complaints',
|
|
'feedback': 'Feedback',
|
|
'callcenter': 'Call Center',
|
|
'social': 'Social',
|
|
'px_action_center': 'PX Action Center',
|
|
'analytics': 'Analytics',
|
|
'physicians': 'Physicians',
|
|
'projects': 'Projects',
|
|
'integrations': 'Integrations',
|
|
'notifications': 'Notifications',
|
|
'ai_engine': 'AI Engine',
|
|
}
|
|
|
|
BASE_DIR = Path(__file__).resolve().parent
|
|
APPS_DIR = BASE_DIR / 'apps'
|
|
|
|
for app_name, display_name in APPS.items():
|
|
app_dir = APPS_DIR / app_name
|
|
|
|
# Skip core as it's already created
|
|
if app_name == 'core':
|
|
continue
|
|
|
|
# Create apps.py
|
|
config_class = ''.join(word.capitalize() for word in app_name.split('_')) + 'Config'
|
|
apps_content = f'''"""
|
|
{app_name} app configuration
|
|
"""
|
|
from django.apps import AppConfig
|
|
|
|
|
|
class {config_class}(AppConfig):
|
|
default_auto_field = 'django.db.models.BigAutoField'
|
|
name = 'apps.{app_name}'
|
|
verbose_name = '{display_name}'
|
|
'''
|
|
|
|
with open(app_dir / 'apps.py', 'w') as f:
|
|
f.write(apps_content)
|
|
|
|
# Create models.py
|
|
models_content = f'''"""
|
|
{display_name} models
|
|
"""
|
|
from django.db import models
|
|
|
|
# TODO: Add models for {app_name}
|
|
'''
|
|
|
|
with open(app_dir / 'models.py', 'w') as f:
|
|
f.write(models_content)
|
|
|
|
# Create admin.py
|
|
admin_content = f'''"""
|
|
{display_name} admin
|
|
"""
|
|
from django.contrib import admin
|
|
|
|
# TODO: Register models for {app_name}
|
|
'''
|
|
|
|
with open(app_dir / 'admin.py', 'w') as f:
|
|
f.write(admin_content)
|
|
|
|
# Create views.py
|
|
views_content = f'''"""
|
|
{display_name} views
|
|
"""
|
|
from django.shortcuts import render
|
|
|
|
# TODO: Add views for {app_name}
|
|
'''
|
|
|
|
with open(app_dir / 'views.py', 'w') as f:
|
|
f.write(views_content)
|
|
|
|
print(f"Created files for {app_name}")
|
|
|
|
print("Done!")
|