Set section boolean values to default to False, and set field numerical values to default to 0.

This commit is contained in:
kououken 2019-02-14 14:23:05 -08:00
parent f95bd9ecee
commit 4704b86f2a
3 changed files with 43 additions and 5 deletions

View file

@ -0,0 +1,38 @@
# Generated by Django 2.1.5 on 2019-02-14 22:21
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('backend', '0007_merge_20190213_2318'),
]
operations = [
migrations.AlterField(
model_name='field',
name='data_decimal',
field=models.DecimalField(decimal_places=2, default=0, max_digits=9),
),
migrations.AlterField(
model_name='field',
name='number',
field=models.IntegerField(default=0),
),
migrations.AlterField(
model_name='section',
name='auto_submit',
field=models.BooleanField(default=False),
),
migrations.AlterField(
model_name='section',
name='completed',
field=models.BooleanField(default=False),
),
migrations.AlterField(
model_name='section',
name='required',
field=models.BooleanField(default=False),
),
]

View file

@ -15,9 +15,9 @@ class Report(models.Model):
class Section(models.Model):
report_id = models.ForeignKey(Report, on_delete=models.CASCADE)
auto_submit = models.BooleanField()
required = models.BooleanField()
completed = models.BooleanField()
auto_submit = models.BooleanField(default=False)
required = models.BooleanField(default=False)
completed = models.BooleanField(default=False)
title = models.CharField(max_length=256)
html_description = models.TextField()
number = models.IntegerField()
@ -29,11 +29,11 @@ class Field(models.Model):
section_id = models.ForeignKey(Section, on_delete=models.CASCADE)
field_name = models.CharField(max_length=512, default="field")
label = models.CharField(max_length=512)
number = models.IntegerField()
number = models.IntegerField(default=0)
field_type = models.CharField(max_length=128)
completed = models.BooleanField(default=False)
data_bool = models.BooleanField(default=False)
data_decimal = models.DecimalField(max_digits=9, decimal_places=2, null=True, blank=True)
data_decimal = models.DecimalField(max_digits=9, decimal_places=2, default=0)
data_date = models.DateField(null=True, blank=True)
data_file = models.FileField(upload_to='uploads/%Y/%m/%d/', max_length=512, null=True, blank=True)
data_string = models.TextField(default='', blank=True)

Binary file not shown.