[Django] #21795: preserve_filter doesn't work on production server

70 views
Skip to first unread message

Django

unread,
Jan 17, 2014, 5:08:04 AM1/17/14
to django-...@googlegroups.com
#21795: preserve_filter doesn't work on production server
-------------------------------+--------------------
Reporter: honyczek | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.6
Severity: Normal | Keywords:
Triage Stage: Unreviewed | Has patch: 0
Easy pickings: 0 | UI/UX: 1
-------------------------------+--------------------
Function preserve_filter works only on development server at localhost. If
you try `./manage.py runserver 192.168.1.1:8000` or if you try your
project on production server (Apache HTTPD), it doesn't work. Filters in
admin aren't preserved.

Related: #6903

--
Ticket URL: <https://code.djangoproject.com/ticket/21795>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jan 17, 2014, 12:38:27 PM1/17/14
to django-...@googlegroups.com
#21795: preserve_filter doesn't work on production server
-------------------------------+--------------------------------------

Reporter: honyczek | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 1
-------------------------------+--------------------------------------
Changes (by loic84):

* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0


Comment:

@honyczek it works for me, both in production (uWSGI behind a Nginx
reverse proxy) and with the dev server using various combinations of hosts
and ports.

Would you be able to upload a minimal project that demonstrates the issue?

--
Ticket URL: <https://code.djangoproject.com/ticket/21795#comment:1>

Django

unread,
Jan 20, 2014, 2:09:23 AM1/20/14
to django-...@googlegroups.com
#21795: preserve_filter doesn't work on production server
-------------------------------+--------------------------------------

Reporter: honyczek | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 1
-------------------------------+--------------------------------------

Comment (by honyczek):

There is one of my projects, where I enabled preserve_filters, which is
available to public. http://confiback.sourceforge.net/

I'll try it at Nginx. But at Apache with mod_wsgi it doesn't work. Python
2.7.3/Django 1.6 or Python 2.7.5/Django 1.6

--
Ticket URL: <https://code.djangoproject.com/ticket/21795#comment:2>

Django

unread,
Jan 23, 2014, 10:48:49 PM1/23/14
to django-...@googlegroups.com
#21795: preserve_filter doesn't work on production server
-------------------------------+--------------------------------------
Reporter: honyczek | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 1
-------------------------------+--------------------------------------
Changes (by timo):

* status: new => closed
* resolution: => needsinfo


Comment:

@honyczek, it would be really helpful if you could do some more
investigation yourself and provide some more details to reproduce the
problem. Just saying it "doesn't work" is not a great bug report.

--
Ticket URL: <https://code.djangoproject.com/ticket/21795#comment:3>

Django

unread,
Jan 27, 2014, 4:51:13 AM1/27/14
to django-...@googlegroups.com
#21795: preserve_filter doesn't work on production server
-------------------------------+--------------------------------------
Reporter: honyczek | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 1
-------------------------------+--------------------------------------

Comment (by honyczek):

