diff --git a/bims/enums/ecosystem_type.py b/bims/enums/ecosystem_type.py index 90765e838..28e2344ee 100644 --- a/bims/enums/ecosystem_type.py +++ b/bims/enums/ecosystem_type.py @@ -7,3 +7,13 @@ (ECOSYSTEM_WETLAND, ECOSYSTEM_WETLAND), (ECOSYSTEM_OPEN_WATERBODY, ECOSYSTEM_OPEN_WATERBODY) ) + +HYDROPERIOD_INUNDATED = 'Inundated' +HYDROPERIOD_SATURATED = 'Saturated at surface' +HYDROPERIOD_DRY = 'Dry at surface' + +HYDROPERIOD_CHOICES = ( + (HYDROPERIOD_INUNDATED, HYDROPERIOD_INUNDATED), + (HYDROPERIOD_SATURATED, HYDROPERIOD_SATURATED), + (HYDROPERIOD_DRY, HYDROPERIOD_DRY), +) diff --git a/bims/migrations/0345_biologicalcollectionrecord_hydroperiod_and_more.py b/bims/migrations/0345_biologicalcollectionrecord_hydroperiod_and_more.py new file mode 100644 index 000000000..9b6d3435e --- /dev/null +++ b/bims/migrations/0345_biologicalcollectionrecord_hydroperiod_and_more.py @@ -0,0 +1,25 @@ +# Generated by Django 4.1.10 on 2023-08-24 07:37 + +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('bims', '0344_alter_bimsdocument_authors_notification'), + ] + + operations = [ + migrations.AddField( + model_name='biologicalcollectionrecord', + name='hydroperiod', + field=models.CharField(blank=True, choices=[('Inundated', 'Inundated'), ('Saturated at surface', 'Saturated at surface'), ('Dry at surface', 'Dry at surface')], default='', max_length=255), + ), + migrations.AlterField( + model_name='notification', + name='name', + field=models.CharField(choices=[('SITE_VISIT_VALIDATION', 'Site visit is ready to be validated'), ('SITE_VALIDATION', 'Site is ready to be validated'), ('DOWNLOAD_REQUEST', 'Download request notification'), ('ACCOUNT_CREATED', 'Account created email notification'), ('SASS_CREATED', 'SASS created email notification'), ('NEW_TAXONOMY', 'New taxonomy email notification')], max_length=255, unique=True), + ), + ] diff --git a/bims/migrations/0346_alter_bimsdocument_authors_and_more.py b/bims/migrations/0346_alter_bimsdocument_authors_and_more.py new file mode 100644 index 000000000..7706d2194 --- /dev/null +++ b/bims/migrations/0346_alter_bimsdocument_authors_and_more.py @@ -0,0 +1,20 @@ +# Generated by Django 4.1.10 on 2023-08-24 08:12 + +from django.conf import settings +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ('bims', '0345_biologicalcollectionrecord_hydroperiod_and_more'), + ] + + operations = [ + migrations.AlterField( + model_name='biologicalcollectionrecord', + name='hydroperiod', + field=models.CharField(blank=True, choices=[('Inundated', 'Inundated'), ('Saturated at surface', 'Saturated at surface'), ('Dry at surface', 'Dry at surface')], default='', max_length=255, null=True), + ), + ] diff --git a/bims/models/biological_collection_record.py b/bims/models/biological_collection_record.py index 2f0d4a364..4a352c39e 100644 --- a/bims/models/biological_collection_record.py +++ b/bims/models/biological_collection_record.py @@ -20,7 +20,9 @@ from bims.enums.taxonomic_group_category import TaxonomicGroupCategory from bims.models.bims_document import BimsDocument from bims.models.survey import Survey -from bims.enums.ecosystem_type import ECOSYSTEM_TYPE_CHOICES +from bims.enums.ecosystem_type import ( + ECOSYSTEM_TYPE_CHOICES, HYDROPERIOD_CHOICES +) from td_biblio.models import Entry @@ -268,6 +270,14 @@ class BiologicalCollectionRecord(AbstractValidation): blank=True ) + hydroperiod = models.CharField( + max_length=255, + choices=HYDROPERIOD_CHOICES, + blank=True, + null=True, + default='' + ) + biotope = models.ForeignKey( 'bims.Biotope', null=True, diff --git a/bims/templates/collections_form_page.html b/bims/templates/collections_form_page.html index 44300b032..8e498fb84 100644 --- a/bims/templates/collections_form_page.html +++ b/bims/templates/collections_form_page.html @@ -167,10 +167,25 @@

Add {{ taxon_group_name }} data for site {% if location_site_code %}{{ locat value="{{ user.id }}"> + {% if location_site.ecosystem_type == 'Wetland' %} +
+ +
+ +
+
+ {% endif %}
+ Biotope / Habitat
+ + {% for hydroperiod_tuple in hydroperiod_choices %} + + {% endfor %} + +
+
+ {% endif %}
+ Biotope / Habitat
+ + {% for hydroperiod_tuple in hydroperiod_choices %} + + {% endfor %} + +
+
+ {% endif %}
+ Biotope / Habitat