Commit Graph

1948 Commits

Author SHA1 Message Date
Jon Dufresne 60db8b7b37 Removed unnecessary admin CSS.
The "object-tools" container is never rendered as a descendant of
.form-row.

The "golink" CSS class is unused.

A <label> element has not been included in the login .submit-row since
5869afe32b.

The "help" CSS class from login.css has been unused since
0e5faf225c.

The <label> color in login.css is already inherited from the <body>
element and so does not need to be re-specified.

The #content-main container already has the property 'width: 100%' from
base.css and so does not need to be re-specified in login.css.

The <td> and <th> font-family property is inherited from the <body>
element and so does not need to be re-specified.

The <html> element has the attribute dir which automatically sets
the text direction in the layout. Adding the direction CSS property was
necessary to support IE which does not support the dir attribute, but IE
is no longer supported, so drop the direction property.

The 'font-size: 1em' property re-specifies the same font size. It
creates no visual difference.

The 'font-size: 14px' property often re-specifies the inherited value.
Avoid re-specifying it.
2020-06-25 11:46:05 +02:00
Hasan Ramezani fbe82f8255 Refs #26761 -- Removed extra space in admin change list result header. 2020-06-25 06:33:12 +02:00
Jon Dufresne 30e59705fc Fixed #31523 -- Removed jQuery dependency from actions.js. 2020-06-24 11:54:48 +02:00
Alix 26a413507a Fixed #6933 -- Added support for searching against quoted phrases in ModelAdmin.search_fields. 2020-06-18 20:17:20 +02:00
Adam Johnson fcdac3787d
Removed unused HTML class flex from admin changelist.
Unused since 233708fb68.
2020-06-04 11:25:19 +02:00
Collin Anderson 4ae9a2b18e Fixed #31641 -- Improved loading of navigation sidebar in admin. 2020-06-03 13:04:54 +02:00
Jon Dufresne 2dd4d110c1 Fixed CVE-2020-13596 -- Fixed potential XSS in admin ForeignKeyRawIdWidget. 2020-06-03 09:23:00 +02:00
Carles Pina e46c2326c8 Fixed #31536 -- Fixed rendering of disabled AdminFileWidget and ClearableFileInput. 2020-06-01 12:25:25 +02:00
Jon Dufresne 3bc4240d97 Removed unused admin:jsi18n <script> element from change_password.html.
The view does not contain any other JavaScript and therefore does not
have any user facing JavaScript strings to translate. Avoid the HTTP
request.
2020-05-28 15:21:47 +02:00
Tom Carrick 780473d756 Refs #31034 -- Improved accessibility of admin navigation sidebar. 2020-05-28 10:16:20 +02:00
Scott Cranfill 62f1655a64 Fixed #11157 -- Stopped removing stop words in admin's prepopulated_fields.
Co-Authored-By: Andy Chosak <andy@chosak.org>
2020-05-27 12:32:56 +02:00
Hasan Ramezani 18759b2209 Fixed #31616 -- Added hint about middleware ordering for SessionMiddleware admin check. 2020-05-25 21:14:32 +02:00
Fran Hrzenjak 4484bc1b2f Fixed #31597, #31603 -- Corrected admin clear all filters link behavior.
- Show "Clear all filters" only when any filter is selected.
- Preserve query string not related with filters.

