Complete project revamp with a bunch of commits #37

Merged
ChaoticByte merged 24 commits from revamp into devel 2023-03-26 10:40:59 +00:00
2 changed files with 53 additions and 0 deletions
Showing only changes of commit 9bc9d519c0 - Show all commits

View file

@ -0,0 +1,34 @@
# GlobalValues Data migration #1
from django.db import migrations
def create_globals(apps, schema_editor):
Global = apps.get_model("app", "Global")
Global.objects.create(
name="global_message",
comment="Here you can set a global message that will be shown to every user",
value_float=0.0,
value_string="")
Global.objects.create(
name="admin_info",
comment="Here you can set am infotext that will be displayed on the admin panel",
value_float=0.0,
value_string="")
class Migration(migrations.Migration):
dependencies = [
('app', '0001_initial'),
]
operations = [
# create globals
migrations.RunPython(create_globals),
# create view for userdeposits
migrations.RunSQL("""
create or replace view app_userdeposits_view as
select * from app_registertransaction
where is_user_deposit = true;""")
]

19
scripts/create-admin.sh Executable file
View file

@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Copyright 2023 Julian Müller (ChaoticByte)
# change to correct directory, if necessary
script_absolute=$(realpath "$0")
script_directory=$(dirname "$script_absolute")
desired_directory=$(realpath "$script_directory"/..)
if [ "$PWD" != "$desired_directory" ]; then
echo "Changing to project directory..."
cd "$desired_directory"
fi
echo "Activating venv..."
source ./venv/bin/activate
echo "Applying migrations..."
./manage.py migrate
./manage.py createsuperuser