-
-
Notifications
You must be signed in to change notification settings - Fork 143
Add support for dynamic setting of attributes from context based on #151 #152
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
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for dynamically setting widget attributes from the rendering context based on #151.
- Introduces a mechanism to merge a dynamically resolved dictionary into the attributes via the special key "attr_dict".
- Refactors the handling of boolean and "type" attribute values during rendering.
Files not reviewed (1)
- README.rst: Language not supported
if v: | ||
if isinstance(v, bool): | ||
bounded_field = set_attr(bounded_field, f"{k}") | ||
if k == "type": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The current conditional structure may result in duplicate attribute assignments for non-'type' keys with boolean values. Consider restructuring the conditionals using if-elif-else to ensure that each attribute is processed only once.
if k == "type": | |
elif k == "type": |
Copilot uses AI. Check for mistakes.
|
||
.. code-block:: html+django | ||
|
||
context_dict_var = {"type":"text", id="my_username_id", placeholder="Login"} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this correct? If this is a Python dict then shouldn't it be:
context_dict_var = {"type":"text", id="my_username_id", placeholder="Login"} | |
context_dict_var = {"type":"text", "id": "my_username_id", "placeholder: "Login"} |
@maximbelyayev sorry for the delay in the review, would you happen to have the opportunity to look into the review notes? |
No description provided.