Co-Authored-By: Hasan Ramezani <hasan.r67@gmail.com>
2020-05-20 21:08:47 +02:00
Jon Dufresne e46f700e39 Refs #31034 -- Used === in nav_sidebar.js admin JS to avoid possible coercion issues. 2020-05-18 07:42:44 +02:00
kjpc-tech 099bce1bf0 Fixed #31590 -- Fixed ModelAdmin.date_hierarchy crash with an empty QuerySet.
Regression in 55cdf6c52d.
2020-05-15 06:35:10 +02:00
Jon Dufresne 81ffedaacc Fixed #31524 -- Removed minified static assets from the admin. 2020-05-14 16:07:56 +02:00
Jon Dufresne d522b51c40 Fixed #31575 -- Added system check for admin sidebar request context processor dependency.
Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
2020-05-14 11:00:51 +02:00
Jon Dufresne 0a627dbe73
Removed unused Downcoder.chars.
Unused -- other than as a local variable -- since its introduction in
953badbea5
2020-05-13 21:07:14 +02:00
Mariusz Felisiak 0668164b4a
Fixed E128, E741 flake8 warnings. 2020-05-12 08:52:23 +02:00
Claude Paroz e6ec76d245
Updated JS admin translation catalog. 2020-05-11 22:59:27 +02:00
Claude Paroz 33f26339b7
Updated source translation catalogs. 2020-05-11 21:34:46 +02:00
Tom Carrick 46fe506445 Corrected indentation of #main div in admin base template. 2020-05-11 18:16:38 +02:00
Tom Carrick d24ba1be7a Fixed #31034 -- Added a navigation sidebar to the admin.
Co-authored-by: elky <elky@users.noreply.github.com>
Co-authored-by: Goetz <goetz.buerkle@gmail.com>
2020-05-11 18:16:38 +02:00
Jon Dufresne d6aff369ad Refs #30116 -- Simplified regex match group access with Match.__getitem__().
The method has been available since Python 3.6. The shorter syntax is
also marginally faster.
2020-05-11 12:01:28 +02:00
dbxnr fc0f7f6c15 Fixed #31157 -- Fixed displaying read-only JSONField values in admin. 2020-05-08 09:44:42 +02:00
Jon Dufresne 6137ec2bf2
Changed selected attribute to HTML5 boolean syntax in SelectBox.js.
Per MDN, HTMLOptionElement.selected is a Boolean attribute.
2020-05-08 06:02:42 +02:00
Jon Dufresne 3c5a586ce9 Fixed #31542 -- Simplified admin JavaScript with "for … of" statements. 2020-05-07 18:09:32 +02:00
Mariusz Felisiak aff7a58aef
Updated admin's Select2 to 4.0.13. 2020-05-05 11:30:02 +02:00
Mariusz Felisiak 30083e0780 Fixed #31485 -- Updated admin's jQuery to 3.5.1. 2020-05-05 11:00:05 +02:00
Jon Dufresne f2051eb8a7
Removed invalid value from admin CSS.
The keyword value 'none' is not a valid value for padding-bottom.
2020-05-05 07:01:06 +02:00
Jon Dufresne e972752504
Removed unused CSS in admin.
.system-message, .system-message-title are unused since their
introduction in ce0d0cd9e2.
.float-right, .float-left, .align-left, .align-right, and .example are
unused since 6eb4f25692.
2020-05-01 07:00:00 +02:00
Jon Dufresne 448cdde935
Removed CSS workarounds for IE7 in admin. 2020-05-01 06:33:24 +02:00
Jon Dufresne 29e35b9a3e
Refs #31032 -- Removed unnecessary vendor prefixes from admin CSS.
The CSS properties have been standardized and are available in all
supported browsers.
2020-05-01 06:26:36 +02:00
Jon Dufresne 5869afe32b Removed unnecessary &nbsp; entities from the admin.
Normal spaces are fine when used as a single spaced separation. For
larger spacing, CSS is used.
2020-04-29 11:40:24 +02:00
Jon Dufresne 7271c8def4 Refs #31493 -- Changed IIFE to ES6 blocks. 2020-04-29 10:22:41 +02:00
Jon Dufresne 5d37cc703b Fixed #31493 -- Replaced var with const and let keywords in JavaScript.
The eslint configuration and the admin script compress.py have been
updated for ES6.

The unused fallback of globals.django in jquery.init.js was removed. It
is always included before jsi18n-mocks.test.js and it always sets the
global value.
2020-04-29 10:22:41 +02:00
Jon Dufresne 0dafadadb9 Refs #30400 -- Improved typography of user facing strings in admin changelist. 2020-04-29 07:01:46 +02:00
François Freitag 9ef4a18dbe Changed django.forms.ValidationError imports to django.core.exceptions.ValidationError.
Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-04-28 10:49:00 +02:00
François Freitag abea86f9e4 Removed unnecessary tuple wrapping of single format string argument. 2020-04-27 08:30:16 +02:00
Jon Dufresne f48a1990fb
Made compress.py script use the official google-closure-compiler release.
The script previously used the PyPI package closure, which is slightly
out of date and not maintained by Google.

The JavaScript contribution docs and the compress.py script now runs the
google-closure-compiler package in the recommended way. Google's
documentation on usage and installation can be found at:

https://github.com/google/closure-compiler-npm/tree/master/packages/google-closure-compiler#usage

