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

Batch Edit: Use scoped picklist for formatting in batch edit #6344

Merged
merged 1 commit into from
Mar 20, 2025
Merged
Show file tree
Hide file tree
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
3 changes: 3 additions & 0 deletions specifyweb/specify/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,5 +94,8 @@ def get_picklists(collection: spmodels.Collection, tablename: str, fieldname: st
picklists = None
if len(schema_items) > 0 and schema_items[0].picklistname:
picklists = spmodels.Picklist.objects.filter(name=schema_items[0].picklistname)
collection_picklists = picklists.filter(collection=collection)
if len(collection_picklists) > 0:
picklists = collection_picklists

return picklists, schemaitem
11 changes: 2 additions & 9 deletions specifyweb/workbench/upload/scoping.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,15 +116,8 @@ def extend_columnoptions(
toOne = toOne or {}
picklists, schemaitem = get_picklists(collection, tablename, fieldname)

if not picklists:
picklist = None
else:
collection_picklists = picklists.filter(collection=collection)

picklist = (
picklists[0] if len(collection_picklists) == 0 else collection_picklists[0]
)

# Picklists are already scoped by collection in get_picklists if possible
picklist = None if picklists is None else picklists[0]

ui_formatter = get_or_defer_formatter(collection, tablename, fieldname, row, toOne, context)
scoped_formatter = (
Expand Down
Loading