Commit Graph

74 Commits

Author SHA1 Message Date
Johannes Maron 03d0f12c82 Fixed #32466 -- Corrected autocomplete to_field resolution for complex cases.
In MTI or ForeignKey as primary key cases, it is required to fetch the attname
from the field instance on the remote model in order to reliably resolve the
to_field_name.

Co-authored-by: Johannes Maron <info@johanneshoppe.com>
Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
Co-authored-by: Carlton Gibson <carlton.gibson@noumenal.es>
2021-03-18 11:21:23 +01:00
Johannes Maron 0b120f5d64 Refs #29138 -- Added extra tests for autocomplete FK to_field variations. 2021-03-18 11:14:18 +01:00
Jacob Walls 9d7e31cc74
Removed unused code in admin_views tests.
Unused since its introduction in 7b21bfc074
and 1e4ad6f118.
2021-02-26 20:49:21 +01:00
Nick Pope 9204485396
Fixed #16117 -- Added decorators for admin action and display functions.
Refs #25134, #32099.
2021-01-13 17:19:22 +01:00
Johannes Maron 3071660acf
Fixed #29010, Fixed #29138 -- Added limit_choices_to and to_field support to autocomplete fields.
* Fixed #29010 -- Added limit_choices_to support to autocomplete fields.
* Fixed #29138 -- Allowed autocomplete fields to target a custom
  to_field rather than the PK.
