Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

on-nullable field 'order' to mapping without a default #140

Closed
ACPK opened this issue Nov 27, 2017 · 5 comments
Closed

on-nullable field 'order' to mapping without a default #140

ACPK opened this issue Nov 27, 2017 · 5 comments

Comments

@ACPK
Copy link

ACPK commented Nov 27, 2017

No description provided.

@bfirsh
Copy link
Member

bfirsh commented Nov 28, 2017

Could you explain in more detail what this is about?

@ivanff
Copy link

ivanff commented Feb 1, 2018

self.swap(self.get_ordering_queryset()
.filter(**{self.order_field_name + '__lt': getattr(self, self.order_field_name)})
.order_by('-' + self.order_field_name))

if all order fields is 0, qs is blank, and all methods up and down not work

@shuckc
Copy link
Member

shuckc commented Feb 1, 2018

Yes it's a known issue that your models need to be ordered from the start. If you retrospectively add ordering using makemigrations/migrate to a model with existing instances, they all have order=0. There is an open pull request to add a management command to manage.py to resolve this.

@alstr
Copy link

alstr commented Jun 28, 2019

Is this any closer to being resolved?

@shuckc
Copy link
Member

shuckc commented Apr 20, 2021

Yes - the admin tool to re-order an existing model is now merged #188 and released in version 3.4.2

@shuckc shuckc closed this as completed Apr 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants