Tidy up after a long absence

This commit is contained in:
Neill Cox 2025-03-09 17:58:06 +11:00
parent 3931d2ccbd
commit fea7c0eeb9
28 changed files with 2444 additions and 376 deletions

View file

@ -1,24 +1,24 @@
from django.contrib.auth.models import User
from django.db import connection
from django.core.management import BaseCommand
def create_users():
user = User.objects.create_user(
username="neill",
is_superuser=True,
first_name="Neill",
last_name="Cox",
email="neill@neill.id.au",
is_staff=True,
is_active=True,
date_joined="2024-07-31T00:00:00.000Z",
password="password",
)
# user.save()
def drop_tables():
with connection.cursor() as cursor:
for table in [
"gurps_character",
"gurps_character_campaign",
"gurps_character_campaign_gm",
"gurps_character_campaignplayer",
"gurps_character_gm",
"gurps_character_player",
"gurps_character_gamesystem",
"gurps_character_gurpscharacter"]:
cursor.execute(f'DROP TABLE IF EXISTS {table} cascade')
cursor.execute("DELETE FROM django_migrations WHERE app = 'gurps_character'")
class Command(BaseCommand):
help = "Load some initial data"
help = "Drop all the tables!"
def handle(self, *args, **options):
create_users()
drop_tables()