Commit df7fbd86 authored by Joern jkuensem's avatar Joern jkuensem

Task LSMR-23: Process review

parent 53fdbf82
......@@ -4245,7 +4245,7 @@ SAS/LSMR/src/lsmr/lsmrapp/__init__.py -text
SAS/LSMR/src/lsmr/lsmrapp/admin.py -text
SAS/LSMR/src/lsmr/lsmrapp/apps.py -text
SAS/LSMR/src/lsmr/lsmrapp/migrations/0001_initial.py -text
SAS/LSMR/src/lsmr/lsmrapp/migrations/0002_auto_20180905_1530.py -text
SAS/LSMR/src/lsmr/lsmrapp/migrations/0002_auto_20180910_0928.py -text
SAS/LSMR/src/lsmr/lsmrapp/migrations/0003_populate.py -text
SAS/LSMR/src/lsmr/lsmrapp/migrations/CMakeLists.txt -text
SAS/LSMR/src/lsmr/lsmrapp/migrations/__init__.py -text
......
# Generated by Django 2.0.6 on 2018-09-05 15:30
# Generated by Django 2.0.6 on 2018-09-10 09:28
import django.contrib.postgres.fields
import django.contrib.postgres.fields.jsonb
......@@ -35,7 +35,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='CopyReasonChoice',
fields=[
('value', models.CharField(editable=False, max_length=30, primary_key=True, serialize=False, unique=True)),
('value', models.CharField(max_length=30, primary_key=True, serialize=False, unique=True)),
],
options={
'abstract': False,
......@@ -59,7 +59,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='DataformatChoice',
fields=[
('value', models.CharField(editable=False, max_length=30, primary_key=True, serialize=False, unique=True)),
('value', models.CharField(max_length=30, primary_key=True, serialize=False, unique=True)),
],
options={
'abstract': False,
......@@ -115,7 +115,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='DatatypeChoice',
fields=[
('value', models.CharField(editable=False, max_length=30, primary_key=True, serialize=False, unique=True)),
('value', models.CharField(max_length=30, primary_key=True, serialize=False, unique=True)),
],
options={
'abstract': False,
......@@ -238,7 +238,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='RoleChoice',
fields=[
('value', models.CharField(editable=False, max_length=30, primary_key=True, serialize=False, unique=True)),
('value', models.CharField(max_length=30, primary_key=True, serialize=False, unique=True)),
],
options={
'abstract': False,
......@@ -314,7 +314,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='StationTypeChoice',
fields=[
('value', models.CharField(editable=False, max_length=30, primary_key=True, serialize=False, unique=True)),
('value', models.CharField(max_length=30, primary_key=True, serialize=False, unique=True)),
],
options={
'abstract': False,
......@@ -360,7 +360,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='TaskStateChoice',
fields=[
('value', models.CharField(editable=False, max_length=30, primary_key=True, serialize=False, unique=True)),
('value', models.CharField(max_length=30, primary_key=True, serialize=False, unique=True)),
],
options={
'abstract': False,
......@@ -387,7 +387,7 @@ class Migration(migrations.Migration):
migrations.CreateModel(
name='TaskTypeChoice',
fields=[
('value', models.CharField(editable=False, max_length=30, primary_key=True, serialize=False, unique=True)),
('value', models.CharField(max_length=30, primary_key=True, serialize=False, unique=True)),
],
options={
'abstract': False,
......@@ -586,7 +586,7 @@ class Migration(migrations.Migration):
migrations.AddField(
model_name='task',
name='requested_state',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='task_requested_states', to='lsmrapp.TaskStateChoice'),
field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='task_requested_states', to='lsmrapp.TaskStateChoice'),
),
migrations.AddField(
model_name='task',
......
......@@ -6,7 +6,7 @@ from ..populate import *
class Migration(migrations.Migration):
dependencies = [
('lsmrapp', '0002_auto_20180905_1530'),
('lsmrapp', '0002_auto_20180910_0928'),
]
operations = [ migrations.RunPython(populate_choices) ]
......@@ -97,7 +97,7 @@ class Task(BasicCommon):
start_time = DateTimeField()
stop_time = DateTimeField()
state = ForeignKey('TaskStateChoice', null=False, on_delete=PROTECT, related_name='task_states') # set CANCELLED or ERROR instead?
requested_state = ForeignKey('TaskStateChoice', null=False, on_delete=CASCADE, related_name='task_requested_states') # set CANCELLED or ERROR instead?
requested_state = ForeignKey('TaskStateChoice', null=False, on_delete=PROTECT, related_name='task_requested_states') # set CANCELLED or ERROR instead?
specification = JSONField()
work_request_blueprint = ForeignKey('WorkRequestBlueprint', null=True, on_delete=SET_NULL)
template = ForeignKey('TaskTemplate', null=False, on_delete=CASCADE)
......
......@@ -70,7 +70,7 @@ class AbstractChoice(Model):
You can find the derived AbstractChoice classes being used as ForeignKey in other models, thus enforcing data
consistency at database level.
"""
value = CharField(max_length=30, editable=False, null=False, blank=False, unique=True, primary_key=True)
value = CharField(max_length=30, editable=True, null=False, blank=False, unique=True, primary_key=True)
class Meta:
abstract = True
......
......@@ -12,19 +12,19 @@ class TaskIORoleSerializer(serializers.HyperlinkedModelSerializer):
fields = '__all__'
class TaskStateChoiceSerializer(serializers.HyperlinkedModelSerializer):
class TaskStateChoiceSerializer(serializers.ModelSerializer):
class Meta:
model = models.TaskStateChoice
fields = '__all__'
class TaskTypeChoiceSerializer(serializers.HyperlinkedModelSerializer):
class TaskTypeChoiceSerializer(serializers.ModelSerializer):
class Meta:
model = models.TaskTypeChoice
fields = '__all__'
class StationTypeChoiceSerializer(serializers.HyperlinkedModelSerializer):
class StationTypeChoiceSerializer(serializers.ModelSerializer):
class Meta:
model = models.StationTypeChoice
fields = '__all__'
......
......@@ -80,6 +80,8 @@ router.register(r'station_type_choice', viewsets.StationTypeChoiceViewSet)
router.register(r'task_io_role', viewsets.TaskIORoleViewSet)
router.register(r'task_template', viewsets.TaskTemplateViewSet)
router.register(r'dataproduct_specification_template', viewsets.DataproductSpecificationTemplateViewSet)
router.register(r'default_task_template', viewsets.DefaultTaskTemplateViewSet)
router.register(r'default_dataproduct_specification_template', viewsets.DefaultDataproductSpecificationTemplateViewSet)
# instances
router.register(r'task', viewsets.TaskViewSet)
......
......@@ -55,7 +55,7 @@ def _call_API_and_assert_expected_response(self, url, call, data, expected_code,
raise ValueError("The provided call '%s' is not a valid API method choice" % call)
if response.status_code != expected_code:
print("!!! Unexpected: [%s] - %s %s: %s" % (self.id(), call, url, response.content))
print("!!! Unexpected: [%s] - %s %s: %s" % (self.id(), call, url, response.content.decode('utf-8').strip()))
self.assertEqual(response.status_code, expected_code)
r_dict = json.loads(response.content.decode('utf-8'))
for item in expected_content.items():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment