Commit Graph

117 Commits

Author SHA1 Message Date
mgaligniana c72f6f36c1 Fixed #11803 -- Allowed admin select widgets to display new related objects.
Adjusted admin javascript to add newly created related objects to
already loaded select widgets.

In this version, applies only where limit_choices_to is not set.
2022-04-15 07:46:37 +02:00
Mariusz Felisiak 7119f40c98 Refs #33476 -- Refactored code to strictly match 88 characters line length. 2022-02-07 20:37:05 +01:00
django-bot 9c19aff7c7 Refs #33476 -- Reformatted code with Black. 2022-02-07 20:37:05 +01:00
Mariusz Felisiak c5cd878382
Refs #33476 -- Refactored problematic code before reformatting by Black.
In these cases Black produces unexpected results, e.g.

def make_random_password(
    self,
    length=10,
    allowed_chars='abcdefghjkmnpqrstuvwxyz' 'ABCDEFGHJKLMNPQRSTUVWXYZ' '23456789',
):

or

cursor.execute("""
SELECT ...
""",
    [table name],
)
2022-02-03 11:20:46 +01:00
Jacob Walls dc9deea8e8 Fixed #11715 -- Changed default value of ModelAdmin.actions/inlines to empty tuples.
This clarifies the intended pattern of overwriting the default value
rather than mutating it.
2022-01-11 12:22:49 +01:00
taulant 0e8be73812 Fixed #32975 -- Fixed admin system check for inlines with foreign keys to proxy models. 2021-09-03 06:48:32 +02:00
Eduardo Aldair Ahumada Garcia Jurado e4da365436 Refs #24121 -- Added __repr__() to AdminSite, DefaultAdminSite, and ModelAdmin.
Thanks tlebrize for the initial patch.
2021-07-05 08:15:58 +02:00
Hasan Ramezani 20ddc3b81d Fixed #32494 -- Adjusted system check for raw_id_fields to warn about Field.attname. 2021-03-04 08:41:28 +01:00
Hasan Ramezani 1da54bfe7d Corrected messages of admin checks for invalid model field names. 2021-03-04 08:41:28 +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
Nick Pope fed8129276
Unified admin action description generation.
Actions added to AdminSite.actions would not have the first character
of their description capitalized.

Co-authored-by: Mariusz Felisiak <felisiak.mariusz@gmail.com>
2020-11-13 21:41:18 +01:00
Alexander Todorov 5fab16392f
Fixed #32003 -- Added obj argument to has_perm() methods in tests. 2020-09-14 12:28:17 +02:00
Simon Charette 94f63b926f Refs #31395 -- Relied on setUpTestData() test data isolation in various tests. 2020-05-15 20:22:56 +02:00
hashlash dfbd9ca065 Fixed #30311 -- Restored ability to override global admin actions. 2020-04-17 20:23:00 +02: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
Hasan Ramezani ed668796f6 Fixed #30543 -- Fixed checks of ModelAdmin.list_display for fields accessible only via instance.
Co-Authored-By: Andrew Simons <andrewsimons@bubblegroup.com>
2019-07-10 10:37:34 +02:00
Tim Graham 6079ed82f4 Refs #27991 -- Made obj a required argument of InlineModelAdmin.has_add_permission().
Per deprecation timeline.
2019-01-17 11:14:07 -05:00
MaximZemskov 3c01fe30f3 Fixed #30097 -- Made 'obj' arg of InlineModelAdmin.has_add_permission() optional.
Restored backwards compatibility after refs #27991.
Regression in be6ca89396.
2019-01-11 18:02:43 -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
Simon Charette 84e7a9f4a7 Switched setUp() to setUpTestData() where possible in Django's tests. 2018-11-27 09:35:17 -05:00
Sanyam Khurana a7d6cab771 Fixed #29282 -- Prevented some admin checks from crashing with TypeError.
Co-authored-by: David Sanders <dsanders11@ucsbalum.com>
2018-11-20 17:19:13 -05:00
Matthias Kestenholz f9ff1df1da Fixed #29917 -- Stopped collecting ModelAdmin.actions from base ModelAdmins. 2018-11-09 18:52:30 -05:00
Javier Matos Odut 3d4d0a25b2 Fixed #29901 -- Allowed overriding an autocomplete/raw_id_fields/radio_fields widget with ModelAdmin.get_formset(). 2018-10-31 10:16:17 -04:00
Przemysław Buczkowski 70d0a1ca02 Fixed #29711 -- Added a system check for uniquness of admin actions' __name__. 2018-10-02 09:17:23 -04:00
Tim Graham fd8a7a5313 Fixed #29723 -- Fixed crash if InlineModelAdmin.has_add_permission() doesn't accept the obj argument.
* Refs #27991 -- Added testing for ModelAdmin.get_inline_instances() if the inline's has_add_permission() doesn't accept 'obj'.

