From 9a5dd6879aeb0a0250c95f54ec641d2761de5923 Mon Sep 17 00:00:00 2001 From: Dan <47875749+leethobbit@users.noreply.github.com> Date: Thu, 21 Nov 2024 16:28:03 -0500 Subject: [PATCH] Begin semantic versioning, enhance commands for data generation --- dragonroost/__init__.py | 2 +- .../management/commands/add_animals.py | 88 +++++++++++++++++ .../management/commands/add_initial_data.py | 99 ++++++++----------- .../animals/migrations/0001_initial.py | 13 ++- ...ord_findings_medicalrecord_problem_list.py | 23 ----- ...dicalrecord_options_alter_animal_status.py | 22 ----- ...0004_alter_animal_animal_photo_and_more.py | 36 ------- dragonroost/animals/models.py | 16 --- .../business/migrations/0001_initial.py | 16 ++- .../migrations/0002_meeting_meeting_url.py | 18 ---- .../business/migrations/0003_feedback.py | 23 ----- .../migrations/0004_alter_feedback_name.py | 18 ---- .../0005_alter_meeting_meeting_url.py | 18 ---- .../migrations/0006_alter_meeting_minutes.py | 18 ---- .../migrations/0007_alter_meeting_minutes.py | 18 ---- .../business/migrations/0008_feedback_date.py | 20 ---- .../medical/migrations/0001_initial.py | 7 +- .../0002_alter_medicalupdate_q_staff.py | 21 ---- dragonroost/people/migrations/0001_initial.py | 4 +- dragonroost/people/models.py | 2 +- 20 files changed, 159 insertions(+), 323 deletions(-) create mode 100644 dragonroost/animals/management/commands/add_animals.py delete mode 100644 dragonroost/animals/migrations/0002_medicalrecord_findings_medicalrecord_problem_list.py delete mode 100644 dragonroost/animals/migrations/0003_alter_medicalrecord_options_alter_animal_status.py delete mode 100644 dragonroost/animals/migrations/0004_alter_animal_animal_photo_and_more.py delete mode 100644 dragonroost/business/migrations/0002_meeting_meeting_url.py delete mode 100644 dragonroost/business/migrations/0003_feedback.py delete mode 100644 dragonroost/business/migrations/0004_alter_feedback_name.py delete mode 100644 dragonroost/business/migrations/0005_alter_meeting_meeting_url.py delete mode 100644 dragonroost/business/migrations/0006_alter_meeting_minutes.py delete mode 100644 dragonroost/business/migrations/0007_alter_meeting_minutes.py delete mode 100644 dragonroost/business/migrations/0008_feedback_date.py delete mode 100644 dragonroost/medical/migrations/0002_alter_medicalupdate_q_staff.py diff --git a/dragonroost/__init__.py b/dragonroost/__init__.py index 3da9e5f..0aa9a89 100644 --- a/dragonroost/__init__.py +++ b/dragonroost/__init__.py @@ -1,4 +1,4 @@ -__version__ = "0.1.0" +__version__ = "0.2.0" __version_info__ = tuple( int(num) if num.isdigit() else num for num in __version__.replace("-", ".", 1).split(".") diff --git a/dragonroost/animals/management/commands/add_animals.py b/dragonroost/animals/management/commands/add_animals.py new file mode 100644 index 0000000..d100a45 --- /dev/null +++ b/dragonroost/animals/management/commands/add_animals.py @@ -0,0 +1,88 @@ +import random +import secrets +from os import listdir +from pathlib import Path + +from django.conf import settings +from django.core.management.base import BaseCommand +from faker import Faker +from measurement.measures import Weight + +from dragonroost.animals.models import Animal +from dragonroost.animals.models import MedicalRecord +from dragonroost.animals.models import Species +from dragonroost.business.models import Location +from dragonroost.people.models import Person + +fake = Faker() + +MEDIA_ROOT = settings.MEDIA_ROOT + + +def random_image(): + dir_path = Path(MEDIA_ROOT) / "images/" + files = [ + content for content in listdir(dir_path) if Path(dir_path / content).is_file() + ] + image = random.choice(files) # noqa: S311 + return "images/" + str(image) + + +class Command(BaseCommand): + help = "Create test data for Dragonroost." + + def add_arguments(self, parser): + parser.add_argument( + "-c", + "--count", + type=int, + help="Number of animals to create.", + ) + + def handle(self, *args, **options): + if options["count"]: + self.create_animals(options["count"]) + self.stdout.write(self.style.SUCCESS("Test data created successfully!")) + + def create_animals(self, count): + species = list(Species.objects.all()) + locations = list(Location.objects.all()) + people = list(Person.objects.all()) + names = [fake.unique.first_name() for i in range(200)] + + statuses = [ + "ADOPTED", + "AMBASSADOR", + "AVAILABLE", + "DECEASED", + "FOSTERED", + "MEDICAL_HOLD", + "ON_HOLD", + "QUARANTINE", + ] + + for i in range(count): + animal = Animal.objects.create( + name=names[i], + description=fake.text(max_nb_chars=50), + species=secrets.choice(species), + location=secrets.choice(locations), + color=fake.color(), + donation_fee=random.uniform(5.00, 350.00), # noqa: S311 + age=random.uniform(1, 50), # noqa: S311 + starting_weight=Weight(lb=random.randint(5, 35)), # noqa: S311 + status=secrets.choice(statuses), + animal_photo=random_image(), + ) + animal.save() + record_count = secrets.randbelow(6) + for _i in range(record_count): + medical_record = MedicalRecord.objects.create( + animal=animal, + notes=fake.text(max_nb_chars=50), + treatments=fake.text(max_nb_chars=75), + current_weight=Weight(lb=random.randint(7, 40)), # noqa: S311 + bowel_movement=fake.boolean(chance_of_getting_true=50), + q_volunteer=secrets.choice(people), + ) + medical_record.save() diff --git a/dragonroost/animals/management/commands/add_initial_data.py b/dragonroost/animals/management/commands/add_initial_data.py index bd1b6b2..0cf8687 100644 --- a/dragonroost/animals/management/commands/add_initial_data.py +++ b/dragonroost/animals/management/commands/add_initial_data.py @@ -1,46 +1,39 @@ +import logging import random -import secrets from django.core.management.base import BaseCommand from faker import Faker -from measurement.measures import Weight -from dragonroost.animals.models import Animal -from dragonroost.animals.models import MedicalRecord from dragonroost.animals.models import Species from dragonroost.business.models import Location from dragonroost.people.models import Person +from dragonroost.people.models import Role fake = Faker() +logger = logging.getLogger(__name__) class Command(BaseCommand): help = "Create test data for Dragonroost." - def add_arguments(self, parser): - parser.add_argument( - "--initial", - help="Create initial data before animals can be added.", - ) - parser.add_argument("--animals", type=int, help="Number of animals to create.") - def handle(self, *args, **options): - if options["initial"]: - """ - Create all initial data EXCEPT animals. - """ - self.create_species() - self.create_locations() - if options["animals"]: - self.create_animals(options["animals"]) + self.create_species() + self.create_locations() + self.create_roles() + self.create_people() self.stdout.write(self.style.SUCCESS("Test data created successfully!")) - def create_species(): + def create_species(self): + if Species.objects.all().count() > 0: + return + species_names = [ "Corn Snake", "Red-eared Slider", "Ball Python", "Bearded Dragon", + "Reticulated Python", + "Russian Tortoise", ] for name in species_names: @@ -50,7 +43,10 @@ def create_species(): is_ohio_native=fake.boolean(chance_of_getting_true=25), ) - def create_locations(): + def create_locations(self): + if Location.objects.all().count() > 0: + return + location_names = ["Sales Floor", "Q Room", "Upstairs"] for name in location_names: @@ -59,44 +55,29 @@ def create_locations(): description=fake.text(max_nb_chars=20), ) - def create_animals(self, count): - species = list(Species.objects.all()) - locations = list(Location.objects.all()) - people = list(Person.objects.all()) - names = [fake.unique.first_name() for i in range(200)] - - statuses = [ - "ADOPTED", - "AMBASSADOR", - "AVAILABLE", - "DECEASED", - "FOSTERED", - "MEDICAL_HOLD", - "ON_HOLD", - "QUARANTINE", - ] + def create_roles(self): + if Role.objects.all().count() > 0: + return + + roles = ["Volunteer", "Donor", "Foster", "Adopter"] - for i in range(count): - animal = Animal.objects.create( - name=names[i], + for role in roles: + Role.objects.get_or_create( + name=role, description=fake.text(max_nb_chars=50), - species=secrets.choice(species), - location=secrets.choice(locations), - color=fake.color(), - donation_fee=random.uniform(5.00, 350.00), # noqa: S311 - age=random.uniform(1, 50), # noqa: S311 - starting_weight=Weight(lb=random.randint(5, 35)), # noqa: S311 - status=secrets.choice(statuses), ) - animal.save() - record_count = secrets.randbelow(6) - for _i in range(record_count): - medical_record = MedicalRecord.objects.create( - animal=animal, - notes=fake.text(max_nb_chars=50), - treatments=fake.text(max_nb_chars=75), - current_weight=Weight(lb=random.randint(7, 40)), # noqa: S311 - bowel_movement=fake.boolean(chance_of_getting_true=50), - q_volunteer=secrets.choice(people), - ) - medical_record.save() + + def create_people(self): + person_count = 15 + roles = list(Role.objects.all()) + + for _ in range(person_count): + person = Person.objects.create( + first_name=fake.first_name(), + last_name=fake.last_name(), + notes=fake.text(max_nb_chars=50), + ) + person.roles.set( + random.sample(roles, k=random.randrange(1, len(roles))), # noqa: S311 + ) + person.save() diff --git a/dragonroost/animals/migrations/0001_initial.py b/dragonroost/animals/migrations/0001_initial.py index 3e23e97..1f351aa 100644 --- a/dragonroost/animals/migrations/0001_initial.py +++ b/dragonroost/animals/migrations/0001_initial.py @@ -1,6 +1,8 @@ -# Generated by Django 5.0.9 on 2024-10-22 18:29 +# Generated by Django 5.0.9 on 2024-11-21 19:38 import django.db.models.deletion +import django_measurement.models +import measurement.measures.mass from django.db import migrations, models @@ -43,8 +45,8 @@ class Migration(migrations.Migration): ('color', models.CharField(default='None', max_length=80)), ('sex', models.CharField(choices=[('MALE', 'Male'), ('FEMALE', 'Female'), ('UNKNOWN', 'Unknown')], default='UNKNOWN', max_length=20)), ('age', models.IntegerField(default=0)), - ('starting_weight', models.IntegerField(default=0)), - ('status', models.CharField(choices=[('PENDING', 'Pending'), ('ADOPTABLE', 'Adoptable'), ('QUARANTINED', 'Quarantined'), ('FOSTERED', 'Fostered'), ('MEDICAL_HOLD', 'Medical Hold'), ('ADOPTED', 'Adopted'), ('DECEASED', 'Deceased'), ('AMBASSADOR', 'Ambassador')], default='ADOPTABLE', max_length=80)), + ('starting_weight', django_measurement.models.MeasurementField(measurement=measurement.measures.mass.Mass)), + ('status', models.CharField(choices=[('ADOPTED', 'Adopted'), ('AMBASSADOR', 'Ambassador'), ('AVAILABLE', 'Available'), ('DECEASED', 'Deceased'), ('FOSTERED', 'Fostered'), ('MEDICAL_HOLD', 'Medical Hold'), ('ON_HOLD', 'On Hold'), ('QUARANTINE', 'Quarantine')], default='AVAILABLE', max_length=80)), ('location', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='animals', to='business.location')), ('species', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='animals', to='animals.species')), ], @@ -58,14 +60,17 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('created', models.DateTimeField(auto_now_add=True)), ('notes', models.TextField(blank=True, default='', max_length=500)), - ('current_weight', models.IntegerField(default=0)), + ('current_weight', django_measurement.models.MeasurementField(measurement=measurement.measures.mass.Mass)), ('bowel_movement', models.BooleanField(default=True)), + ('problem_list', models.TextField(blank=True, default='', max_length=500)), + ('findings', models.TextField(blank=True, default='', max_length=500)), ('treatments', models.TextField(blank=True, default='', max_length=500)), ('animal', models.ForeignKey(default=1, on_delete=django.db.models.deletion.CASCADE, related_name='medical_records', to='animals.animal')), ('q_volunteer', models.ForeignKey(default=1, on_delete=django.db.models.deletion.SET_DEFAULT, to='people.person')), ], options={ 'db_table_comment': 'Table holds medical record entries.', + 'ordering': ['created'], }, ), ] diff --git a/dragonroost/animals/migrations/0002_medicalrecord_findings_medicalrecord_problem_list.py b/dragonroost/animals/migrations/0002_medicalrecord_findings_medicalrecord_problem_list.py deleted file mode 100644 index 685b05e..0000000 --- a/dragonroost/animals/migrations/0002_medicalrecord_findings_medicalrecord_problem_list.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 5.0.9 on 2024-10-22 18:42 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('animals', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='medicalrecord', - name='findings', - field=models.TextField(blank=True, default='', max_length=500), - ), - migrations.AddField( - model_name='medicalrecord', - name='problem_list', - field=models.TextField(blank=True, default='', max_length=500), - ), - ] diff --git a/dragonroost/animals/migrations/0003_alter_medicalrecord_options_alter_animal_status.py b/dragonroost/animals/migrations/0003_alter_medicalrecord_options_alter_animal_status.py deleted file mode 100644 index 688d39b..0000000 --- a/dragonroost/animals/migrations/0003_alter_medicalrecord_options_alter_animal_status.py +++ /dev/null @@ -1,22 +0,0 @@ -# Generated by Django 5.0.9 on 2024-11-13 21:27 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('animals', '0002_medicalrecord_findings_medicalrecord_problem_list'), - ] - - operations = [ - migrations.AlterModelOptions( - name='medicalrecord', - options={'ordering': ['created']}, - ), - migrations.AlterField( - model_name='animal', - name='status', - field=models.CharField(choices=[('ON_HOLD', 'On Hold'), ('AVAILABLE', 'Available'), ('QUARANTINE', 'Quarantine'), ('FOSTERED', 'Fostered'), ('MEDICAL_HOLD', 'Medical Hold'), ('ADOPTED', 'Adopted'), ('DECEASED', 'Deceased'), ('AMBASSADOR', 'Ambassador')], default='ADOPTABLE', max_length=80), - ), - ] diff --git a/dragonroost/animals/migrations/0004_alter_animal_animal_photo_and_more.py b/dragonroost/animals/migrations/0004_alter_animal_animal_photo_and_more.py deleted file mode 100644 index 5b4e2d3..0000000 --- a/dragonroost/animals/migrations/0004_alter_animal_animal_photo_and_more.py +++ /dev/null @@ -1,36 +0,0 @@ -# Generated by Django 5.0.9 on 2024-11-20 15:21 - -import django_measurement.models -import dragonroost.animals.models -import measurement.measures.mass -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('animals', '0003_alter_medicalrecord_options_alter_animal_status'), - ] - - operations = [ - migrations.AlterField( - model_name='animal', - name='animal_photo', - field=models.ImageField(blank=True, default=dragonroost.animals.models.random_image, null=True, upload_to='images/'), - ), - migrations.AlterField( - model_name='animal', - name='starting_weight', - field=django_measurement.models.MeasurementField(measurement=measurement.measures.mass.Mass), - ), - migrations.AlterField( - model_name='animal', - name='status', - field=models.CharField(choices=[('ADOPTED', 'Adopted'), ('AMBASSADOR', 'Ambassador'), ('AVAILABLE', 'Available'), ('DECEASED', 'Deceased'), ('FOSTERED', 'Fostered'), ('MEDICAL_HOLD', 'Medical Hold'), ('ON_HOLD', 'On Hold'), ('QUARANTINE', 'Quarantine')], default='AVAILABLE', max_length=80), - ), - migrations.AlterField( - model_name='medicalrecord', - name='current_weight', - field=django_measurement.models.MeasurementField(measurement=measurement.measures.mass.Mass), - ), - ] diff --git a/dragonroost/animals/models.py b/dragonroost/animals/models.py index b51b2ef..99fe21e 100644 --- a/dragonroost/animals/models.py +++ b/dragonroost/animals/models.py @@ -1,10 +1,6 @@ import logging -import random from datetime import timezone -from os import listdir -from pathlib import Path -from django.conf import settings from django.db import models from django.urls import reverse from django_measurement.models import MeasurementField @@ -13,20 +9,9 @@ from dragonroost.business.models import Location from dragonroost.people.models import Person -BASE_DIR = settings.MEDIA_ROOT - logger = logging.getLogger(__name__) -def random_image(): - dir_path = Path(BASE_DIR) / "images/" - files = [ - content for content in listdir(dir_path) if Path(dir_path / content).is_file() - ] - image = random.choice(files) # noqa: S311 - return "images/" + str(image) - - # Create your models here. class Species(models.Model): CLASS_CHOICES = [ @@ -124,7 +109,6 @@ class Animal(models.Model): upload_to="images/", null=True, blank=True, - default=random_image, ) color = models.CharField(max_length=80, null=False, default="None") sex = models.CharField(max_length=20, choices=SEX_CHOICES, default="UNKNOWN") diff --git a/dragonroost/business/migrations/0001_initial.py b/dragonroost/business/migrations/0001_initial.py index c7fa6cf..70b7b3d 100644 --- a/dragonroost/business/migrations/0001_initial.py +++ b/dragonroost/business/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 5.0.9 on 2024-10-22 18:29 +# Generated by Django 5.0.9 on 2024-11-21 19:38 import django.db.models.deletion from django.db import migrations, models @@ -13,6 +13,17 @@ class Migration(migrations.Migration): ] operations = [ + migrations.CreateModel( + name='Feedback', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('name', models.CharField(blank=True, default='', max_length=80)), + ('date', models.DateTimeField(auto_now_add=True)), + ('email_address', models.EmailField(blank=True, max_length=254)), + ('feedback_type', models.CharField(choices=[('SUGGESTION', 'Suggestion'), ('COMPLIMENT', 'Compliment'), ('COMPLAINT', 'Complaint')], default='SUGGESTION', max_length=80)), + ('feedback', models.TextField(blank=True, default='')), + ], + ), migrations.CreateModel( name='Location', fields=[ @@ -27,7 +38,8 @@ class Migration(migrations.Migration): ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('title', models.CharField(max_length=120, unique=True)), ('date', models.DateField(auto_now_add=True)), - ('minutes', models.FileField(upload_to='meetings/%Y')), + ('meeting_url', models.URLField(default='example.com', verbose_name='Meeting URL')), + ('minutes', models.FileField(blank=True, upload_to='meetings/%Y')), ], ), migrations.CreateModel( diff --git a/dragonroost/business/migrations/0002_meeting_meeting_url.py b/dragonroost/business/migrations/0002_meeting_meeting_url.py deleted file mode 100644 index 0f9b5d1..0000000 --- a/dragonroost/business/migrations/0002_meeting_meeting_url.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.0.9 on 2024-10-28 20:32 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('business', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='meeting', - name='meeting_url', - field=models.URLField(default='example.com'), - ), - ] diff --git a/dragonroost/business/migrations/0003_feedback.py b/dragonroost/business/migrations/0003_feedback.py deleted file mode 100644 index 3d30c46..0000000 --- a/dragonroost/business/migrations/0003_feedback.py +++ /dev/null @@ -1,23 +0,0 @@ -# Generated by Django 5.0.9 on 2024-10-28 20:34 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('business', '0002_meeting_meeting_url'), - ] - - operations = [ - migrations.CreateModel( - name='Feedback', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('name', models.CharField(max_length=80, unique=True)), - ('email_address', models.EmailField(blank=True, max_length=254)), - ('feedback_type', models.CharField(choices=[('SUGGESTION', 'Suggestion'), ('COMPLIMENT', 'Compliment'), ('COMPLAINT', 'Complaint')], default='SUGGESTION', max_length=80)), - ('feedback', models.TextField(blank=True, default='')), - ], - ), - ] diff --git a/dragonroost/business/migrations/0004_alter_feedback_name.py b/dragonroost/business/migrations/0004_alter_feedback_name.py deleted file mode 100644 index 5dabfb0..0000000 --- a/dragonroost/business/migrations/0004_alter_feedback_name.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.0.9 on 2024-10-28 20:35 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('business', '0003_feedback'), - ] - - operations = [ - migrations.AlterField( - model_name='feedback', - name='name', - field=models.CharField(blank=True, default='', max_length=80), - ), - ] diff --git a/dragonroost/business/migrations/0005_alter_meeting_meeting_url.py b/dragonroost/business/migrations/0005_alter_meeting_meeting_url.py deleted file mode 100644 index e12e17d..0000000 --- a/dragonroost/business/migrations/0005_alter_meeting_meeting_url.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.0.9 on 2024-10-28 20:41 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('business', '0004_alter_feedback_name'), - ] - - operations = [ - migrations.AlterField( - model_name='meeting', - name='meeting_url', - field=models.URLField(default='example.com', verbose_name='Meeting URL'), - ), - ] diff --git a/dragonroost/business/migrations/0006_alter_meeting_minutes.py b/dragonroost/business/migrations/0006_alter_meeting_minutes.py deleted file mode 100644 index 91e2cfd..0000000 --- a/dragonroost/business/migrations/0006_alter_meeting_minutes.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.0.9 on 2024-10-28 20:44 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('business', '0005_alter_meeting_meeting_url'), - ] - - operations = [ - migrations.AlterField( - model_name='meeting', - name='minutes', - field=models.FileField(null=True, upload_to='meetings/%Y'), - ), - ] diff --git a/dragonroost/business/migrations/0007_alter_meeting_minutes.py b/dragonroost/business/migrations/0007_alter_meeting_minutes.py deleted file mode 100644 index d388e21..0000000 --- a/dragonroost/business/migrations/0007_alter_meeting_minutes.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 5.0.9 on 2024-10-28 20:47 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('business', '0006_alter_meeting_minutes'), - ] - - operations = [ - migrations.AlterField( - model_name='meeting', - name='minutes', - field=models.FileField(blank=True, upload_to='meetings/%Y'), - ), - ] diff --git a/dragonroost/business/migrations/0008_feedback_date.py b/dragonroost/business/migrations/0008_feedback_date.py deleted file mode 100644 index ce49298..0000000 --- a/dragonroost/business/migrations/0008_feedback_date.py +++ /dev/null @@ -1,20 +0,0 @@ -# Generated by Django 5.0.9 on 2024-11-03 14:34 - -import django.utils.timezone -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('business', '0007_alter_meeting_minutes'), - ] - - operations = [ - migrations.AddField( - model_name='feedback', - name='date', - field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now), - preserve_default=False, - ), - ] diff --git a/dragonroost/medical/migrations/0001_initial.py b/dragonroost/medical/migrations/0001_initial.py index f8bd2ab..6da0fe1 100644 --- a/dragonroost/medical/migrations/0001_initial.py +++ b/dragonroost/medical/migrations/0001_initial.py @@ -1,6 +1,7 @@ -# Generated by Django 5.0.9 on 2024-10-22 18:42 +# Generated by Django 5.0.9 on 2024-11-21 19:38 import django.db.models.deletion +from django.conf import settings from django.db import migrations, models @@ -9,7 +10,7 @@ class Migration(migrations.Migration): initial = True dependencies = [ - ('people', '0001_initial'), + migrations.swappable_dependency(settings.AUTH_USER_MODEL), ] operations = [ @@ -20,7 +21,7 @@ class Migration(migrations.Migration): ('title', models.CharField(max_length=120, unique=True)), ('date', models.DateField(auto_now_add=True)), ('notes', models.TextField(blank=True, default='')), - ('q_staff', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='medical_notes', to='people.person')), + ('q_staff', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='medical_notes', to=settings.AUTH_USER_MODEL)), ], ), ] diff --git a/dragonroost/medical/migrations/0002_alter_medicalupdate_q_staff.py b/dragonroost/medical/migrations/0002_alter_medicalupdate_q_staff.py deleted file mode 100644 index b15e806..0000000 --- a/dragonroost/medical/migrations/0002_alter_medicalupdate_q_staff.py +++ /dev/null @@ -1,21 +0,0 @@ -# Generated by Django 5.0.9 on 2024-10-31 22:12 - -import django.db.models.deletion -from django.conf import settings -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('medical', '0001_initial'), - migrations.swappable_dependency(settings.AUTH_USER_MODEL), - ] - - operations = [ - migrations.AlterField( - model_name='medicalupdate', - name='q_staff', - field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='medical_notes', to=settings.AUTH_USER_MODEL), - ), - ] diff --git a/dragonroost/people/migrations/0001_initial.py b/dragonroost/people/migrations/0001_initial.py index 5fb0111..1695b03 100644 --- a/dragonroost/people/migrations/0001_initial.py +++ b/dragonroost/people/migrations/0001_initial.py @@ -1,4 +1,4 @@ -# Generated by Django 5.0.9 on 2024-10-22 18:29 +# Generated by Django 5.0.9 on 2024-11-21 19:38 from django.db import migrations, models @@ -28,7 +28,7 @@ class Migration(migrations.Migration): ('email', models.EmailField(default='donotemail@example.com', max_length=254)), ('phone_number', models.CharField(default='555-5555', max_length=20)), ('address', models.CharField(default='', max_length=250)), - ('zip_code', models.IntegerField(default=44121)), + ('zip_code', models.IntegerField(default=90210)), ('notes', models.TextField(blank=True, default='')), ('roles', models.ManyToManyField(to='people.role')), ], diff --git a/dragonroost/people/models.py b/dragonroost/people/models.py index cf1c449..a26c06c 100644 --- a/dragonroost/people/models.py +++ b/dragonroost/people/models.py @@ -27,7 +27,7 @@ class Person(models.Model): phone_number = models.CharField(max_length=20, default="555-5555") roles = models.ManyToManyField(Role) address = models.CharField(max_length=250, default="") - zip_code = models.IntegerField(default=44121) + zip_code = models.IntegerField(default=90210) notes = models.TextField(blank=True, null=False, default="") def __str__(self):