diff --git a/api/migrations/0004_remove_preditctiontemplate_template_data_and_more.py b/api/migrations/0004_remove_preditctiontemplate_template_data_and_more.py new file mode 100644 index 0000000..ef81d05 --- /dev/null +++ b/api/migrations/0004_remove_preditctiontemplate_template_data_and_more.py @@ -0,0 +1,47 @@ +# Generated by Django 4.2.23 on 2025-07-08 10:17 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('api', '0003_prediction_rate_profile_prediction_start_point_and_more'), + ] + + operations = [ + migrations.RemoveField( + model_name='preditctiontemplate', + name='template_data', + ), + migrations.AddField( + model_name='preditctiontemplate', + name='dataset', + field=models.CharField(default='', max_length=50), + ), + migrations.AddField( + model_name='preditctiontemplate', + name='description', + field=models.TextField(blank=True, null=True), + ), + migrations.AddField( + model_name='preditctiontemplate', + name='flight_parameters', + field=models.JSONField(blank=True, default=dict), + ), + migrations.AddField( + model_name='preditctiontemplate', + name='model', + field=models.CharField(default='', max_length=50), + ), + migrations.AddField( + model_name='preditctiontemplate', + name='prediction_mode', + field=models.CharField(default='', max_length=50), + ), + migrations.AddField( + model_name='savedrateprofile', + name='type', + field=models.CharField(default='ascent', max_length=50), + ), + ] diff --git a/api/models.py b/api/models.py index fcbe303..9a331c7 100644 --- a/api/models.py +++ b/api/models.py @@ -58,9 +58,20 @@ class PreditctionTemplate(models.Model): name = models.CharField(max_length=100) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) - template_data = models.JSONField(blank=True, default=dict) is_default = models.BooleanField(default=False) + description = models.TextField(blank=True, null=True) + prediction_mode = models.CharField( + max_length=50, + default="") # TODO: add choices for prediction modes + model = models.CharField( + max_length=50, + default="") # TODO: add choices for models + dataset = models.CharField( + max_length=50, + default="") + flight_parameters = models.JSONField(blank=True, default=dict) + class Meta: unique_together = ('user', 'name') @@ -86,6 +97,8 @@ class SavedRateProfile(models.Model): name = models.CharField(max_length=100) created_at = models.DateTimeField(auto_now_add=True) updated_at = models.DateTimeField(auto_now=True) + type = models.CharField( + max_length=50, default="ascent") # TODO: add choices for rate profile types rate_profile_data = models.JSONField(blank=True, default=dict) is_default = models.BooleanField(default=False) diff --git a/api/serializers.py b/api/serializers.py index 2bf727d..dacdf57 100644 --- a/api/serializers.py +++ b/api/serializers.py @@ -147,14 +147,14 @@ class SavedPointSerializer(serializers.ModelSerializer): class SavedRateProfileSerializer(serializers.ModelSerializer): class Meta: model = SavedRateProfile - fields = ['id', 'name', 'rate_profile_data'] + fields = ['id', 'name', 'type', 'rate_profile_data'] read_only_fields = ['id'] class PreditctionTemplateSerializer(serializers.ModelSerializer): class Meta: model = PreditctionTemplate - fields = ['id', 'name', 'template_data', 'is_default'] + fields = ['id', 'name', 'is_default', 'description', 'prediction_mode', 'model', 'dataset', 'flight_parameters'] read_only_fields = ['id'] diff --git a/testapi/settings.py b/testapi/settings.py index 8dbeac2..0d09485 100644 --- a/testapi/settings.py +++ b/testapi/settings.py @@ -23,7 +23,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent # See https://docs.djangoproject.com/en/5.1/howto/deployment/checklist/ # Environment flag -PRODUCTION = os.getenv('DJANGO_ENV') == 'production' +PRODUCTION = os.getenv('DJANGO_ENV', "") == 'production' # SECURITY WARNING: keep the secret key used in production secret! SECRET_KEY = os.getenv( @@ -104,7 +104,7 @@ ASGI_APPLICATION = 'testapi.asgi.application' # Database # https://docs.djangoproject.com/en/5.1/ref/settings/#databases -if PRODUCTION: +if not PRODUCTION: DATABASES = { 'default': { 'ENGINE': 'django.db.backends.sqlite3',