* Fixed #29723 -- Fixed crash if InlineModelAdmin.has_add_permission() doesn't accept the obj argument.
2018-08-30 11:22:50 +02:00
Carlton Gibson 958c7b301e Fixed #29419 -- Allowed permissioning of admin actions. 2018-06-18 15:07:29 -04:00
Henk Kahlfuß 3eb9127678 Fixed #23869 -- Made ModelAdmin.get_deleted_objects() use has_delete_permission() for permissions checking. 2018-06-15 10:31:08 -04:00
Tim Graham ec2c9c3531 Refs #29428 -- Fixed admin check crash when using a query expression in ModelAdmin.ordering. 2018-06-14 21:04:43 -04:00
Carlton Gibson b30f9b131c Refs #29419, #8936 -- Removed change permission requirement for admin actions.
Partially reverted 825f0beda8.
2018-06-13 14:49:28 -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
Morgan Aubert 704443acac Fixed #29363 -- Added SimpleTestCase.assertWarnsMessage(). 2018-05-09 11:40:28 -04:00
Tim Graham a480ef89ad Fixed inconsistent formatting in tests/modeladmin/test_checks.py. 2018-04-16 13:35:40 -04:00
Matthias Kestenholz 13efbb233a Fixed #29322 -- Made admin check all ModelAdmin fieldsets for duplicates. 2018-04-13 11:08:30 -04:00
Jon Dufresne be6ca89396 Fixed #27991 -- Added obj arg to InlineModelAdmin.has_add_permission().
Thanks Vladimir Ivanov for the initial patch.
2018-04-04 19:21:50 -04:00
Becky Smith 8116e588db Fixed #17962 -- Added ModelAdmin.get_deleted_objects(). 2018-02-24 20:41:43 -05:00
Tim Graham d0a42a14c0 Fixed imports per isort 4.3.1.
Partially reverted 9bcf73d788.
2018-02-02 14:44:07 -05:00
Mariusz Felisiak 9bcf73d788 Fixed imports per isort 4.3.0. 2018-02-01 09:29:46 +01:00
Tim Graham acc8dd4142
Fixed #28984 -- Made assorted code simplifications. 2018-01-03 13:24:02 -05:00
Mariusz Felisiak 83a36ac49a
Removed unnecessary trailing commas and spaces in various code. 2017-12-28 21:07:29 +01:00
Rodrigo Pinheiro Marques de Araújo 30a389bd77 Fixed #28898 -- Corrected admin check to allow a OneToOneField in ModelAdmin.autocomplete_fields. 2017-12-13 02:39:27 -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
Nick Pope dea4cfb95b Refs #27804 -- Used subTest() in a modeladmin test. 2017-09-03 21:20:43 -04:00
Anton Samarchyan 90294cc2ae Added a test for ModelAdmin.__str__(). 2017-06-19 15:33:21 -04:00
Anton Samarchyan 2b53c8377d Improved test coverage of contrib/admin/checks.py. 2017-06-02 18:47:07 -04:00
Jon Dufresne 2c69824e5a Refs #23968 -- Removed unnecessary lists, generators, and tuple calls. 2017-06-01 19:08:59 -04:00
David Szotten d82ee32aac Fixed #27889 -- Fixed incorrect check error if ModelAdmin.ordering refers to 'pk'. 2017-03-02 10:25:05 -05:00
Anton Samarchyan b27166b769 Fixed #27356 -- Fixed ModelAdmin.lookup_allowed() for some nested relations. 2017-02-07 19:33:26 -05:00
chillaranand d6eaf7c018 Refs #23919 -- Replaced super(ClassName, self) with super(). 2017-01-25 12:23:46 -05:00
Simon Charette cecc079168 Refs #23919 -- Stopped inheriting from object to define new style classes. 2017-01-19 08:39:46 +01:00
Claude Paroz f3c43ad1fd Refs #23919 -- Removed python_2_unicode_compatible decorator usage 2017-01-18 13:44:34 +01:00