32 lines
1.9 KiB
Python
32 lines
1.9 KiB
Python
# Generated by Django 5.0.6 on 2024-06-09 14:47
|
|
|
|
from django.db import migrations
|
|
def add_initial_values(apps, schema_editor):
|
|
init_userdata = {
|
|
"name": "John Doe",
|
|
"intro_content": "<p>Write something about yourself</p>",
|
|
"profile_photo": "",
|
|
"default_theme": "darkTheme",
|
|
"dark_theme": "{\"theme\": \"Dark Mode\",\"background\": \"bg-dark\",\"textColor\": \"text-white\",\"linkBackground\": \"bg-light\",\"linkTextColor\": \"text-black\",\"captionColor\": \"#8a8a8a\",\"fontAwesomeIcon\": \"faSun\",\"borderColor\": \"border-light\",\"buttonColor\": \"light\",\"navBar\": {\"navBarTheme\": \"navbar-dark\",\"background\": \"bg-secondary\",\"buttonColor\": \"light\"},\"footer\": {\"background\": \"bg-secondary\",\"text\": \"text-white\"}}",
|
|
"light_theme": "{\"theme\": \"Light Mode\",\"background\": \"bg-light\",\"textColor\": \"text-black\",\"linkBackground\": \"bg-dark\",\"linkTextColor\": \"text-white\",\"captionColor\": \"#605f5f\",\"fontAwesomeIcon\": \"faMoon\",\"borderColor\": \"border-secondary\",\"buttonColor\": \"dark\",\"navBar\": {\"navBarTheme\": \"navbar-light\",\"background\": \"bg-secondary\",\"buttonColor\": \"light\"},\"footer\": {\"background\": \"bg-secondary\",\"text\": \"text-black\"}}"
|
|
}
|
|
UserData = apps.get_model('apimanager', 'userdata')
|
|
UserData.objects.create(
|
|
name=init_userdata["name"],
|
|
intro_content=init_userdata["intro_content"],
|
|
profile_photo=init_userdata["profile_photo"],
|
|
default_theme=init_userdata["default_theme"],
|
|
dark_theme=init_userdata["dark_theme"],
|
|
light_theme=init_userdata["light_theme"]
|
|
)
|
|
|
|
class Migration(migrations.Migration):
|
|
|
|
dependencies = [
|
|
('apimanager', '0012_userdata_built_with_alter_userdata_dark_theme_and_more'),
|
|
]
|
|
|
|
operations = [
|
|
migrations.RunPython(add_initial_values),
|
|
]
|