Commit Graph

188 Commits

Author SHA1 Message Date
Claude Paroz c94bff2b26 Fixed #22241 -- Selectively added line breaks in admin read-only fields
When content is supposed to contain HTML, we do not try to add
line breaks in read-only contents.
Thanks Alexander Todorov for the report.
2014-03-22 17:00:50 +01:00
Rodolfo Carvalho 0d91225892 Fixed many typos in comments and docstrings.
Thanks Piotr Kasprzyk for help with the patch.
2014-03-03 07:38:09 -05:00
Greg Chapple 6acaa52386 Fixed #22135 -- Added ModelAdmin.get_changeform_initial_data().
Allows custom behavior for setting initial form data in ModelAdmin.
By default, initial data is set via GET params. The new method allows
this behavior to be overridden.

Thanks egasimus for the suggestion.
2014-03-03 07:28:24 -05:00
Russell Keith-Magee 3c5fc708f1 Edited contrib.admin check messages for grammar and consistency. 2014-03-03 13:27:17 +08:00
Klemens Mantzos f683cb90be Fixed #21924 -- Added the ability to specify a reverse order for admin_order_field.
Thanks Klemens Mantzos for the report and initial patch.
2014-02-14 19:53:44 -05:00
Christopher Adams eefc88feef Fixed #2445 -- Allowed limit_choices_to attribute to be a callable.
ForeignKey or ManyToManyField attribute ``limit_choices_to`` can now
be a callable that returns either a ``Q`` object or a dict.

Thanks michael at actrix.gen.nz for the original suggestion.
2014-02-11 14:05:12 -05:00
julien 'pouete' Godin f5123c7291 Fixed #21371 -- Added the block.super to admin bodyclass blocks.
Thanks Keryn Knight for the report.
2014-02-10 09:13:29 -05:00
Claude Paroz 343dfff133 Removed the this_is_the_login_form hack
Refs #21911. Now that we have a more traditional login form, we
don't need any more a special field telling us we are dealing with
the login form.
2014-02-04 20:02:28 +01:00
Claude Paroz be0ad62994 Fixed #21911 -- Made admin views redirect to login when needed
Historically, the Django admin used to pass through the request
from an unauthorized access to the login view directly. Now we
are using a proper redirection, which is also preventing
inadvertantly changing data when POSTing login data to an admin
view when user is already authorized.
Thanks Marc Tamlyn and Tim Graham for the reviews.
2014-02-04 20:02:28 +01:00
Claude Paroz 5848bea9dc Made staff_member_required redirect to login
Refs #21911.
2014-02-04 20:02:28 +01:00
Simon Charette 10e3faf191 Fixed #19774 -- Deprecated the contenttypes.generic module.
It contained models, forms and admin objects causing undesirable
import side effects. Refs #16368.

Thanks to Ramiro, Carl and Loïc for the review.
2014-01-26 14:42:30 -05:00
Russell Keith-Magee d818e0c9b2 Fixed #16905 -- Added extensible checks (nee validation) framework
This is the result of Christopher Medrela's 2013 Summer of Code project.

Thanks also to Preston Holmes, Tim Graham, Anssi Kääriäinen, Florian
Apolloner, and Alex Gaynor for review notes along the way.

Also: Fixes #8579, fixes #3055, fixes #19844.
2014-01-20 10:45:21 +08:00
Aymeric Augustin a7588e2e22 Removed useless model definitions.
Surprisingly, this commit doesn't change any behavior at all. When a
model is defined with the same name as another model in the same app,
the definition of the first class is bound to the name of the class
regardless of the definition of the second class.
2014-01-05 20:52:46 +01:00
Aymeric Augustin e32095616c Imported override_settings from its new location. 2013-12-23 21:37:56 +01:00
Loic Bistuer 6685713869 Fixed E127 pep8 warnings. 2013-12-14 11:59:15 -05:00
Claude Paroz c7c647419c Fixed #21510 -- Readded search reset link in changelist search bar
Thanks moritz.pfeiffer at alp-phone.ch for the report and
Tim Graham for the initial patch.
2013-12-11 15:30:20 +01:00
Jay Leadbetter c74504c2dd Fixed #20522 - Allowed use of partially validated object in ModelAdmin.add_view formset validation.
Updated ModelAdmin to use form.instance when passing parent model to
child inlines for add_view. There is effectively no change in the
change_view since the previously passed 'obj' is the same as form.instance.

