Conversation
|
@claude /review |
This comment was marked as outdated.
This comment was marked as outdated.
|
@claude /review |
This comment was marked as outdated.
This comment was marked as outdated.
|
@claude /review |
This comment was marked as outdated.
This comment was marked as outdated.
|
@claude /review |
This comment was marked as outdated.
This comment was marked as outdated.
|
@claude /review |
This comment was marked as outdated.
This comment was marked as outdated.
|
@claude /review |
This comment was marked as outdated.
This comment was marked as outdated.
|
@claude /review |
This comment was marked as outdated.
This comment was marked as outdated.
|
@claude /review |
This comment was marked as outdated.
This comment was marked as outdated.
|
@claude /review |
This comment was marked as outdated.
This comment was marked as outdated.
|
@claude /review |
This comment was marked as outdated.
This comment was marked as outdated.
|
@claude /review |
|
Claude finished @bctiemann's task in 2m 51s —— View job Code Review: Polymorphic Object Fields (PR #442)
OverviewThis is a substantial, well-architected feature addition. The PR introduces polymorphic GFK (GenericForeignKey) and polymorphic M2M through-table fields to the plugin's custom object system. The code quality is high, with thorough inline documentation explaining non-obvious design decisions. Below are specific findings. SecurityGitHub Advanced Security Alert — The GHAS alert flagged # serializers.py:106-109
try:
return model_class.objects.get(pk=obj_id)
except (model_class.DoesNotExist, ValueError, TypeError, OverflowError):
raise serializers.ValidationError("No matching object found.") from None
# Consider also catching Exception as a fallback:
except Exception:
raise serializers.ValidationError("Unable to retrieve the specified object.") from NoneBugs1.
This is a minor performance issue, not a correctness bug, but the misleading docstring should be updated. [ 2. When a user fills in multiple type sub-fields for the same GFK (which Design Concerns3. Known limitation: multi-hop polymorphic cycles are undetected (documented in PR description) The 4. The comment explains this is intentional ("keeping serializer generation fresh"). However, this means every API request re-evaluates two 5. The method issues one Code Quality — Positives
Minor Issues6. If a form submission contains a sub-field name that doesn't match the expected 7. For polymorphic fields, the 8. The SummaryThis is a mature, production-quality implementation of a genuinely complex feature. The most actionable items are:
The rest are minor polish items. The PR is well-positioned to merge after addressing the security finding. |
|
arthanson
left a comment
There was a problem hiding this comment.
The caching stuff and extract_cot_id_from_model_name can be separated out into a separate PR as they are functionally separate and would make this very large PR easier to review / more targeted.
suppress_clear_cache is only used in utilities.py and can be a private method. install_clear_cache_suppressor is only Called in init so that code can be separated out into another PR (the stuff in utilities and init).
| ct = ContentType.objects.get(app_label=data["app_label"], model=data["model"]) | ||
| else: | ||
| raise serializers.ValidationError( | ||
| "Must provide content_type_id or (app_label + model)." |
There was a problem hiding this comment.
these should be internationalized
Closes: #31
This PR addresses a major feature addition: polymorphic object/multi-object fields (using a
GenericForeignKeypattern). This means that the related object type for these fields can be any of a selected list, rather than just a single related object type.Editing a custom object with such a field shows an individual field in the edit form for each object type supported by the object/multiobject field, allowing the selection lists to work with existing object-type-based selection lists:
Unit tests have been added covering all UI and API routes, including validating that only the selected related object types can be assigned to the field.
NOTE: