Commit Graph

428 Commits

Author SHA1 Message Date
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 505fec6bad Capitalized Unicode in docs, strings, and comments. 2020-04-20 12:10:33 +02: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
Alexander Holmbäck e43c34d10d Added tests for date_hierarchy template tag with models.DateTimeField. 2020-03-25 21:03:23 +01:00
Carlton Gibson 39e1c88de6
Fixed intermittent SeleniumTests.test_prepopulated_fields failure.
Element would occasionally be outside of frame.
2020-03-25 09:58:57 +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 b7093860df Added novalidate HTML attribute to ModelAdmin.add_view() and change_view() tests. 2020-03-16 06:36:45 +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
Matthijs Kooijman 2a2ea4ee18 Refs #31117 -- Made various tests properly handle unexpected databases aliases.
- Used selected "databases" instead of django.db.connections.
- Made routers in tests.migrations skip migrations on unexpected
  databases.
- Added DiscoverRunnerGetDatabasesTests.assertSkippedDatabases() hook
  which properly asserts messages about skipped databases.
2020-01-20 14:39:02 +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
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 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
Carlton Gibson c33eb6dcd0
Fixed #29892 -- Added explicit Selenium wait in admin autocomplete tests. 2019-11-29 14:03:22 +01:00
Jon Dufresne 875e3ff4fd Fixed #29892 -- Added .wait_page_loaded() in SeleniumTests.test_first_field_focus(). 2019-11-28 11:22:19 +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
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
Hasan Ramezani b9db423d3c Fixed #29376 -- Allowed hiding "Save and Add Another" button in admin. 2019-09-16 11:37:09 +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
Johannes Hoppe 00d4e6f8b5 Updated Select2 to version 4.0.7. 2019-07-10 12:31:16 +02:00
Min ho Kim fbb83fefd4 Fixed typos in comments and docs. 2019-07-02 09:36:17 +02:00
Mariusz Felisiak 8fc8c958a5
Fixed broken selenium tests after 42b9a23267. 2019-06-30 20:35:05 +02:00
Jon Dufresne 42b9a23267 Fixed #30400 -- Improved typography of user facing strings.
Thanks Claude Paroz for assistance with translations.
2019-06-28 16:46:18 +02:00
Sanyam Khurana 87f5d07eed Fixed #12952 -- Adjusted admin log change messages to use form labels instead of field names. 2019-06-14 18:20:29 +02:00
Mariusz Felisiak 7cbcf2e2cb
Fixed #30259 -- Fixed crash of admin views when properties don't have admin_order_field attribute. 2019-04-01 15:11:54 +02:00
Jani Tiainen 044cc54420
Fixed #30259 -- Added support for admin_order_field attribute on properties in ModelAdmin.list_display. 2019-03-24 20:43:56 +01:00
Etienne Chové 4dcbe6eb2d Fixed #30221 -- Made label suffix of admin's read-only fields translatable. 2019-02-28 11:12:30 -05:00
Tim Graham 92d4d0859a Refs #21221 -- Removed staticfiles and admin_static template tag libraries.
Per deprecation timeline.
2019-01-17 10:52:19 -05:00
Arthur Rio 181fb60159 Fixed #11154, #22270 -- Made proxy model permissions use correct content type.
Co-Authored-By: Simon Charette <charette.s@gmail.com>
Co-Authored-By: Antoine Catton <acatton@fusionbox.com>
2019-01-16 10:07:28 -05:00
Simon Charette 8c775391b7 Refs #28478 -- Deprecated TestCase's allow_database_queries and multi_db in favor of databases. 2019-01-10 19:11:21 -05:00
Tim Graham 0004daa536
Used 4 space hanging indent for dictionaries.
Thanks Mariusz Felisiak for auditing.
2019-01-02 18:18:19 -05:00
Tim Graham 02c07be95c Fixed #30050 -- Fixed InlineModelAdmin.has_change_permission() called with non-None obj during add.
Thanks andreage for the report and suggested fix.
2019-01-01 09:42:14 -05:00
Tim Graham 043bd70942 Updated test URL patterns to use path() and re_path(). 2018-12-31 10:47:32 -05:00
Matt Wiens e817ae74da Followed style guide for model attribute ordering. 2018-12-27 19:34:14 -05:00
Manan 3a4558b84f Moved choices inside of test models per coding style. 2018-12-10 09:28:49 -05:00
Carlton Gibson 8245c99ee6
Fixed #29930 -- Allowed editing in admin with view-only inlines.
Co-authored-by: Tim Graham <timograham@gmail.com>
2018-12-03 07:44:18 -08:00
Basil Dubyk 7d1123e5ad Fixed #29929 -- Fixed admin view-only change form crash when using ModelAdmin.prepopulated_fields. 2018-11-28 15:40:14 -05:00
Simon Charette 0f212db29d Made reused RequestFactory instances class attributes. 2018-11-27 09:49:02 -05:00
Simon Charette 7f63b894c0 Adjusted code style of a few test data setup methods.
Thanks Mariusz for suggesting it.
2018-11-27 09:48:22 -05:00
Simon Charette 84e7a9f4a7 Switched setUp() to setUpTestData() where possible in Django's tests. 2018-11-27 09:35:17 -05:00
Tim Graham 405ec5b9c6 Fixed typo in tests/admin_views/tests.py. 2018-11-16 15:09:22 -05:00
Sergey Fedoseev 747db4018b Simplified AdminFieldExtractionMixin.get_admin_form_fields(). 2018-09-25 11:06:41 -04:00
Tim Graham d311124be5 Fixed #29682 -- Fixed admin change form crash if a view-only model's form has an extra field. 2018-08-20 11:14:20 -04:00
Jon Dufresne 09ee3b6fe3 Fixed #29663 -- Made admin change view redirect to changelist with view permission. 2018-08-17 11:13:06 -04:00
Jon Dufresne f5e7506cff Refs #27804 -- Used subTest in AdminViewPermissionsTest. 2018-08-12 21:27:19 -04:00
luz.paz 97e637a87f Fixed typos in comments and docs. 2018-08-01 16:09:22 -04:00
Claude Paroz 0adfba968e Fixed #29578 -- Made numberformat.format() honor forced l10n usage.
Thanks Sassan Haradji for the report.
2018-07-19 16:44:40 -04:00
Tim Graham 5d98d53fab Refs #27398 -- Simplified some tests with assertRedirects(). 2018-06-20 14:08:56 -04:00
Carlton Gibson 5b73317181 Fixed #29502 -- Allowed users with the view permission to use autocomplete_fields. 2018-06-18 15:36:20 -04:00
Carlton Gibson 958c7b301e Fixed #29419 -- Allowed permissioning of admin actions. 2018-06-18 15:07:29 -04:00
Paulo 553617e613 Fixed #29487 -- Accounted for object level permissions when calculating change view's read-only fields.
Thanks Matthew Frazier for the report and fix.
2018-06-15 21:54:22 -04:00
Ramiro Morales f40e71a957 Fixed #29417 -- Corrected two admin page titles for view-only users. 2018-05-23 11:02:37 -04:00
olivierdalang 825f0beda8 Fixed #8936 -- Added a view permission and a read-only admin.
Co-authored-by: Petr Dlouhy <petr.dlouhy@email.cz>
Co-authored-by: Olivier Dalang <olivier.dalang@gmail.com>
2018-05-16 06:44:55 -04:00
Tim Graham 49a1736c2e Added assertion for admin change form's "save and continue editing" message. 2018-05-15 20:17:02 -04:00
Morgan Aubert 704443acac Fixed #29363 -- Added SimpleTestCase.assertWarnsMessage(). 2018-05-09 11:40:28 -04:00
Claude Paroz 607970f31c Replaced django.test.utils.patch_logger() with assertLogs().
Thanks Tim Graham for the review.
2018-05-07 09:34:00 -04:00
Faheel Ahmad 5d4d62bf4f Fixed #29248 -- Renamed admin CSS class field-box to fieldBox. 2018-04-05 10:55:36 -04:00
Jon Dufresne 167d98528a Refs #27728 -- Fixed BytesWarning in admin_views tests. 2018-04-03 10:11:35 -04:00
Tim Graham 5fa4f40f45 Fixed #29227 -- Allowed BooleanField to be null=True.
Thanks Lynn Cyrin for contributing to the patch, and Nick Pope for review.
2018-03-20 12:10:10 -04:00
Mariusz Felisiak 362813d628
Fixed hanging indentation in various code. 2018-03-16 10:54:34 +01:00
Josh Schneier b60e5fdbb7 Fixed #28959 -- Fixed 'No, take me back' button on admin's inline popup. 2018-03-15 20:47:18 -04:00
Tim Graham 4c02e3cda3 Refs #27728 -- Made cosmetic edits to admin template tag template overriding. 2018-03-01 11:45:08 -05:00
Raffaele Salmaso 5cc28dc752 Fixed #27728 -- Allowed overriding admin templatetags templates. 2018-02-28 08:49:40 +01:00
Becky Smith 8116e588db Fixed #17962 -- Added ModelAdmin.get_deleted_objects(). 2018-02-24 20:41:43 -05:00
Tim Graham 0fa6ab8c18 Tested the admin's delete_selected action when it receives nonexistent pks. 2018-02-24 09:21:13 -05:00
a8568730 ba37ee9ef8 Fixed #28635 -- Fixed admin's preserved filters if the URL contains non-ASCII characters. 2018-02-23 15:40:11 -05:00
Andreas Pelme e307ff29d2 Fixed #27810 -- Allowed query expressions in admin_order_field. 2018-02-15 21:00:31 -05:00
Haki Benita 98dd943893 Added tests for the date_hierarchy template tag. 2018-02-14 13:36:10 -05:00
Alexander Gaevsky ef2512b2ff Fixed #25790 -- Allowed disable column sorting in the admin changelist.
Thanks Ramiro Morales for completing the patch.
2018-02-07 17:46:28 -05:00
Tim Graham fa75b2cb51
Refs #27795 -- Removed force_bytes/text() usage in tests. 2018-02-07 14:20:04 -05:00
Tim Graham d0a42a14c0 Fixed imports per isort 4.3.1.
Partially reverted 9bcf73d788.
2018-02-02 14:44:07 -05:00
Tim Graham af33fb250e Fixed CVE-2018-6188 -- Fixed information leakage in AuthenticationForm.
Reverted 359370a8b8 (refs #28645).

This is a security fix.
2018-02-01 09:05:14 -05:00
Mariusz Felisiak 9bcf73d788 Fixed imports per isort 4.3.0. 2018-02-01 09:29:46 +01:00
Jon Dufresne 7d607127e3 Refs #21221 -- Deprecated staticfiles and admin_static template tag libraries. 2018-01-23 10:30:10 -05:00
Jon Dufresne ff05de760c Fixed #29038 -- Removed closing slash from HTML void tags. 2018-01-21 02:09:10 -05:00
Vasilis Aggelou 777f216d55 Fixed #15522 -- Added ModelAdmin.delete_queryset() to customize "delete selected objects" deletion. 2018-01-05 18:28:45 -05:00
Paulo d1286a8a68 Fixed #28517 -- Fixed admin delete confirmation view crash when related models don't have a delete permission. 2018-01-04 19:07:46 -05:00
Mariusz Felisiak 83a36ac49a
Removed unnecessary trailing commas and spaces in various code. 2017-12-28 21:07:29 +01:00
Tim Graham 7664fe2759 Refs #28871 -- Fixed admin_views selenium test failure. 2017-12-02 09:54:31 -05:00
Tim Graham 81057645f6 Fixed #28871 -- Fixed initialization of autocomplete widgets in "Add another" inlines.
Also allowed autocomplete widgets to work on AdminSites with a name other
than 'admin'.
2017-12-01 22:14:32 -05:00
Tim Graham 474bd7a5d4 Used a separate admin site for autocomplete tests. 2017-12-01 21:57:05 -05:00
shanghui ebb998976e Fixed #28751 -- Corrected the error message for inactive users in AdminAuthenticationForm.
Thanks SeungWon Kang for the report and Tim Graham for the review.
2017-11-08 09:39:12 -05:00
Claude Paroz 0cf00769ad Fixed #28585 -- Calculated admin's change form multipart context variable from forms and formsets
Thanks Tim Graham for the review.
2017-11-07 19:06:32 -05:00
Tim Graham 8b9a163afa Refs #28688 -- Updated a selenium test for admin's URLify.js change.
English words aren't removed if non-ASCII chars are present.
2017-10-24 11:03:36 -04:00
Tim Graham 48d57788ee Refs #26447 -- Removed the USE_ETAGS setting per deprecation timeline. 2017-09-22 12:51:18 -04:00
Johannes Hoppe 94cd8efc50 Fixed #14370 -- Allowed using a Select2 widget for ForeignKey and ManyToManyField in the admin.
Thanks Florian Apolloner and Tim Graham for review and
contributing to the patch.
2017-09-18 13:48:02 -04:00
Anton Samarchyan a469e158a9 Added tests for PermissionDenied in admin's delete_selected() view. 2017-06-19 16:01:48 -04:00
Tim Graham 7d52de31af Moved admin's action view tests to a separate file. 2017-06-19 16:00:06 -04:00
Anton Samarchyan 57f4b3ce37 Added tests for AdminSite's add/disable/get action methods. 2017-06-19 15:53:51 -04:00
Lincoln Smith 15b465c584 Fixed #27998 -- Made ManyToManyField changes logged in admin's object history. 2017-06-14 13:07:06 -04:00
Collin Anderson 7c9cb1ed37 Refs #27953 -- Removed hardcoded uses of Model.__str__() in tests. 2017-06-09 13:28:50 -04:00
Paulo 4ad2f86284 Fixed #28202 -- Fixed FieldListFilter.get_queryset() crash on invalid input. 2017-06-06 07:54:31 -04:00
Paulo b7f99f84bc Fixed #28262 -- Fixed incorrect DisallowedModelAdminLookup when a nested reverse relation is in list_filter. 2017-06-05 10:29:54 -04:00
Tim Graham 0841a31baf Fixed admin_views IntegrityError test failure.
Regression in 38a5a23c32.
2017-06-02 14:59:01 -04:00
Tim Graham 38a5a23c32 Fixed admin_views test when run in reverse.
Modifying self.s1 created in setUpTestData() leaked state.

Regression in 45585d3cbb.
2017-06-02 13:35:03 -04:00
Tim Graham 45585d3cbb Removed pk hardcoding in admin_views tests. 2017-06-02 10:01:41 -04:00