Thanks to meshy for report, and EvilDMP and timo for review.
2013-11-25 20:01:16 -05:00
Baptiste Mispelon a739573e17 Fixed test breakage under python 3 introduced by a480f8320a. 2013-11-23 19:50:20 +01:00
Anssi Kääriäinen 752d3d70da Fixed #21431 -- GenRel->FK list_filter regression in admin
Report, analysis and tests from stephenmcd.
2013-11-21 14:52:00 +02:00
Loic Bistuer 8e670a0e50 Refs #8261 -- Fixed regression introduced by fd219fa.
ModelAdmin displayed the "View on site" link even if the Model didn't
define the `get_absolute_url()` method.
2013-11-21 16:26:49 +07:00
Jason Myers 7a61c68c50 PEP8 cleanup
Signed-off-by: Jason Myers <jason@jasonamyers.com>
2013-11-02 23:50:49 -05:00
Jason Myers 3f115776e1 PEP8
Signed-off-by: Jason Myers <jason@jasonamyers.com>
2013-11-02 23:50:38 -05:00
coagulant 8eec2d93b6 Fixed all E261 warnings 2013-11-02 23:50:33 -05:00
Tim Graham 36ded01527 Fixed #21302 -- Fixed unused imports and import *. 2013-11-02 15:24:56 -04:00
Unai Zalakain fd219fa24c Fixed #8261 -- ModelAdmin hook for customising the "show on site" button
``ModelAdmin.view_on_site`` defines wether to show a link to the object on the
admin detail page. If ``True``, cleverness (i.e. ``Model.get_absolute_url``) is
used to get the url. If it's a callable, the callable is called with the object
as the only parameter. If ``False``, not link is displayed.

With the aim of maitaining backwards compatibility, ``True`` is the default.
2013-10-29 17:10:12 -04:00
Alex Gaynor b35ff0d920 Fixed all the E203 violations 2013-10-26 18:27:42 -07:00
Renato Oliveira 43569647ab Fixed #21299 - Changed filters from title to capfirst on admin inline formsets.
Previously there was a mixture of the two which resulted in inconsistent
casing.
2013-10-24 14:44:07 -04:00
Alex Gaynor 9bf5610890 Start attacking E231 violations 2013-10-24 10:30:03 -07:00
Alasdair Nicol c3aa2948c6 Fixed #21298 -- Fixed E301 pep8 warnings 2013-10-23 13:45:03 +01:00
Tim Graham ae48d77ef8 Fixed E225 pep8 warnings. 2013-10-23 06:09:29 -04:00
Bouke Haarsma 3565efaa45 Removed some direct settings manipulations in tests; refs #21230. 2013-10-21 11:31:05 -04:00
Alasdair Nicol b289fcf1bf Fixed #21288 -- Fixed E126 pep8 warnings 2013-10-21 08:31:30 -04:00
Alasdair Nicol a800036981 Fixed #21287 -- Fixed E123 pep8 warnings 2013-10-18 10:07:39 +01:00
Tim Graham adedc31072 Fixed "redefinition of unused 'foo' from line X" pyflakes warnings. 2013-10-10 11:09:42 -04:00
Christopher Medrela dc3d2ac98c Fixed #11277 -- Hid labels of fields with HiddenInput widget in admin forms.
Thanks bartTC for the report.
2013-10-04 14:08:06 -04:00
yokomizor df27803a55 Fixed #9532 -- Added min_num and validate_min on formsets.
Thanks gsf for the suggestion.
2013-09-19 13:11:49 -04:00
Tim Graham 18ffdb1772 Fixed #17627 -- Renamed util.py files to utils.py
Thanks PaulM for the suggestion and Luke Granger-Brown and
Wiktor Kołodziej for the initial patch.
2013-09-16 12:52:05 -04:00
Keryn Knight 170f721367 Fixed #21056 -- AdminSite.app_index no longer blindly accepts any app-labelish input. 2013-09-11 08:48:32 -04:00
Keryn Knight 0d74f9553c Fixed #21063 -- AdminSite app_index should be fail early if the user has no permissions. 2013-09-09 12:51:03 -04:00
Tim Graham aeed2cf3b2 Added a test to show that the user.is_staff check in admin base.html is necessary.
refs #21067
2013-09-09 07:59:35 -04:00
Alex Gaynor 9d11522599 Removed some more unused local vars 2013-09-08 12:20:01 -07:00
Alex Gaynor 96fd5557f9 Removed a ton of unused local vars 2013-09-08 08:05:16 -07:00
Juan Catalano 04415bf81b Fixed #21013 -- Ensure that ModelAdmin.get_queryset is considered for the admin history view. 2013-09-07 14:53:29 -05:00
Julien Phalip 8ef060e0e6 Fixed a test failure introduced in 55a11683f7. 2013-09-07 12:41:33 -05:00
Aymeric Augustin 6a6428a36f Took advantage of django.utils.six.moves.urllib.*. 2013-09-05 14:39:23 -05:00
Ramiro Morales 41feab3654 Converted tests for admin first form widget auto-focus to Selenium.
Refs #1707 and 1c0c879be3.
2013-09-01 15:07:08 -03:00
Tim Graham af953c45cc Fixed #16433 -- Fixed a help_text/read only field interaction that caused an admin crash.
Thanks chris at cogdon.org for the report and admackin for the patch.
2013-08-29 09:39:31 -04:00
Tim Graham cf8d6e9108 Fixed #20881 -- Removed contrib.auth.models.AbstractUser.get_absolute_url()
The definition is arbitrary and creates a broken "view on site"
link in the admin if a project doesn't define such a URL.
2013-08-29 06:36:35 -04:00
Rainer Koirikivi 65cf82bd08 Fixed #20934 -- Avoided NoReverseMatch in ModelAdmin.changelist_view
The view tried to display links to a ModelAdmin's change_view, which
resulted in NoReverseMatches if get_urls was overridden to remove the
corresponding url.
2013-08-22 10:08:54 -04:00
Rainer Koirikivi 3c03004050 Fixed #20640 -- Avoided NoReverseMatch in get_deleted_objects
The default delete action resulted in a NoReverseMatch if it were to
list any Model with a ModelAdmin with `get_urls` overridden to remove
the change url.  Catching the error and not displaying the link in that
case, as was already done for models with no registered admins.

