2019-01-20 06:39:07 +00:00
|
|
|
from django.db import models
|
2019-01-23 00:38:09 +00:00
|
|
|
from django.conf import settings
|
2019-01-20 06:39:07 +00:00
|
|
|
|
2019-01-20 22:39:11 +00:00
|
|
|
class Report(models.Model):
|
2019-01-23 00:38:09 +00:00
|
|
|
user_id = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
|
2019-01-20 22:39:11 +00:00
|
|
|
title = models.CharField(max_length=128)
|
|
|
|
date_created = models.DateTimeField('date created')
|
2019-01-23 00:38:09 +00:00
|
|
|
date_submitted = models.DateTimeField('date submitted', null=True, blank=True)
|
|
|
|
submitted = models.BooleanField(default=False)
|
2019-01-20 06:39:07 +00:00
|
|
|
|
2019-01-20 22:39:11 +00:00
|
|
|
class Section(models.Model):
|
|
|
|
report_id = models.ForeignKey(Report, on_delete=models.CASCADE)
|
|
|
|
completed = models.BooleanField()
|
|
|
|
title = models.CharField(max_length=256)
|
|
|
|
html_description = models.TextField()
|
|
|
|
number = models.IntegerField()
|
|
|
|
|
|
|
|
class Field(models.Model):
|
|
|
|
section_id = models.ForeignKey(Section, on_delete=models.CASCADE)
|
|
|
|
label = models.CharField(max_length=256)
|
|
|
|
number = models.IntegerField()
|
|
|
|
type = models.CharField(max_length=128)
|
2019-01-23 00:38:09 +00:00
|
|
|
completed = models.BooleanField(default=False)
|
2019-01-20 22:39:11 +00:00
|
|
|
|
|
|
|
class DataBool(models.Model):
|
|
|
|
field_id = models.ForeignKey(Field, on_delete=models.CASCADE)
|
2019-01-23 00:38:09 +00:00
|
|
|
data = models.BooleanField(default=False)
|
2019-01-20 22:39:11 +00:00
|
|
|
|
|
|
|
class DataDecimal(models.Model):
|
|
|
|
field_id = models.ForeignKey(Field, on_delete=models.CASCADE)
|
2019-01-23 00:38:09 +00:00
|
|
|
data = models.DecimalField(max_digits=9,decimal_places=2, null=True, blank=True)
|
2019-01-20 22:39:11 +00:00
|
|
|
|
|
|
|
class DataDate(models.Model):
|
|
|
|
field_id = models.ForeignKey(Field, on_delete=models.CASCADE)
|
2019-01-23 00:38:09 +00:00
|
|
|
data = models.DateField(null=True, blank=True)
|
2019-01-20 22:39:11 +00:00
|
|
|
|
|
|
|
class DataFile(models.Model):
|
|
|
|
field_id = models.ForeignKey(Field, on_delete=models.CASCADE)
|
2019-01-23 00:38:09 +00:00
|
|
|
data = models.FileField(null=True, blank=True)
|
|
|
|
|
2019-01-20 22:39:11 +00:00
|
|
|
class DataString(models.Model):
|
|
|
|
field_id = models.ForeignKey(Field, on_delete=models.CASCADE)
|
2019-01-23 00:38:09 +00:00
|
|
|
data = models.TextField(default='')
|
2019-01-20 22:39:11 +00:00
|
|
|
|
|
|
|
class DataInteger(models.Model):
|
|
|
|
field_id = models.ForeignKey(Field, on_delete=models.CASCADE)
|
2019-01-23 00:38:09 +00:00
|
|
|
data = models.IntegerField(null=True, blank=True)
|