If I enable preserve_filters parameter in my
django.contrib.admin.ModelAdmin instance:
{{{
class DeviceAdmin(admin.ModelAdmin):
list_display = ['name', 'ip', 'profileUrl', 'backupsUrl', 'linkUrl']
list_filter = ['profile']
inlines = [KeywordMacroInline]
actions_on_bottom = True
actions_on_top = False
actions = ['manual_backup']
preserve_filters = True

def linkUrl(self, device):
if device.url:
return "<a href=\"%s\" target=\"_blank\">%s</a>" % (device.url,
_("Click to view device custom URL"))
else:
return "<a>-</a>"
linkUrl.allow_tags = True
linkUrl.short_description = _("Custom URL")

def profileUrl(self, device):
return "<a href=\"%s\">%s</a>" %
(urlresolvers.reverse('admin:frontend_profile_change',
args=(device.profile.id,)),device.profile.name)
profileUrl.allow_tags = True
profileUrl.short_description = _("Profile")

def backupsUrl(self, device):
return "<a href=\"%s?device__id__exact=%s\">%s: %s</a> (<a
href=\"%s\">%s</a>)" %
(urlresolvers.reverse('admin:frontend_backup_changelist'), device.id,
_("Total"), models.Backup.objects.filter(device=device).count(),
urlresolvers.reverse('frontend:download_backup_as_file',
kwargs={'backup_id':
models.Backup.objects.filter(device=device).latest('date').id}),
_("Download the latest"))
backupsUrl.allow_tags = True
backupsUrl.short_description = _("Backups")

def manual_backup(modeladmin, request, queryset):
from django.shortcuts import redirect

_ret =
"{}?ids={}".format(urlresolvers.reverse('frontend:run_backup'),"_".join(str(i.id)
for i in queryset))
return redirect(_ret)
manual_backup.short_description = _("Make manual backup of selected
devices")
}}}

then I select one of profiles on the right menu to filter list, then open
one Device to edit details and then I click to Save button, so Admin
returns to Device list with clean filter and displays devices from all
profiles (profile filter is empty and All is selected).

What I expect:
After click to Save button, Admin returns to Device list and filter will
be still enabled (previously selected profile will remain selected).

--
Ticket URL: <https://code.djangoproject.com/ticket/21795#comment:4>

Django

unread,
Jan 27, 2014, 5:02:12 AM1/27/14
to django-...@googlegroups.com
#21795: preserve_filter doesn't work on production server
-------------------------------+--------------------------------------

Reporter: honyczek | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 1
-------------------------------+--------------------------------------
Changes (by honyczek):

* status: closed => new
* resolution: needsinfo =>


--
Ticket URL: <https://code.djangoproject.com/ticket/21795#comment:5>

Django

unread,
Feb 4, 2014, 10:30:55 AM2/4/14
to django-...@googlegroups.com
#21795: preserve_filter doesn't work on production server
-------------------------------+--------------------------------------

Reporter: honyczek | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 1
-------------------------------+--------------------------------------

Comment (by timo):

Is `_changelist_filters` being dropped from the query string?

--
Ticket URL: <https://code.djangoproject.com/ticket/21795#comment:6>

Django

unread,
Feb 5, 2014, 4:37:01 AM2/5/14
to django-...@googlegroups.com
#21795: preserve_filter doesn't work on production server
-------------------------------+--------------------------------------

Reporter: honyczek | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 1
-------------------------------+--------------------------------------

Comment (by honyczek):

No, on edit form I have URL:
{{{http://server/confiback/admin/frontend/device/89/?_changelist_filters=e%3D1}}}
and after saving it returns to list with URL:
{{{http://server/confiback/admin/frontend/device/?e=1}}}. But filter is
not applied.

--
Ticket URL: <https://code.djangoproject.com/ticket/21795#comment:7>

Django

unread,
Feb 6, 2014, 9:25:28 AM2/6/14
to django-...@googlegroups.com
#21795: preserve_filter doesn't work on production server
-------------------------------+--------------------------------------

Reporter: honyczek | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 1
-------------------------------+--------------------------------------

Comment (by timo):

It looks like the `changelist_view` function in contrib.admin.options is
throwing an `IncorrectLookupParameters` exception. It would be great if
you could look into the reason for that. I think the fact that you say it
worked on localhost not on other servers is a red herring.

--
Ticket URL: <https://code.djangoproject.com/ticket/21795#comment:8>

Django

unread,
Feb 8, 2014, 3:08:06 PM2/8/14
to django-...@googlegroups.com
#21795: preserve_filter doesn't work on production server
-------------------------------+--------------------------------------
Reporter: honyczek | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 1
-------------------------------+--------------------------------------
Changes (by aaugustin):

* status: new => closed
* resolution: => needsinfo


--
Ticket URL: <https://code.djangoproject.com/ticket/21795#comment:9>

Django

unread,
Feb 10, 2014, 5:37:21 AM2/10/14
to django-...@googlegroups.com
#21795: preserve_filter doesn't work on production server
-------------------------------+--------------------------------------
Reporter: honyczek | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 1
-------------------------------+--------------------------------------

Comment (by anonymous):

Ok, I'd like to do it, but I haven't any knowledge how to debug this.
Could you give me some recommendations what to use and where to look?

--
Ticket URL: <https://code.djangoproject.com/ticket/21795#comment:10>

Django

unread,
Feb 10, 2014, 5:38:36 AM2/10/14
to django-...@googlegroups.com
#21795: preserve_filter doesn't work on production server
-------------------------------+--------------------------------------
Reporter: honyczek | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 1
-------------------------------+--------------------------------------

Comment (by honyczek):

Ok, I'd like to do it, but I haven't any knowledge how to debug this.
Could you give me some recommendations what to use and where to look?

--
Ticket URL: <https://code.djangoproject.com/ticket/21795#comment:11>

Django

unread,
Feb 10, 2014, 5:43:48 AM2/10/14
to django-...@googlegroups.com
#21795: preserve_filter doesn't work on production server
-------------------------------+--------------------------------------
Reporter: honyczek | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution: needsinfo
Keywords: | Triage Stage: Unreviewed

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0

Easy pickings: 0 | UI/UX: 1
-------------------------------+--------------------------------------

Comment (by timo):

Ping me (timograham) in #django-dev if you like, it will be easier than
communicating via this ticket.

--
Ticket URL: <https://code.djangoproject.com/ticket/21795#comment:12>

Django

unread,
Mar 28, 2014, 7:58:55 AM3/28/14
to django-...@googlegroups.com
#21795: preserve_filter doesn't work when running a site with a url prefix
-------------------------------+------------------------------------

Reporter: honyczek | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted

Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by timo):

* status: closed => new

* ui_ux: 1 => 0
* resolution: needsinfo =>
* stage: Unreviewed => Accepted


Comment:

We discussed this on #django-dev and determined that the problem is
specific to running a site with a URL prefix. In particular,
`add_preserved_filters` raises a `Resolver404`.

loic84 is looking into it further.

--
Ticket URL: <https://code.djangoproject.com/ticket/21795#comment:13>

Django

unread,
Mar 28, 2014, 10:46:13 AM3/28/14
to django-...@googlegroups.com
#21795: preserve_filter doesn't work when running a site with a url prefix
-------------------------------+------------------------------------
Reporter: honyczek | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by loic84):

@honyczek could you check if
https://github.com/loic/django/compare/ticket21795 fixes your issue?

I have a feeling writing a test for this patch is going to be pretty
painful.

--
Ticket URL: <https://code.djangoproject.com/ticket/21795#comment:14>

Django

unread,
Mar 28, 2014, 12:16:15 PM3/28/14
to django-...@googlegroups.com
#21795: preserve_filter doesn't work when running a site with a url prefix
-------------------------------+------------------------------------
Reporter: honyczek | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 0 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by loic84):

* cc: loic@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/21795#comment:15>

Django

unread,
Mar 29, 2014, 1:49:48 AM3/29/14
to django-...@googlegroups.com
#21795: preserve_filter doesn't work when running a site with a url prefix
-------------------------------+------------------------------------
Reporter: honyczek | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution:
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0

Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by loic84):

* has_patch: 0 => 1


Comment:

PR https://github.com/django/django/pull/2493.

--
Ticket URL: <https://code.djangoproject.com/ticket/21795#comment:16>

Django

unread,
Mar 31, 2014, 3:46:56 AM3/31/14
to django-...@googlegroups.com
#21795: preserve_filter doesn't work when running a site with a url prefix
-------------------------------+------------------------------------
Reporter: honyczek | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by honyczek):

* status: new => closed

* resolution: => fixed


Comment:

Great, it seems to be fixed. Thanks a lot.

--
Ticket URL: <https://code.djangoproject.com/ticket/21795#comment:17>

Django

unread,
Mar 31, 2014, 3:52:11 AM3/31/14
to django-...@googlegroups.com
#21795: preserve_filter doesn't work when running a site with a url prefix
-------------------------------+------------------------------------
Reporter: honyczek | Owner: nobody
Type: Bug | Status: new
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution:

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by loic84):

* status: closed => new
* resolution: fixed =>


Comment:

@honyczek did you test the patch on the pull request? because it's not
merged on master yet, hence why I'm reopening the ticket.

--
Ticket URL: <https://code.djangoproject.com/ticket/21795#comment:18>

Django

unread,
Mar 31, 2014, 7:20:20 AM3/31/14
to django-...@googlegroups.com
#21795: preserve_filter doesn't work when running a site with a url prefix
-------------------------------+------------------------------------
Reporter: honyczek | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.6
Severity: Normal | Resolution: fixed

Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------
Changes (by Tim Graham <timograham@…>):

* status: new => closed
* resolution: => fixed


Comment:

In [changeset:"4339e9a92d98371a50a6fe54ab7ea0c602ecee28"]:
{{{
#!CommitTicketReference repository=""
revision="4339e9a92d98371a50a6fe54ab7ea0c602ecee28"
Fixed #21795 -- Made add_preserved_filters account for url prefixes.

Thanks to trac username honyczek for the report. Refs #6903.
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21795#comment:19>

Django

unread,
Mar 31, 2014, 7:29:43 AM3/31/14
to django-...@googlegroups.com
#21795: preserve_filter doesn't work when running a site with a url prefix
-------------------------------+------------------------------------
Reporter: honyczek | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.6

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"5268d71f18d12c362d74010210309c1cec8e8a1a"]:
{{{
#!CommitTicketReference repository=""
revision="5268d71f18d12c362d74010210309c1cec8e8a1a"
[1.7.x] Fixed #21795 -- Made add_preserved_filters account for url
prefixes.

Thanks to trac username honyczek for the report. Refs #6903.

Backport of 4339e9a92d from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21795#comment:21>

Django

unread,
Mar 31, 2014, 7:29:43 AM3/31/14
to django-...@googlegroups.com
#21795: preserve_filter doesn't work when running a site with a url prefix
-------------------------------+------------------------------------
Reporter: honyczek | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.6

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by Tim Graham <timograham@…>):

In [changeset:"a5297c1ef4c4c010d1eb979177d4633beb5f9cad"]:
{{{
#!CommitTicketReference repository=""
revision="a5297c1ef4c4c010d1eb979177d4633beb5f9cad"
[1.6.x] Fixed #21795 -- Made add_preserved_filters account for url
prefixes.

Thanks to trac username honyczek for the report. Refs #6903.

Backport of 4339e9a92d from master
}}}

--
Ticket URL: <https://code.djangoproject.com/ticket/21795#comment:20>

Django

unread,
Apr 1, 2014, 1:29:36 AM4/1/14
to django-...@googlegroups.com
#21795: preserve_filter doesn't work when running a site with a url prefix
-------------------------------+------------------------------------
Reporter: honyczek | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.6

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by honyczek):

Replying to [comment:18 loic84]:


> @honyczek did you test the patch on the pull request? because it's not
merged on master yet, hence why I'm reopening the ticket.

Yes, i did. Thanks.

--
Ticket URL: <https://code.djangoproject.com/ticket/21795#comment:22>

Django

unread,
Apr 1, 2014, 2:04:07 AM4/1/14
to django-...@googlegroups.com
#21795: preserve_filter doesn't work when running a site with a url prefix
-------------------------------+------------------------------------
Reporter: honyczek | Owner: nobody
Type: Bug | Status: closed
Component: contrib.admin | Version: 1.6

Severity: Normal | Resolution: fixed
Keywords: | Triage Stage: Accepted
Has patch: 1 | Needs documentation: 0
Needs tests: 0 | Patch needs improvement: 0
Easy pickings: 0 | UI/UX: 0
-------------------------------+------------------------------------

Comment (by loic84):

Cool, thanks @honyczek.

--
Ticket URL: <https://code.djangoproject.com/ticket/21795#comment:23>

Reply all
Reply to author
Forward
0 new messages