Thanks Keryn Knight for the report.
2013-08-19 12:01:33 -04:00
Claude Paroz 165f44aaaa Combine consecutive with statements
Python 2.7 allows to combine several 'with' instructions.
2013-08-16 20:12:10 +02:00
Alasdair Nicol 22c6497f99 Fixed #20895 -- Made check management command warn if a BooleanField does not have a default value
Thanks to Collin Anderson for the suggestion and Tim Graham for
reviewing the patch.
2013-08-15 19:47:26 -04:00
Petr Dlouhý 1b47508ac8 Fixed LogEntry.get_admin_url() for non-existent models.
Regression introduced by [369b6fa]; refs #18169.
2013-08-02 12:51:10 -04:00
SusanTan ccf8f1e18f Added a test for AdminSite.app_index_template; refs #8498. 2013-07-31 06:59:15 -04:00
Julien Phalip e351dbf6ee Fixed #19082 -- Enabled admin field pre-population for existing objects.
Thanks to msaelices and d1ffuz0r for the initial patch and tests.
2013-07-30 00:21:08 -07:00
Claude Paroz 5c1143910e Removed most of absolute_import imports
Should be unneeded with Python 2.7 and up.
Added some unicode_literals along the way.
2013-07-29 20:28:13 +02:00
Julien Phalip 4e0ff35146 Fixed #11195 -- Added CSS classes to the changelist cells to allow style customizations. Thanks to akaihola, Ramiro Morales and vdboor for their work on the patch. 2013-07-27 19:50:02 -07:00
Thomas Sorrel bb145e2c47 Fixed #13629 -- Added CSS classes to the `<body>` tag of some admin templates to allow style customizations per app or per model. 2013-07-21 20:17:14 +00:00
Loic Bistuer 2fc6c9472c Fixed #20767 -- Fixed ModelAdmin.preserve_filters for namespaced URLs.
Thanks Collin Anderson for the report.
2013-07-18 18:18:30 -04:00
Aymeric Augustin e021b87c00 Fixed a few more imports of django.utils.unittest.
One import per line please! Refs #20680.
2013-07-01 22:49:07 +02:00
Tim Graham a6a905c619 Updated tests for deprecation of Option.get_(add|change|delete)_permission.
refs #20642.
2013-07-01 09:19:55 -04:00
Tim Graham 7c0b72a826 Prevented running some admin_view tests twice. 2013-06-27 20:13:42 -04:00
Tim Graham 534ced5aad Fixed #20664 -- Fixed a bug with raw_id_fields on Python 3.
Thanks jefftriplett for the report.
2013-06-27 19:39:20 -04:00
Javier Mansilla f819bef3dc Fixed #19773 - Added admin/popup_response.html template.
Thanks jimmylam@ for the suggestion.
2013-06-25 11:20:41 -04:00
Aymeric Augustin d9a43545be Merge pull request #1282 from loic/ticket6903
Fixed failing test on MySQL since c86a9b6
2013-06-19 03:04:04 -07:00
Loic Bistuer 7d0c3b9b26 Fixed MySQL failing test introduced by c86a9b6 2013-06-19 16:13:43 +07:00
Aymeric Augustin 9da9b3eb04 Merge pull request #1281 from loic/ticket6903
Fixed #6903 - Preserved admin changelist filters.
2013-06-18 13:07:28 -07:00
Loic Bistuer c86a9b6398 Fixed #6903 - Preserve admin changelist filters after saving or deleting an object 2013-06-19 02:41:36 +07:00
Erik Romijn aeb1389442 Fixed #20079 -- Improve security of password reset tokens 2013-06-18 20:02:00 +02:00
Aymeric Augustin dfcce4288a Fixed available_apps for selenium tests.
Refs #20483.
2013-06-10 12:11:46 +02:00
Tim Graham d727518ad6 Fixed #20331 -- Allowed admin actions to serve StreamingHttpResponses
Thanks Edwin.
2013-05-29 11:25:42 -04:00
Tim Graham 0268aba96b Fixed #20182 - admin lookup should treat 0 as False for __isnull
Thanks Benjie Chen.
2013-05-27 13:29:53 -04:00
Preston Holmes d228c1192e Fixed #19866 -- Added security logger and return 400 for SuspiciousOperation.
SuspiciousOperations have been differentiated into subclasses, and
are now logged to a 'django.security.*' logger. SuspiciousOperations
that reach django.core.handlers.base.BaseHandler will now return a 400
instead of a 500.

