To replicate place something similar to the following in a urls.py file
{{{
books/admin.py
from django.contrib import admin
class BookAdmin(admin.ModelAdmin):
list_display = 'a field' # intentional error
- urls.py
from django.admin.sites import AdminSite
from books.models import Book
from books.admin import BookAdmin
custom_site = AdminSite()
custom_site.register(Book, BookAdmin)
> python manage.py check
Expect to see an error here (specifically that list display must be a list
of a tuple)
}}}
In actuality, this runs fine.
One potential fix for this problem would be to create a module level
variable in django.contrib.admin.sites (or directly in
django.contrib.admin), run the checks on register (this is already being
done but the result of the checks are being ignored), and store the
results in the module level variable.
Patch with this approach is attached
--
Ticket URL: <https://code.djangoproject.com/ticket/23497>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* has_patch: 0 => 1
* needs_tests: => 0
* needs_docs: => 0
Comment:
Patch at https://github.com/amosson/django/tree/ticket_23497
--
Ticket URL: <https://code.djangoproject.com/ticket/23497#comment:1>
Comment (by charettes):
Could you submit a PR against Django's master instead? It makes reviewing
easier.
--
Ticket URL: <https://code.djangoproject.com/ticket/23497#comment:2>
Comment (by amosson):
Sure. Here you go
https://github.com/django/django/pull/3227
--
Ticket URL: <https://code.djangoproject.com/ticket/23497#comment:3>
* stage: Unreviewed => Accepted
--
Ticket URL: <https://code.djangoproject.com/ticket/23497#comment:4>
* owner: nobody => amosson
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/23497#comment:5>
Comment (by berkerpeksag):
I've opened [https://github.com/django/django/pull/3728 PR #3728] to
revise [https://github.com/django/django/pull/3227 PR #3227].
Changes:
* Fixed merge conflicts
* Added a release note
* Rewrote tests
* Updated commit message as suggested by Tim
--
Ticket URL: <https://code.djangoproject.com/ticket/23497#comment:6>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"b7219c7ba5fdfbf9349948b5a91af50e32822ee6"]:
{{{
#!CommitTicketReference repository=""
revision="b7219c7ba5fdfbf9349948b5a91af50e32822ee6"
Fixed #23497 -- Made admin system checks run for custom AdminSites.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23497#comment:7>
Comment (by Tim Graham <timograham@…>):
In [changeset:"6d8c14621e2878ea2051ee56326c66969a1d18d0"]:
{{{
#!CommitTicketReference repository=""
revision="6d8c14621e2878ea2051ee56326c66969a1d18d0"
[1.7x.] Fixed #23497 -- Made admin system checks run for custom
AdminSites.
Backport of b7219c7ba5fdfbf9349948b5a91af50e32822ee6 from master
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/23497#comment:8>