-
Notifications
You must be signed in to change notification settings - Fork 24
Fix for django admin and Account management screen #1160
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -158,14 +158,19 @@ class AjaxFileUploader(FileInput): | |
| initial_text = ugettext_lazy('Currently testing') | ||
| input_text = ugettext_lazy('Change') | ||
| clear_checkbox_label = ugettext_lazy('Clear') | ||
|
|
||
| template_name = '' | ||
| template_with_initial = ( | ||
| '%(initial_text)s: <a href="%(initial_url)s">%(initial)s</a>' | ||
| '%(clear_template)s<br />%(input_text)s: %(input)s %(ajax_uploader)s' | ||
| ) | ||
|
|
||
| template_with_clear = '%(clear)s <label for="%(clear_checkbox_id)s">%(clear_checkbox_label)s</label>' | ||
|
|
||
|
|
||
| def __init__(self, attrs=None): | ||
| super().__init__(attrs) | ||
|
|
||
|
|
||
| def clear_checkbox_name(self, name): | ||
| """ | ||
| Given the name of the file input, return the name of the clear checkbox | ||
|
|
@@ -195,14 +200,14 @@ def get_template_substitution_values(self, value): | |
| #} | ||
|
|
||
|
|
||
| def render(self, name, value, attrs=None): | ||
|
|
||
| substitutions = { | ||
| def render(self, name, value, attrs=None, *args, **kwargs): | ||
| substitutions = self.get_context(name, value, attrs) | ||
| substitutions.update({ | ||
| 'initial_text': self.initial_text, | ||
| 'input_text': self.input_text, | ||
| 'clear_template': '', | ||
| 'clear_checkbox_label': self.clear_checkbox_label, | ||
| } | ||
| }) | ||
|
|
||
| #if 'multiple' in attrs: | ||
| #final_attrs = self.build_attrs(attrs, type=self.input_type, name=name,) | ||
|
Comment on lines
+203
to
213
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Bug: 🔍 Detailed AnalysisThe constant 💡 Suggested FixImport 🤖 Prompt for AI AgentDid we get this right? 👍 / 👎 to inform future reviews. |
||
|
|
||
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.
Bug:
get_template_substitution_values()returnsNone, causingTypeErrorwhensubstitutions.update(None)is called.Severity: CRITICAL | Confidence: High
🔍 Detailed Analysis
When
self.is_initial(value)is true, the code attempts to callsubstitutions.update(self.get_template_substitution_values(value)). However,get_template_substitution_values()is commented out and returnsNone. This leads to aTypeError: 'NoneType' object is not iterable, causing a server crash when rendering forms with existing files.💡 Suggested Fix
Uncomment and implement
get_template_substitution_values()to return a dictionary withinitialandinitial_urlkeys, ensuringsubstitutions.update()receives a valid iterable.🤖 Prompt for AI Agent
Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID:
3430431