Merge branch 'section-approval'
This commit is contained in:
commit
a7a1a6c5a5
16 changed files with 24 additions and 201 deletions
|
@ -1,5 +1,6 @@
|
||||||
# Generated by Django 2.1.5 on 2019-02-01 00:21
|
# Generated by Django 2.1.7 on 2019-03-03 08:55
|
||||||
|
|
||||||
|
import datetime
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
import django.db.models.deletion
|
import django.db.models.deletion
|
||||||
|
|
||||||
|
@ -16,16 +17,17 @@ class Migration(migrations.Migration):
|
||||||
name='Field',
|
name='Field',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
|
('field_name', models.CharField(default='field', max_length=512)),
|
||||||
('label', models.CharField(max_length=512)),
|
('label', models.CharField(max_length=512)),
|
||||||
('number', models.IntegerField()),
|
('number', models.IntegerField(default=0)),
|
||||||
('type', models.CharField(max_length=128)),
|
('field_type', models.CharField(max_length=128)),
|
||||||
('completed', models.BooleanField(default=False)),
|
('completed', models.BooleanField(default=False)),
|
||||||
('data_bool', models.BooleanField(default=False)),
|
('data_bool', models.BooleanField(default=False)),
|
||||||
('data_decimal', models.DecimalField(blank=True, decimal_places=2, max_digits=9, null=True)),
|
('data_decimal', models.DecimalField(decimal_places=2, default=0, max_digits=9)),
|
||||||
('data_date', models.DateField(blank=True, null=True)),
|
('data_date', models.DateField(blank=True, null=True)),
|
||||||
('data_file', models.FileField(blank=True, max_length=512, null=True, upload_to='uploads/%Y/%m/%d/')),
|
('data_file', models.FileField(blank=True, max_length=512, null=True, upload_to='uploads/%Y/%m/%d/')),
|
||||||
('data_string', models.TextField(default='')),
|
('data_string', models.TextField(blank=True, default='')),
|
||||||
('data_integer', models.IntegerField(blank=True, null=True)),
|
('data_integer', models.IntegerField(blank=True, default=0)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
|
@ -33,21 +35,23 @@ class Migration(migrations.Migration):
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
('title', models.CharField(max_length=128)),
|
('title', models.CharField(max_length=128)),
|
||||||
('date_created', models.DateTimeField(verbose_name='date created')),
|
('date_created', models.DateTimeField(default=datetime.date.today, verbose_name='date created')),
|
||||||
('date_submitted', models.DateTimeField(blank=True, null=True, verbose_name='date submitted')),
|
('date_submitted', models.DateTimeField(default=datetime.date.today, verbose_name='date submitted')),
|
||||||
('submitted', models.BooleanField(default=False)),
|
('submitted', models.BooleanField(default=False)),
|
||||||
|
('reference_number', models.CharField(default='', max_length=32)),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
migrations.CreateModel(
|
migrations.CreateModel(
|
||||||
name='Section',
|
name='Section',
|
||||||
fields=[
|
fields=[
|
||||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||||
('auto_submit', models.BooleanField()),
|
('auto_submit', models.BooleanField(default=False)),
|
||||||
('required', models.BooleanField()),
|
('required', models.BooleanField(default=False)),
|
||||||
('completed', models.BooleanField()),
|
('completed', models.BooleanField(default=False)),
|
||||||
('title', models.CharField(max_length=256)),
|
('title', models.CharField(max_length=256)),
|
||||||
('html_description', models.TextField()),
|
('html_description', models.TextField()),
|
||||||
('number', models.IntegerField()),
|
('number', models.IntegerField()),
|
||||||
|
('approved', models.BooleanField(default=False)),
|
||||||
('report_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='backend.Report')),
|
('report_id', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='backend.Report')),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Generated by Django 2.1.5 on 2019-02-01 00:21
|
# Generated by Django 2.1.7 on 2019-03-03 08:55
|
||||||
|
|
||||||
from django.conf import settings
|
from django.conf import settings
|
||||||
from django.db import migrations, models
|
from django.db import migrations, models
|
||||||
|
@ -10,8 +10,8 @@ class Migration(migrations.Migration):
|
||||||
initial = True
|
initial = True
|
||||||
|
|
||||||
dependencies = [
|
dependencies = [
|
||||||
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
|
||||||
('backend', '0001_initial'),
|
('backend', '0001_initial'),
|
||||||
|
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
|
||||||
]
|
]
|
||||||
|
|
||||||
operations = [
|
operations = [
|
|
@ -1,39 +0,0 @@
|
||||||
# Generated by Django 2.1.5 on 2019-02-01 00:37
|
|
||||||
|
|
||||||
import datetime
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('backend', '0002_auto_20190131_1621'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='field',
|
|
||||||
name='data_date',
|
|
||||||
field=models.DateField(default=datetime.date.today, verbose_name='date'),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='field',
|
|
||||||
name='data_integer',
|
|
||||||
field=models.IntegerField(blank=True, default=0),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='field',
|
|
||||||
name='data_string',
|
|
||||||
field=models.TextField(blank=True, default=''),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='report',
|
|
||||||
name='date_created',
|
|
||||||
field=models.DateTimeField(default=datetime.date.today, verbose_name='date created'),
|
|
||||||
),
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='report',
|
|
||||||
name='date_submitted',
|
|
||||||
field=models.DateTimeField(default=datetime.date.today, verbose_name='date submitted'),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,19 +0,0 @@
|
||||||
# Generated by Django 2.1.5 on 2019-02-01 00:45
|
|
||||||
|
|
||||||
import datetime
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('backend', '0003_auto_20190131_1637'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='field',
|
|
||||||
name='data_date',
|
|
||||||
field=models.DateField(default=datetime.date.today),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,18 +0,0 @@
|
||||||
# Generated by Django 2.1.5 on 2019-02-07 22:02
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('backend', '0004_auto_20190131_1645'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='field',
|
|
||||||
name='field_name',
|
|
||||||
field=models.CharField(default='field', max_length=512),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,18 +0,0 @@
|
||||||
# Generated by Django 2.1.5 on 2019-02-14 01:19
|
|
||||||
|
|
||||||
from django.db import migrations
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('backend', '0005_field_field_name'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.RenameField(
|
|
||||||
model_name='field',
|
|
||||||
old_name='type',
|
|
||||||
new_name='field_type',
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,18 +0,0 @@
|
||||||
# Generated by Django 2.1.5 on 2019-02-14 05:13
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('backend', '0005_field_field_name'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AlterField(
|
|
||||||
model_name='field',
|
|
||||||
name='data_date',
|
|
||||||
field=models.DateField(blank=True, null=True),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,14 +0,0 @@
|
||||||
# Generated by Django 2.1.5 on 2019-02-14 07:18
|
|
||||||
|
|
||||||
from django.db import migrations
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('backend', '0006_auto_20190213_1719'),
|
|
||||||
('backend', '0006_auto_20190213_2113'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
]
|
|
|
@ -1,38 +0,0 @@
|
||||||
# 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),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -1,18 +0,0 @@
|
||||||
# Generated by Django 2.1.7 on 2019-03-01 20:17
|
|
||||||
|
|
||||||
from django.db import migrations, models
|
|
||||||
|
|
||||||
|
|
||||||
class Migration(migrations.Migration):
|
|
||||||
|
|
||||||
dependencies = [
|
|
||||||
('backend', '0008_auto_20190214_1421'),
|
|
||||||
]
|
|
||||||
|
|
||||||
operations = [
|
|
||||||
migrations.AddField(
|
|
||||||
model_name='report',
|
|
||||||
name='reference_number',
|
|
||||||
field=models.CharField(default='', max_length=32),
|
|
||||||
),
|
|
||||||
]
|
|
|
@ -34,6 +34,7 @@ class Section(models.Model):
|
||||||
title = models.CharField(max_length=256)
|
title = models.CharField(max_length=256)
|
||||||
html_description = models.TextField()
|
html_description = models.TextField()
|
||||||
number = models.IntegerField()
|
number = models.IntegerField()
|
||||||
|
approved = models.BooleanField(default=False)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<p>Reference #: {{ reference_number }}</p>
|
<p>Reference #: {{ reference_number }}</p>
|
||||||
{% for section in sections %}
|
{% for section in sections %}
|
||||||
{% if section.completed %}
|
{% if section.completed %}
|
||||||
<h2>{{section.title}}</h2>
|
<h2>{{section.title}} (SID: {{section.id}})</h2>
|
||||||
<table border="1">
|
<table border="1">
|
||||||
{% for field in section.fields %}
|
{% for field in section.fields %}
|
||||||
<tr>
|
<tr>
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
Title: {{title}}
|
Title: {{title}}
|
||||||
Reference #: {{reference_number}}
|
Reference #: {{reference_number}}
|
||||||
{% for section in sections %}
|
{% for section in sections %}
|
||||||
{{section.title}}
|
{{section.title}}(SID: {{section.id}})
|
||||||
{% for field in section.fields %}
|
{% for field in section.fields %}
|
||||||
{{field.label}}: {{field.value|default:"empty"}}
|
{{field.label}}: {{field.value|default:"empty"}}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
|
|
@ -52,7 +52,7 @@ def get_sections(r_id):
|
||||||
# append the fields for corresponding section
|
# append the fields for corresponding section
|
||||||
data.update(get_fields(i.id))
|
data.update(get_fields(i.id))
|
||||||
# process rules from the policy file if the section is completed
|
# process rules from the policy file if the section is completed
|
||||||
if i.completed:
|
if i.completed and not i.approved:
|
||||||
rules = pol.sections[index].rules
|
rules = pol.sections[index].rules
|
||||||
for rule in rules:
|
for rule in rules:
|
||||||
try:
|
try:
|
||||||
|
@ -344,7 +344,7 @@ def section(request, report_pk, section_pk):
|
||||||
}
|
}
|
||||||
data.update(get_fields(s.id))
|
data.update(get_fields(s.id))
|
||||||
# process rules from the policy file if the section is completed
|
# process rules from the policy file if the section is completed
|
||||||
if s.completed:
|
if s.completed and not s.approved:
|
||||||
rules = pol.sections[s.number].rules
|
rules = pol.sections[s.number].rules
|
||||||
for rule in rules:
|
for rule in rules:
|
||||||
try:
|
try:
|
||||||
|
|
BIN
back/db.sqlite3
BIN
back/db.sqlite3
Binary file not shown.
|
@ -1,4 +1,4 @@
|
||||||
# Generated by Django 2.1.5 on 2019-02-01 00:21
|
# Generated by Django 2.1.7 on 2019-03-03 08:55
|
||||||
|
|
||||||
import django.contrib.auth.models
|
import django.contrib.auth.models
|
||||||
import django.contrib.auth.validators
|
import django.contrib.auth.validators
|
||||||
|
@ -34,9 +34,9 @@ class Migration(migrations.Migration):
|
||||||
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
|
('user_permissions', models.ManyToManyField(blank=True, help_text='Specific permissions for this user.', related_name='user_set', related_query_name='user', to='auth.Permission', verbose_name='user permissions')),
|
||||||
],
|
],
|
||||||
options={
|
options={
|
||||||
|
'verbose_name_plural': 'users',
|
||||||
'verbose_name': 'user',
|
'verbose_name': 'user',
|
||||||
'abstract': False,
|
'abstract': False,
|
||||||
'verbose_name_plural': 'users',
|
|
||||||
},
|
},
|
||||||
managers=[
|
managers=[
|
||||||
('objects', django.contrib.auth.models.UserManager()),
|
('objects', django.contrib.auth.models.UserManager()),
|
||||||
|
|
Loading…
Reference in a new issue