Database models all implemented. Migrations made.
This commit is contained in:
parent
f18d36e42d
commit
36252079d7
6 changed files with 183 additions and 6 deletions
16
back/Pipfile.lock
generated
16
back/Pipfile.lock
generated
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"_meta": {
|
||||
"hash": {
|
||||
"sha256": "6fedc9216775508baa2496b59b7cd7e991827db84bd68be0cada8c472f1adabf"
|
||||
"sha256": "a46ef04ffac2e51c6fd60967adce8d1967758dcdfee3fb9804c0b929110c2a92"
|
||||
},
|
||||
"pipfile-spec": 6,
|
||||
"requires": {
|
||||
|
@ -24,12 +24,20 @@
|
|||
"index": "pypi",
|
||||
"version": "==2.1.4"
|
||||
},
|
||||
"gunicorn": {
|
||||
"hashes": [
|
||||
"sha256:723234ea1fa8dff370ab69830ba8bc37469a7cba13fd66055faeef24085e6530",
|
||||
"sha256:813f6916d18a4c8e90efde72f419308b357692f81333cb1125f80013d22fb618"
|
||||
],
|
||||
"index": "pypi",
|
||||
"version": "==19.6.0"
|
||||
},
|
||||
"pytz": {
|
||||
"hashes": [
|
||||
"sha256:31cb35c89bd7d333cd32c5f278fca91b523b0834369e757f4c5641ea252236ca",
|
||||
"sha256:8e0f8568c118d3077b46be7d654cc8167fa916092e28320cde048e54bfc9f1e6"
|
||||
"sha256:32b0891edff07e28efe91284ed9c31e123d84bea3fd98e1f72be2508f43ef8d9",
|
||||
"sha256:d5f05e487007e29e03409f9398d074e158d920d36eb82eaf66fb1136b0c5374c"
|
||||
],
|
||||
"version": "==2018.7"
|
||||
"version": "==2018.9"
|
||||
}
|
||||
},
|
||||
"develop": {}
|
||||
|
|
126
back/backend/migrations/0001_initial.py
Normal file
126
back/backend/migrations/0001_initial.py
Normal file
|
@ -0,0 +1,126 @@
|
|||
# Generated by Django 2.1.4 on 2019-01-20 22:35
|
||||
|
||||
from django.conf import settings
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
|
||||
dependencies = [
|
||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.CreateModel(
|
||||
name='DataBool',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('data', models.BooleanField()),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='DataDate',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('data', models.DateField()),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='DataDecimal',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('data', models.DecimalField(decimal_places=2, max_digits=9)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='DataFile',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('data', models.FileField(upload_to='')),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='DataInteger',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('data', models.IntegerField()),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='DataString',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('data', models.TextField()),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Field',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('label', models.CharField(max_length=256)),
|
||||
('number', models.IntegerField()),
|
||||
('type', models.CharField(max_length=128)),
|
||||
('completed', models.BooleanField()),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Report',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('title', models.CharField(max_length=128)),
|
||||
('date_created', models.DateTimeField(verbose_name='date created')),
|
||||
('date_submitted', models.DateTimeField(verbose_name='date submitted')),
|
||||
('submitted', models.BooleanField()),
|
||||
('user_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
|
||||
],
|
||||
),
|
||||
migrations.CreateModel(
|
||||
name='Section',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('completed', models.BooleanField()),
|
||||
('title', models.CharField(max_length=256)),
|
||||
('html_description', models.TextField()),
|
||||
('number', models.IntegerField()),
|
||||
('report_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='backend.Report')),
|
||||
],
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='field',
|
||||
name='section_id',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='backend.Section'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='datastring',
|
||||
name='field_id',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='backend.Field'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='datainteger',
|
||||
name='field_id',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='backend.Field'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='datafile',
|
||||
name='field_id',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='backend.Field'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='datadecimal',
|
||||
name='field_id',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='backend.Field'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='datadate',
|
||||
name='field_id',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='backend.Field'),
|
||||
),
|
||||
migrations.AddField(
|
||||
model_name='databool',
|
||||
name='field_id',
|
||||
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='backend.Field'),
|
||||
),
|
||||
]
|
0
back/backend/migrations/__init__.py
Normal file
0
back/backend/migrations/__init__.py
Normal file
|
@ -1,4 +1,47 @@
|
|||
from django.db import models
|
||||
from django.contrib.auth.models import User
|
||||
|
||||
# Create your models here.
|
||||
class Report(models.Model):
|
||||
user_id = models.ForeignKey(User, on_delete=models.CASCADE)
|
||||
title = models.CharField(max_length=128)
|
||||
date_created = models.DateTimeField('date created')
|
||||
date_submitted = models.DateTimeField('date submitted')
|
||||
submitted = models.BooleanField()
|
||||
|
||||
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)
|
||||
completed = models.BooleanField()
|
||||
|
||||
class DataBool(models.Model):
|
||||
field_id = models.ForeignKey(Field, on_delete=models.CASCADE)
|
||||
data = models.BooleanField()
|
||||
|
||||
class DataDecimal(models.Model):
|
||||
field_id = models.ForeignKey(Field, on_delete=models.CASCADE)
|
||||
data = models.DecimalField(max_digits=9,decimal_places=2)
|
||||
|
||||
class DataDate(models.Model):
|
||||
field_id = models.ForeignKey(Field, on_delete=models.CASCADE)
|
||||
data = models.DateField()
|
||||
|
||||
class DataFile(models.Model):
|
||||
field_id = models.ForeignKey(Field, on_delete=models.CASCADE)
|
||||
data = models.FileField()
|
||||
|
||||
class DataString(models.Model):
|
||||
field_id = models.ForeignKey(Field, on_delete=models.CASCADE)
|
||||
data = models.TextField()
|
||||
|
||||
class DataInteger(models.Model):
|
||||
field_id = models.ForeignKey(Field, on_delete=models.CASCADE)
|
||||
data = models.IntegerField()
|
||||
|
|
BIN
back/db.sqlite3
BIN
back/db.sqlite3
Binary file not shown.
|
@ -11,5 +11,5 @@ if __name__ == '__main__':
|
|||
"Couldn't import Django. Are you sure it's installed and "
|
||||
"available on your PYTHONPATH environment variable? Did you "
|
||||
"forget to activate a virtual environment?"
|
||||
) from exc
|
||||
)
|
||||
execute_from_command_line(sys.argv)
|
||||
|
|
Loading…
Reference in a new issue