Commit 19e924b1 authored by Nicolas Noé's avatar Nicolas Noé
Browse files

Identificator is mandatory again

parent f9262906
......@@ -44,10 +44,9 @@ class Command(BaseCommand):
# Identificators
identified_by = row['Identified_by'].strip()
if identified_by:
id_first_name, id_last_name = identified_by.split()
identificator, _ = Person.objects.get_or_create(first_name=id_first_name, last_name=id_last_name)
specimen.identified_by = identificator
id_first_name, id_last_name = identified_by.split()
identificator, _ = Person.objects.get_or_create(first_name=id_first_name, last_name=id_last_name)
specimen.identified_by = identificator
# Specimen locations
specimen_location, _ = SpecimenLocation.objects.get_or_create(name=row['Specimen_location'])
......
# -*- coding: utf-8 -*-
# Generated by Django 1.11.2 on 2017-06-16 08:26
# Generated by Django 1.11.2 on 2017-06-16 10:52
from __future__ import unicode_literals
import django.contrib.gis.db.models.fields
......@@ -44,7 +44,7 @@ class Migration(migrations.Migration):
('depth', django.contrib.postgres.fields.ranges.FloatRangeField(blank=True, help_text='Unit: meters.', null=True)),
('comment', models.TextField(blank=True, null=True)),
('fixation', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='specimens.Fixation')),
('identified_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='specimens.Person')),
('identified_by', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='specimens.Person')),
],
),
migrations.CreateModel(
......
......@@ -29,7 +29,7 @@ class Specimen(models.Model):
scientific_name = models.CharField(max_length=100)
coords = models.PointField("Coordinates", blank=True, null=True)
depth = FloatRangeField(blank=True, null=True, help_text="Unit: meters.")
identified_by = models.ForeignKey(Person, blank=True, null=True)
identified_by = models.ForeignKey(Person)
specimen_location = models.ForeignKey(SpecimenLocation)
fixation = models.ForeignKey(Fixation, blank=True, null=True)
comment = models.TextField(blank=True, null=True)
......
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