Skip to content

Commit

Permalink
Merge pull request #668 from upconsulting/bug/IEXP-271
Browse files Browse the repository at this point in the history
[IEXP-271] check if property is in property list of an element before…
  • Loading branch information
jdamerow authored Nov 26, 2020
2 parents 5e6a1db + 3610940 commit 95c470e
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion isiscb/curation/taskslib/authority_tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,9 @@ def update_elements(file_path, error_path, task_id, user_id):
field_to_change, new_value = _find_value(field_to_change, new_value, element)

# check if field to change is a ManyToManyField (IEXP-232)
if isinstance(element.__class__.__dict__[field_to_change], models.fields.related_descriptors.ManyToManyDescriptor):
# if class is a subclass, this won't work, but we only have Person so far that Subclasses
# Authority, which doesn't have any many to many relationships
if field_to_change in element.__class__.__dict__ and isinstance(element.__class__.__dict__[field_to_change], models.fields.related_descriptors.ManyToManyDescriptor):
# all this is really ugly, but we have to store the old list for the
# administrator notes
old_value = element.__getattribute__(field_to_change).all()
Expand Down

0 comments on commit 95c470e

Please sign in to comment.