[Django] #33784: Formats should not be escaped in admin calendar widget.

0 views
Skip to first unread message

Django

unread,
Jun 14, 2022, 12:51:43 AM6/14/22
to django-...@googlegroups.com
#33784: Formats should not be escaped in admin calendar widget.
--------------------------------------------+---------------------------
Reporter: Mariusz Felisiak | Owner: Ankur Roy
Type: Bug | Status: assigned
Component: contrib.admin | Version: 4.0
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Needs documentation: 0 | Needs tests: 0
Patch needs improvement: 0 | Easy pickings: 0
UI/UX: 0 |
--------------------------------------------+---------------------------
Replacements were added in fa0653cd1d791a8bce835e8992cbeab6fd70d0e7 where
we created a callback function by concatenating strings. It's unnecessary
and buggy since d638cdc42acec608c1967f44af6be32a477c239f.

--
Ticket URL: <https://code.djangoproject.com/ticket/33784>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 14, 2022, 12:53:41 AM6/14/22
to django-...@googlegroups.com
#33784: Formats should not be escaped in admin calendar widget.
----------------------------------+--------------------------------------

Reporter: Mariusz Felisiak | Owner: Ankur Roy
Type: Bug | Status: assigned
Component: contrib.admin | Version: 4.0
Severity: Normal | Resolution:

Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------

Comment (by Mariusz Felisiak):

Ankur, would you like to prepare a patch? and drop these replacements,
e.g.
{{{#!diff
diff --git
a/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js
b/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js
index ea8c155d74..aa1cae9eeb 100644
--- a/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js
+++ b/django/contrib/admin/static/admin/js/admin/DateTimeShortcuts.js
@@ -387,13 +387,7 @@
DateTimeShortcuts.calendars[num].drawNextMonth();
},
handleCalendarCallback: function(num) {
- let format = get_format('DATE_INPUT_FORMATS')[0];
- // the format needs to be escaped a little
- format = format.replace('\\', '\\\\')
- .replace('\r', '\\r')
- .replace('\n', '\\n')
- .replace('\t', '\\t')
- .replace("'", "\\'");
+ const format = get_format('DATE_INPUT_FORMATS')[0];
return function(y, m, d) {
DateTimeShortcuts.calendarInputs[num].value = new Date(y,
m - 1, d).strftime(format);
DateTimeShortcuts.calendarInputs[num].focus()
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33784#comment:1>

Django

unread,
Jun 14, 2022, 3:12:57 AM6/14/22
to django-...@googlegroups.com
#33784: Formats should not be escaped in admin calendar widget.
----------------------------------+--------------------------------------
Reporter: Mariusz Felisiak | Owner: Ankur Roy
Type: Bug | Status: assigned
Component: contrib.admin | Version: 4.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------
Changes (by David Wobrock):

* cc: David Wobrock (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/33784#comment:2>

Django

unread,
Jun 14, 2022, 3:32:10 AM6/14/22
to django-...@googlegroups.com
#33784: Formats should not be escaped in admin calendar widget.
----------------------------------+--------------------------------------
Reporter: Mariusz Felisiak | Owner: Ankur Roy
Type: Bug | Status: assigned
Component: contrib.admin | Version: 4.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+--------------------------------------

Comment (by Ankur Roy):

Yes, I would. Thank you.

--
Ticket URL: <https://code.djangoproject.com/ticket/33784#comment:3>

Django

unread,
Jun 14, 2022, 4:36:57 AM6/14/22
to django-...@googlegroups.com
#33784: Formats should not be escaped in admin calendar widget.
----------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: Ankur Roy
Type: Bug | Status: assigned
Component: contrib.admin | Version: 4.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
----------------------------------+-------------------------------------
Changes (by Carlton Gibson):

* stage: Unreviewed => Accepted


--
Ticket URL: <https://code.djangoproject.com/ticket/33784#comment:4>

Django

unread,
Jun 14, 2022, 7:11:44 AM6/14/22
to django-...@googlegroups.com
#33784: Formats should not be escaped in admin calendar widget.
----------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: Ankur Roy
Type: Bug | Status: assigned
Component: contrib.admin | Version: 4.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
----------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* easy: 0 => 1


--
Ticket URL: <https://code.djangoproject.com/ticket/33784#comment:5>

Django

unread,
Jun 18, 2022, 2:15:21 PM6/18/22
to django-...@googlegroups.com
#33784: Formats should not be escaped in admin calendar widget.
-------------------------------------+-------------------------------------

Reporter: Mariusz Felisiak | Owner: Ankur Roy
Type: Bug | Status: assigned
Component: contrib.admin | Version: 4.0
Severity: Normal | Resolution:
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak):

* has_patch: 0 => 1
* stage: Accepted => Ready for checkin


Comment:

[https://github.com/django/django/pull/15780 PR]

--
Ticket URL: <https://code.djangoproject.com/ticket/33784#comment:6>

Django

unread,
Jun 18, 2022, 4:28:00 PM6/18/22
to django-...@googlegroups.com
#33784: Formats should not be escaped in admin calendar widget.
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: Ankur Roy
Type: Bug | Status: closed
Component: contrib.admin | Version: 4.0
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------
Changes (by Mariusz Felisiak <felisiak.mariusz@…>):

* status: assigned => closed
* resolution: => fixed


Comment:

In [changeset:"d19a53d8e3640e8f937048bf7826c7e2229a9665" d19a53d8]:
{{{
#!CommitTicketReference repository=""
revision="d19a53d8e3640e8f937048bf7826c7e2229a9665"
Fixed #33784 -- Removed unnecessary format escaping in admin calendar
widget.

Replacements were added in fa0653cd1d791a8bce835e8992cbeab6fd70d0e7
where we created a callback function by concatenating strings. It's

unnecessary since d638cdc42acec608c1967f44af6be32a477c239f.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33784#comment:7>

Django

unread,
Jun 18, 2022, 4:29:27 PM6/18/22
to django-...@googlegroups.com
#33784: Formats should not be escaped in admin calendar widget.
-------------------------------------+-------------------------------------
Reporter: Mariusz Felisiak | Owner: Ankur Roy
Type: Bug | Status: closed
Component: contrib.admin | Version: 4.0
Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Ready for
| checkin
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 1 | UI/UX: 0
-------------------------------------+-------------------------------------

Comment (by Mariusz Felisiak <felisiak.mariusz@…>):

In [changeset:"5197014eff14c5744e56138e8d22cd571676f838" 5197014]:
{{{
#!CommitTicketReference repository=""
revision="5197014eff14c5744e56138e8d22cd571676f838"
[4.1.x] Fixed #33784 -- Removed unnecessary format escaping in admin
calendar widget.

Replacements were added in fa0653cd1d791a8bce835e8992cbeab6fd70d0e7
where we created a callback function by concatenating strings. It's
unnecessary since d638cdc42acec608c1967f44af6be32a477c239f.

Backport of d19a53d8e3640e8f937048bf7826c7e2229a9665 from main
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/33784#comment:8>

Reply all
Reply to author
Forward
0 new messages