2021-01-12 11:37:38 +01:00
Julien Rebetez b790883065 Fixed #31181 -- Added links to related models for admin's readonly fields. 2020-10-08 19:53:49 +02:00
Jon Dufresne 505fec6bad Capitalized Unicode in docs, strings, and comments. 2020-04-20 12:10:33 +02: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
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
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
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
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
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
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
Lincoln Smith 15b465c584 Fixed #27998 -- Made ManyToManyField changes logged in admin's object history. 2017-06-14 13:07:06 -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
Anton Samarchyan e88d2dfcf4 Fixed #27475 -- Fixed NonExistentTimeError crash in ModelAdmin.date_hierarchy. 2017-03-06 12:01:31 -05:00
chillaranand d6eaf7c018 Refs #23919 -- Replaced super(ClassName, self) with super(). 2017-01-25 12:23:46 -05:00
Claude Paroz f3c43ad1fd Refs #23919 -- Removed python_2_unicode_compatible decorator usage 2017-01-18 13:44:34 +01:00
Claude Paroz d7b9aaa366 Refs #23919 -- Removed encoding preambles and future imports 2017-01-18 09:55:19 +01:00
Adam Chainz cd86f03591 Refs #26961 -- Fixed invalid ModelAdmins in tests. 2017-01-07 10:06:51 -05:00
Jon Dufresne e24c0a2d7c Fixed #26524 -- Fixed crash in admin change view when displaying many to many forward refs.
Thanks Tim Graham for the regression test.
2016-09-12 19:20:35 -07:00
Adam Chainz a757c68129 Fixed admin_views clashing field check error.
admin_views.Recommendation.recommender: (models.E006) The field 'recommender'
clashes with the field 'recommender' from model 'admin_views.title'.
2016-08-10 15:54:29 -04:00
Vytis Banaitis 2f9c4e2b6f Fixed #19963 -- Added support for date_hierarchy across relations. 2016-06-04 12:14:02 -04:00
Tim Graham 92053acbb9 Fixed E128 flake8 warnings in tests/. 2016-04-08 10:12:33 -04:00
Alexander Gaevsky 9a33d3d764 Fixed #26060 -- Fixed crash with reverse OneToOneField in ModelAdmin.readonly_fields. 2016-01-21 13:21:28 -05:00
Tim Graham 3541ca1504 Refs #25165 -- Fixed JSON serialization for delete popup in the admin. 2016-01-09 13:35:58 -05:00
Alexander Gaevsky ade54ffa34 Refs #25165 -- Fixed JSON serialization for add/edit popup in the admin.
Forwardport of test in o839d71d8562abe0b245024e55ca1d02a45e58fd from stable/1.9.x
(refs #25997).
2016-01-08 12:28:32 -05:00
Tim Graham 822a03b3e4 Refs #25165 -- Fixed failure of admin's "Add another" popup to close.
Thanks Thomas Grainger for the fix.
2016-01-08 11:41:01 -05:00
Alexander Gaevsky 69208a5a1c Fixed #25465 -- Restored line breaks conversion in admin readonly fields. 2015-12-29 19:31:43 -05:00
Sergey Fedoseev 8ab58b8052 Fixed #25883 -- Fixed admin deletion page summary counts for related objects. 2015-12-10 18:09:03 -05:00
Simon Charette 9dcfecb7c6 Fixed #25622 -- Accounted for generic relations in the admin to field validation
Thanks to Jonathan Liuti for the report and Tim Graham for the review.
2015-10-29 13:13:19 -04:00
sarthakmeh 40bf18e702 Fixed #25058 -- Added GenericRelations with related_query_name to the admin's delete confirmation page. 2015-09-03 10:08:51 -04:00
Flavio Curella c2e70f0265 Fixed #21127 -- Started deprecation toward requiring on_delete for ForeignKey/OneToOneField 2015-07-27 18:28:13 -04:00
Tim Graham 04e69598de Refs #24919 -- Made test models serializable for migrations. 2015-07-21 09:19:40 -04:00
Edward Henderson f8cc464452 Fixed #16501 -- Added an allow_unicode parameter to SlugField.
Thanks Flavio Curella and Berker Peksag for the initial patch.
2015-07-17 13:48:58 -04:00
Adam Zapletal 0894643e40 Fixed #23387 -- Kept "Save as new" button after validation errors in admin.
When "Save as new" is chosen and errors occur, only show the "Save as new"
button and not the other save buttons.

Thanks to Tino de Bruijn for doing the real work on this fix.
2015-05-02 19:41:10 -04:00
Baptiste Mispelon 82c9169077 Refs #24461 -- Added test/release notes for XSS issue in ModelAdmin.readonly_fields
This issue was fixed by refs #24464.
2015-03-09 10:12:21 -04:00
Aymeric Augustin 934400759d Guaranteed removal of temporary files during tests.
Dropped the DJANGO_TEST_TEMP_DIR environment variable.

Before this change, proper removal depended on the developer passing
dir=os.environ['DJANGO_TEST_TMP_DIR'] to tempfile functions.
2015-02-23 16:55:26 +01:00
Tim Graham 0ed7d15563 Sorted imports with isort; refs #23860. 2015-02-06 08:16:28 -05:00
Simon Charette 07988744b3 Fixed #13165 -- Added edit and delete links to admin foreign key widgets.
Thanks to Collin Anderson for the review and suggestions and Tim for the
final review.
2015-01-10 12:24:52 -05:00
Kamil Braun 0623f4dea4 Fixed #23934 -- Fixed regression in admin views obj parameter. 2014-12-02 08:42:17 -05:00
Simon Charette 3a9aa155e2 Fixed #23915 -- Made sure m2m fields through non-pk to_field are allowed in the admin.
refs #23754, #23862
2014-11-25 15:28:21 -05:00
Simon Charette f9c4e14aec Fixed #23754 -- Always allowed reference to the primary key in the admin
This change allows dynamically created inlines "Add related" button to work
correcly as long as their associated foreign key is pointing to the primary
key of the related model.

Thanks to amorce for the report, Julien Phalip for the initial patch,
and Collin Anderson for the review.
2014-11-25 13:26:50 -05:00
Thomas Chaumeny 825ea83858 Fixed #21196 -- Removed index on test field causing MySQL specific warning. 2014-10-19 13:44:39 +07:00
Emmanuelle Delescolle a24cf21722 Fixed #23604 -- Allowed related m2m fields to be references in the admin.
Thanks Simon Charette for review.
2014-10-06 08:35:16 -04:00
Simon Charette 342ccbddc1 Fixed #23431 -- Allowed inline and hidden references to admin fields.
This fixes a regression introduced by the 53ff096982 security fix.

Thanks to @a1tus for the report and Tim for the review.

refs #23329.
2014-09-08 13:49:07 -04:00