This also makes the usage simpler as the package now runs through npm's
npx utility, which will automatically install google-closure-compiler to
a per-user cache.
2020-04-22 16:19:27 +02:00
Jon Dufresne f27482f147 Fixed #31483 -- Rewrote change_form.js without jQuery.
The use of $(document).ready() was removed. The script is loaded at the
end of the document. Therefore, the referenced DOM elements are already
available and the script does not need to wait for the full DOM to be
ready before continuing.

Now that the script has no external dependencies, it can be loaded
asynchronously. As such, the async attribute was added to the script
element.
2020-04-22 15:44:55 +02:00
Jon Dufresne a8bb53dbd2 Refs #31483 -- Removed CSS and JavaScript for unused HTML class add-another.
The HTML class was removed in 07988744b3.
As such, the CSS and JavaScript is unused.
2020-04-22 15:44:55 +02:00
Mariusz Felisiak fb9b1c245d
Updated admin's XRegExp to 3.2.0. 2020-04-22 08:45:14 +02:00
Jon Dufresne 0f2885e3f6
Simplified collapse.js with Element.closest(). 2020-04-22 06:13:58 +02:00
hashlash dfbd9ca065 Fixed #30311 -- Restored ability to override global admin actions. 2020-04-17 20:23:00 +02:00
Hasan Ramezani 96c6f9c61c Fixed #31441 -- Ensured TabluarInline expands when child inputs have errors. 2020-04-16 12:17:49 +02:00
Hasan Ramezani b4e7bf5284 Refs #31441 -- Added red border to inputs with errors for TabluarInline. 2020-04-16 12:17:49 +02:00
Nick Pope daabb102c0 Fixed #31470 -- Fixed fieldset admin CSS to prevent overflowing <pre> elements.
Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-04-16 10:47:42 +02:00
007 d51c50d836 Fixed #31462 -- Allowed overriding autocomplete/raw_id_fields/filter widgets for ManyToManyFields with formfield_overrides. 2020-04-15 08:33:40 +02:00
zriv b9336b78cf Fixed #31404 -- Changed selector-chosen's multiple attribute to HTML5 boolean syntax. 2020-03-27 08:38:58 +01:00
Hasan Ramezani 55cdf6c52d Fixed #29724 -- Fixed timezone handling in ModelAdmin.date_hierarchy queries.
Thanks Alexander Holmbäck for the initial patch.
2020-03-25 21:03:41 +01:00
Jon Dufresne be648d1c45 Fixed #31391 -- Removed jQuery usage in cancel.js
Now that cancel.js has no dependencies, it can be loaded asynchronously.

Co-Authored-By: François Freitag <mail@franek.fr>
2020-03-24 11:09:29 +01:00
Jon Dufresne 3a807a6f59 Fixed #31365 -- Removed jQuery usage in SelectFilter2.js. 2020-03-24 09:14:22 +01:00
Jon Dufresne f982f0bdb8
Refs #31032 -- Removed unsupported browsers workarounds and comments in admin's JavaScript.
Since 8b30360322, the admin documentation
is explicit that only modern evergreen browsers are supported. This
allows removing several long standing workarounds for IE and Opera older
versions.