Thanks to tiwoc for the report, and Carl Meyer and Donald Stufft
for review.
2013-05-25 16:27:34 -07:00
Marc Tamlyn 09f8652765 Use assertIsInstance in tests.
Gives much nicer errors when it fails.
2013-05-21 10:42:15 +01:00
Bozidar Benko 2d309a7043 Fixed #15961 -- Modified ModelAdmin to allow for custom search methods.
This adds a get_search_results method that users can override to
provide custom search strategies.

Thanks to Daniele Procida for help with the docs.
2013-05-19 16:45:00 +02:00
Alex Gaynor 327e362ff3 Fixed an obvious typo. 2013-05-10 08:56:39 -07:00
Aymeric Augustin a4dec43b52 Fixed two admin_views tests under Oracle.
Thanks Anssi for the review.
2013-05-10 16:56:42 +02:00
Claude Paroz 118faa0893 Made usage of assertTemplateUsed in admin_views tests
Thanks Baptiste Mispelon for the suggestion.
2013-04-10 10:16:15 +02:00
Baptiste Mispelon f69396665c Fix admin_views tests after commit 3be368c73e. 2013-04-08 22:02:18 +02:00
Adam Wentz a4b8a4b632 Fixed #20121 -- Removed LogEntry.get_admin_url's hard-coded path.
Updated LogEntry.get_admin_url to use 'reverse' instead
of a hard-coded path.
2013-03-25 23:45:27 -04:00
Aymeric Augustin bc35b95274 Fixed test failures introduced in e16c48e001. 2013-03-24 15:27:50 +01:00
Deric Crago 9d6ecc6bc6 Fixed #19327 -- Added handling of double login attempts in admin.
Thanks to Krzysztof Jurewicz for initial patch and
adupin for tests.
2013-03-18 17:11:07 -07:00
Aymeric Augustin 31b5275235 Fixed #13260 -- Quoted arguments interpolated in URLs in reverse. 2013-03-18 23:58:22 +01:00
Aymeric Augustin b746f8a9e3 Adjusted query counts to account for new savepoints. 2013-03-11 21:07:19 +01:00
Loic Bistuer 6983a1a540 Fixed #15363 -- Renamed and normalized to `get_queryset` the methods that return a QuerySet. 2013-03-08 10:11:45 -05:00
Igor Támara e2ee02c5bd Fixed #19951 -- Admin: Invalid model PK values shouldn't cause 500 status.
Avoid ValueError in admin when passing a string as PK for an inherited
model with an integer PK field.

Thanks ikks for the patch. See also #11191.
2013-03-06 21:38:44 -03:00
Florian Apolloner 33836cf88d Renamed some tests and removed references to modeltests/regressiontests. 2013-02-26 14:36:57 +01:00
Florian Apolloner 89f40e3624 Merged regressiontests and modeltests into the test root. 2013-02-26 14:36:57 +01:00