Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bulk Import Custom Field Update Hotfix #602

Merged
merged 3 commits into from
Sep 20, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions roundabout/admintools/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,11 +492,15 @@ def get_redirect_url(self, *args, **kwargs):
# Create new value object
if col['field_value']:
if custom_field:
fieldvalue = FieldValue.objects.create(field=custom_field,
field_value=col['field_value'],
inventory=inventory_obj,
is_current=True,
user=self.request.user)
fieldvalue = FieldValue.objects.update_or_create(
field=custom_field,
inventory=inventory_obj,
is_current=True,
defaults = {
'field_value': col['field_value'],
'user': self.request.user,
}
)
else:
# Drop any fields that don't match a custom field into a History Note
note_detail = col['field_name'] + ': ' + col['field_value']
Expand Down