Since 2013, Opera is based on the Chromium blink engine.
2020-03-23 06:19:10 +01:00
Jon Dufresne 25d450c852 Removed unused return values in SelectFilter2.js. 2020-03-17 13:52:29 +01:00
Jon Dufresne 9cf4e40b84 Simplified SelectFilter2 with Element.closest().
https://developer.mozilla.org/en-US/docs/Web/API/Element/closest
2020-03-17 12:04:14 +01:00
Jon Dufresne 3857a08bdb Fixed #31361 -- Fixed invalid action="" in admin forms.
The attribute action="" (empty string) on the <form> element is invalid
HTML5. The spec (https://html.spec.whatwg.org/#attr-fs-action) says:

> The action and formaction content attributes, if specified, must have
> a value that is a valid non-empty URL potentially surrounded by
> spaces.

Emphasis on non-empty. The action attribute is allowed to be omitted, in
which case the current URL is used which is the same behavior as now.
2020-03-16 07:31:19 +01:00
Jon Dufresne eb77e80de0 Fixed #31349 -- Used :nth-child() CSS pseudo-class to style alternative rows in admin. 2020-03-09 12:34:32 +01:00
007gzs a4881f5e5d Fixed #31307 -- Fixed filter_horizontal add/remove SVG :hover positioning. 2020-02-27 15:39:13 +01:00
Fabio Sangiovanni b457068cf2 Fixed #31187 -- Fixed detecting of existing total ordering in admin changelist when using Meta.constraints.
Detection of existing total ordering in admin changelist now takes into
account non-partial unique constraints.
2020-02-19 09:36:23 +01:00
Nick Pope 335c9c94ac Simplified imports from django.db and django.contrib.gis.db. 2020-02-04 13:20:06 +01:00
Claude Paroz 5dabb6002e Updated translations from Transifex.
Forwardport of ca4f87027e from stable/3.0.x
2020-01-31 20:59:10 +01:00
Mariusz Felisiak b7a3a6c9ef
Used model's Options.label/label_lower where applicable. 2020-01-29 12:09:20 +01:00
Hasan Ramezani 5d654e1e71 Refs #27888 -- Removed redundant {% if %} in admin changelist filters. 2020-01-24 20:31:09 +01:00
Hasan Ramezani b94764e178 Fixed #27888 -- Added link to clear all filters in the admin changelist view. 2020-01-23 14:14:54 +01:00
Daniel Hahler 68e018010b Optimized ModelAdmin._changeform_view() by avoiding multiple get_fieldsets() calls.
Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
2020-01-17 16:00:04 +01:00
Owen T. Heisler 77d335e5ab Fixed #31160 -- Fixed admin CSS for ordered lists' descendants in unordered list. 2020-01-13 09:13:33 +01:00
Adam Donaghy 8b3e714ecf Fixed #30980 -- Improved error message when checking uniqueness of admin actions' __name__.
Thanks Keshav Kumar for the initial patch.
2020-01-10 14:00:28 +01:00
Federico Jaramillo Martínez 372eaa395f Fixed #28991 -- Added EmptyFieldListFilter class in admin.filters.
Thanks Simon Charette and Carlton Gibson for reviews.

Co-Authored-By: Jonas Haag <jonas@lophus.org>
Co-Authored-By: Christophe Baldy <christophe.baldy@polyconseil.fr>
2020-01-03 07:58:04 +01:00
Sjbrgsn b2bd08bb7a Fixed #30892 -- Fixed slugify() and admin's URLify.js for "İ".
Thanks Luis Nell for the implementation idea and very detailed report.

Co-Authored-By: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2019-12-30 20:47:22 +01:00
Farhaan Bukhsh cf5d4701dc Fixed #30819 -- Fixed year determination in admin calendar widget for two-digit years.
Two-digit years in the range of [00, 68] are in the current century,
while [69,99] are in the previous century, according to the Open Group
Specification.
2019-12-30 13:06:29 +01:00
Mike Hansen 35d36d9462 Refs #30585 -- Updated project templates and tests to use (block)translate tags. 2019-12-18 13:15:38 +01:00
Jon Dufresne e703b93a65 Fixed #31080 -- Removed redundant type="text/javascript" attribute from <script> tags. 2019-12-11 09:49:54 +01:00
Jon Dufresne 65285d1e7d Refs #29892 -- Made Selenium tests wait for popups to be ready. 2019-12-02 15:06:36 +01:00
Carlton Gibson 6376278a90 Updated contrib translations from Transifex.
Forward port of 4afa0e5d2a from stable/3.0.x
2019-12-02 11:25:23 +01:00
Carlton Gibson 11c5e0609b Fixed CVE-2019-19118 -- Required edit permissions on parent model for editable inlines in admin.
Thank you to Shen Ying for reporting this issue.
2019-12-02 08:56:08 +01:00
Jon Dufresne 46a0edc3ba Fixed #31028 -- Used classList API to check, add and remove DOM classes.
Thanks to Claude Paroz for review.
2019-11-28 15:21:37 +01:00
Jon Dufresne c8bd37a860 Fixed #31042 -- Removed AdminSeleniumTestCase.get_css_value() in favor of Selenium .is_displayed().
All instances of AdminSeleniumTestCase.get_css_value() were used to
inspect the display property.
2019-11-28 15:10:13 +01:00
Johannes Hoppe 249a6190ae Fixed #30975 -- Replaced custom get_select_option with Selenium's select_by_value. 2019-11-27 16:34:07 +01:00
Johannes Hoppe 69dbb6b708 Fixed #30973 -- Converted selenium tests wait_page_loaded to context manager. 2019-11-27 14:36:26 +01:00
Jon Dufresne cab3661832 Fixed #31027 -- Replaced .getAttribute()/.setAttribute() usage with DOM properties. 2019-11-27 07:53:04 +01:00
Baptiste Mispelon 52936eface Fixed #31031 -- Fixed data loss in admin changelist view when formset's prefix contains regex special chars.
Regression in b18650a263.
2019-11-26 08:48:10 +01:00
Johannes Hoppe ef93fd4683 Fixed #31013 -- Removed jQuery usage in SelectBox.js. 2019-11-25 13:35:20 +01:00
Hasan Ramezani 0284a26af9 Fixed #30981 -- Fixed admin changelist crash when using F() or OrderBy() expressions in admin_order_field. 2019-11-19 15:40:04 +01:00
Daniel Izquierdo 89abecc75d Fixed #27272 -- Added an on_delete RESTRICT handler to allow cascading deletions while protecting direct ones. 2019-11-19 10:55:05 +01:00
Mariusz Felisiak 4c45b627f8 Removed unused import of ACTION_CHECKBOX_NAME in django.contrib.admin.
Unused since e651b3095c.
2019-11-06 12:49:42 +01:00
Jon Dufresne b9fe7f9294 Fixed #30947 -- Changed tuples to lists in model Meta options in django.contrib modules.
The Django "Model Meta options" docs provide examples and generally
point the reader to use lists for the unique_together and ordering
options. Follow our own advice for contrib models.

More generally, lists should be used for homogeneous sequences of
arbitrary lengths of which both unique_together and ordering are.
2019-11-05 08:16:31 +01:00
Jon Dufresne 607004f81a Simplified consecutive calls to pathlib.Path.parent. 2019-11-04 09:59:34 +01:00
Erwin Junge a6cb8ec389 Fixed #30922 -- Fixed ModelAdmin.date_hierarchy queries with DST changes.
There was an issue where admin date_hierarchy didn't render last day of
a month in DST-switch month.
2019-10-29 11:21:03 +01:00
Hasan Ramezani e3d0b4d550 Fixed #30899 -- Lazily compiled import time regular expressions. 2019-10-29 09:22:26 +01:00
Carlton Gibson 24e540fbd7 Fixed #29087 -- Added delete buttons for unsaved admin inlines on validation error. 2019-10-25 13:28:08 +02:00
Carlton Gibson 6ea3aadd17 Refs #29087 -- Refactored admin inlines.js.
Split logic into separate functions to clarify and allow reuse.
2019-10-25 13:28:08 +02:00
Simon Charette 26c66f4519 Fixed #30856 -- Combined fast-delete queries by model during cascade deletion.
Reduced the number of queries required when performing cascade deletion
for a model referenced multiple time by another one by performing an
union of reference lookups.
2019-10-09 09:49:53 +02:00
Min ho Kim b1d6b35e14 Fixed #30725 -- Fixed width of DateTimeField inputs in admin tabular inline.
"width" of DateTimeField inputs in admin tabular inline wasn't set
correctly what caused displaying too small inputs with responsive CSS
when timezone warning wasn't present.
2019-09-17 14:30:33 +02:00
Hasan Ramezani b9db423d3c Fixed #29376 -- Allowed hiding "Save and Add Another" button in admin. 2019-09-16 11:37:09 +02:00
Claude Paroz 5495ea3ae0 Updated translation catalogs 2019-09-08 17:35:32 +02:00
Jon Dufresne a44d80f88e Adjusted subprocess.run() calls to use arg list, rather than string.
The Python docs recommend passing a sequence to subprocess.run() when
possible. Doing so allows for automatic escaping and quoting of
arguments.

https://docs.python.org/3/library/subprocess.html#frequently-used-arguments

> args is required for all calls and should be a string, or a sequence
> of program arguments. Providing a sequence of arguments is generally
> preferred, as it allows the module to take care of any required
> escaping and quoting of arguments (e.g. to permit spaces in file
> names).

Also removed `shell=True` where unnecessary.
2019-08-28 10:19:30 +02:00
Federico Jaramillo Martínez 8f6860863e Fixed #30722 -- Added default rate-limiting requests to admin's Select2 widget. 2019-08-27 13:47:36 +02:00
Dulmandakh 06372a8d27 Fixed #30507 -- Updated admin's jQuery to 3.4.1. 2019-08-23 11:00:16 +02:00
Claude Paroz 9386586f31 Replaced subprocess commands by run() wherever possible. 2019-08-23 10:53:36 +02:00