Do not cache sites in the admin

This commit is contained in:
Iacopo Spalletti 2016-08-25 15:31:15 +02:00
parent d584009912
commit 4529f9b8dd
No known key found for this signature in database
GPG key ID: BDCBC2EB289F60C6

View file

@ -142,12 +142,10 @@ class PostAdmin(PlaceholderAdminMixin, FrontendEditableAdminMixin,
:param request: current request :param request: current request
:return: boolean or a queryset of available sites :return: boolean or a queryset of available sites
""" """
if self._sites is None: try:
try: return request.user.get_sites()
self._sites = request.user.get_sites() except AttributeError: # pragma: no cover
except AttributeError: # pragma: no cover return Site.objects.none()
self._sites = Site.objects.none()
return self._sites
def _set_config_defaults(self, request, form, obj=None): def _set_config_defaults(self, request, form, obj=None):
form = super(PostAdmin, self)._set_config_defaults(request, form, obj) form = super(PostAdmin, self)._set_config_defaults(request, form, obj)