localcosmos-app-kit 0.9.13__py3-none-any.whl → 0.9.15__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -916,10 +916,10 @@ class AppReleaseBuilder(AppBuilderBase):
916
916
 
917
917
  # detect duplicates by name
918
918
  all_taxon_profiles = TaxonProfile.objects.filter(taxon_profiles=taxon_profiles)
919
- for taxon_profile in all_taxon_profiles:
919
+ for taxon_profile in all_taxon_profiles:
920
920
  duplicates = TaxonProfile.objects.filter(taxon_profiles=taxon_profiles,
921
921
  taxon_source=taxon_profile.taxon_source, taxon_latname=taxon_profile.taxon_latname,
922
- taxon_author=taxon_profile.taxon_author).exclude(pk=taxon_profile.pk)
922
+ taxon_author=taxon_profile.taxon_author, morphotype=taxon_profile.morphotype).exclude(pk=taxon_profile.pk)
923
923
  if duplicates.exists():
924
924
  warning_message = _('The taxon profile of %(taxon_latname)s has duplicates.') % {
925
925
  'taxon_latname':taxon_profile.taxon_latname}
@@ -69,8 +69,8 @@
69
69
  },
70
70
  "cordova" : {
71
71
  "platforms" : {
72
- "android" : "android@13.0.0",
73
- "ios" : "ios@7.1.0",
72
+ "android" : "android@14.0.1",
73
+ "ios" : "ios@8.0.0",
74
74
  "browser" : "browser@7.0.0"
75
75
  },
76
76
  "plugins" : [
@@ -5,7 +5,7 @@ from django import forms
5
5
 
6
6
  from localcosmos_server.forms import LocalizeableForm
7
7
 
8
- from .models import MatrixFilter
8
+ from .models import MatrixFilter, IDENTIFICATION_MODE_POLYTOMOUS
9
9
  from .matrix_filters import MATRIX_FILTER_TYPES
10
10
 
11
11
  from .forms import is_active_field
@@ -63,6 +63,22 @@ class MatrixFilterManagementForm(LocalizeableForm):
63
63
  raise forms.ValidationError(_('A matrix filter with this name already exists.'))
64
64
 
65
65
  return name
66
+
67
+
68
+ def clean(self):
69
+ cleaned_data = super().clean()
70
+
71
+ identification_mode = self.meta_node.identification_mode
72
+
73
+ if identification_mode == IDENTIFICATION_MODE_POLYTOMOUS and not self.matrix_filter:
74
+
75
+ filter_exists = MatrixFilter.objects.filter(meta_node=self.meta_node).exists()
76
+
77
+ if filter_exists:
78
+ raise forms.ValidationError(_('In polytomous identification mode, only one matrix filter is allowed.'))
79
+
80
+
81
+ return cleaned_data
66
82
 
67
83
 
68
84
  class MatrixFilterManagementFormWithUnit(MatrixFilterManagementForm):
@@ -1130,6 +1130,7 @@ class CrosslinkManager:
1130
1130
 
1131
1131
  is_circular = False
1132
1132
 
1133
+ # you may not link a node to one of its parents
1133
1134
  if crosslink[0].startswith(crosslink[1]):
1134
1135
  is_circular = True
1135
1136
 
@@ -1156,17 +1157,17 @@ class CrosslinkManager:
1156
1157
 
1157
1158
  if is_circular == False:
1158
1159
 
1159
- found_connection = True
1160
-
1161
1160
  for crosslink in crosslinks:
1162
1161
 
1163
1162
  # start a new chain
1164
1163
  chain = [crosslink]
1164
+ found_connection = True
1165
1165
 
1166
1166
  while found_connection == True and is_circular == False:
1167
1167
 
1168
1168
  for crosslink_2 in crosslinks:
1169
1169
 
1170
+ # get the last nuid in the chain, which is a list of 2-tuples
1170
1171
  chain_end = chain[-1][1]
1171
1172
 
1172
1173
  found_connection = False
@@ -1212,6 +1213,8 @@ class NatureGuideCrosslinks(models.Model):
1212
1213
 
1213
1214
  all_crosslinks.append(crosslink_tuple)
1214
1215
 
1216
+ print('Checking crosslinks for circularity:')
1217
+ print(all_crosslinks)
1215
1218
  crosslink_manager = CrosslinkManager()
1216
1219
  is_circular = crosslink_manager.check_circularity(all_crosslinks)
1217
1220
 
@@ -10,15 +10,22 @@
10
10
  {% endblock %}
11
11
 
12
12
  {% block body %}
13
- <p>
14
- <div>
15
- {% render_bootstrap_form form %}
16
- </div>
17
- </p>
18
- {% if success is True %}
19
- <div class="alert alert-success">
20
- {% trans 'Successfully saved matrix filter.' %}
13
+
14
+ {% if adding_allowed == False and not matrix_filter %}
15
+ <div class="alert alert-warning">
16
+ {% trans "In dichotomous or polytomous identification mode, only one matrix filter is allowed." %}
21
17
  </div>
18
+ {% else %}
19
+ <p>
20
+ <div>
21
+ {% render_bootstrap_form form %}
22
+ </div>
23
+ </p>
24
+ {% if success is True %}
25
+ <div class="alert alert-success">
26
+ {% trans 'Successfully saved matrix filter.' %}
27
+ </div>
28
+ {% endif %}
22
29
  {% endif %}
23
30
  {% endblock %}
24
31
 
@@ -819,6 +819,14 @@ class ManageMatrixFilter(FormLanguageMixin, MetaAppMixin, FormView):
819
819
  context['meta_node'] = self.meta_node
820
820
  context['filter_type'] = self.filter_type
821
821
  context['matrix_filter'] = self.matrix_filter
822
+
823
+ adding_allowed = True
824
+ if self.meta_node.identification_mode == IDENTIFICATION_MODE_POLYTOMOUS:
825
+ existing_filters_count = MatrixFilter.objects.filter(meta_node=self.meta_node).count()
826
+ if existing_filters_count >= 1:
827
+ adding_allowed = False
828
+
829
+ context['adding_allowed'] = adding_allowed
822
830
 
823
831
  # fallback
824
832
  verbose_filter_name = self.filter_type
@@ -63,7 +63,7 @@
63
63
  {% endif %}
64
64
  {% endfor %}
65
65
  {% if form.has_categories %}
66
- </div>
66
+ <!--</div>-->
67
67
  {% endif %}
68
68
  </div>
69
69
 
@@ -260,6 +260,7 @@ class TaxonProfilesZipImporter(GenericContentZipImporter):
260
260
 
261
261
 
262
262
  def validate_external_media(self, url, col_letter, row_index):
263
+
263
264
  validator = URLValidator()
264
265
 
265
266
  is_valid = True
@@ -566,6 +567,9 @@ class TaxonProfilesZipImporter(GenericContentZipImporter):
566
567
  elif column_type == ColumnType.EXTERNAL_MEDIA.value:
567
568
 
568
569
  external_media_url = cell_value
570
+
571
+ if not external_media_url:
572
+ continue
569
573
 
570
574
  external_media_data = self.get_external_media_data_from_external_media_sheet(external_media_url)
571
575
 
Binary file