#17729 closed Bug (duplicate)
regression in django-admin: list_editable doesn't work when pagination
| Reported by: | Velmont | Owned by: | nobody |
|---|---|---|---|
| Component: | contrib.admin | Version: | 1.4-alpha-1 |
| Severity: | Release blocker | Keywords: | regression |
| Cc: | odin.omdal@… | Triage Stage: | Accepted |
| Has patch: | no | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
Given the following code:
from django.db import models
class Member(models.Model):
name = models.CharField(max_length=200, unique=True)
from django.contrib import admin
class MemberAdmin(admin.ModelAdmin):
list_display = ('pk', 'name')
list_editable = ('name',)
list_per_page = 2
admin.site.register(Member, MemberAdmin)
And add 3 items (so that it paginates, you could also add 101 objects in standard conf if that floats your boat).
Et voilá:
AssertionError: Cannot reorder a query once a slice has been taken.
Environment:
Request Method: GET
Request URL: http://127.0.0.1:8000/admin/mytestapp/member/?p=0
Django Version: 1.4b1
Python Version: 2.7.2
Installed Applications:
('django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'mytestapp',
'django.contrib.admin')
Installed Middleware:
('django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')
Traceback:
File "/home/odin/tmp/django-list_editable/env/src/django/django/core/handlers/base.py" in get_response
111. response = callback(request, *callback_args, **callback_kwargs)
File "/home/odin/tmp/django-list_editable/env/src/django/django/contrib/admin/options.py" in wrapper
368. return self.admin_site.admin_view(view)(*args, **kwargs)
File "/home/odin/tmp/django-list_editable/env/src/django/django/utils/decorators.py" in _wrapped_view
91. response = view_func(request, *args, **kwargs)
File "/home/odin/tmp/django-list_editable/env/src/django/django/views/decorators/cache.py" in _wrapped_view_func
89. response = view_func(request, *args, **kwargs)
File "/home/odin/tmp/django-list_editable/env/src/django/django/contrib/admin/sites.py" in inner
196. return view(request, *args, **kwargs)
File "/home/odin/tmp/django-list_editable/env/src/django/django/utils/decorators.py" in _wrapper
25. return bound_func(*args, **kwargs)
File "/home/odin/tmp/django-list_editable/env/src/django/django/utils/decorators.py" in _wrapped_view
91. response = view_func(request, *args, **kwargs)
File "/home/odin/tmp/django-list_editable/env/src/django/django/utils/decorators.py" in bound_func
21. return func(self, *args2, **kwargs2)
File "/home/odin/tmp/django-list_editable/env/src/django/django/contrib/admin/options.py" in changelist_view
1215. formset = cl.formset = FormSet(queryset=cl.result_list)
File "/home/odin/tmp/django-list_editable/env/src/django/django/forms/models.py" in __init__
424. super(BaseModelFormSet, self).__init__(**defaults)
File "/home/odin/tmp/django-list_editable/env/src/django/django/forms/formsets.py" in __init__
50. self._construct_forms()
File "/home/odin/tmp/django-list_editable/env/src/django/django/forms/formsets.py" in _construct_forms
114. for i in xrange(self.total_form_count()):
File "/home/odin/tmp/django-list_editable/env/src/django/django/forms/formsets.py" in total_form_count
90. initial_forms = self.initial_form_count()
File "/home/odin/tmp/django-list_editable/env/src/django/django/forms/models.py" in initial_form_count
429. return len(self.get_queryset())
File "/home/odin/tmp/django-list_editable/env/src/django/django/forms/models.py" in get_queryset
471. qs = qs.order_by(self.model._meta.pk.name)
File "/home/odin/tmp/django-list_editable/env/src/django/django/db/models/query.py" in order_by
753. "Cannot reorder a query once a slice has been taken."
Exception Type: AssertionError at /admin/mytestapp/member/
Exception Value: Cannot reorder a query once a slice has been taken.
Attachments (1)
Change History (5)
by , 14 years ago
| Attachment: | django-list_editable.tgz added |
|---|
comment:1 by , 14 years ago
| Cc: | added |
|---|
comment:2 by , 14 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|
Confirmed that this bug is present in trunk, and not in 1.3.X, which makes it a regression and a release blocker. Thanks for the report!
comment:3 by , 14 years ago
| Resolution: | → duplicate |
|---|---|
| Status: | new → closed |
This was actually already reported in #16819.
Note:
See TracTickets
for help on using tickets.
small test project