Django

TypeError

nickas 2019. 7. 12. 11:57

Django 2.0에서 변경 된점

 

Cannot reverse a query once a slice has been taken.

ListView에서  paginate_by를 추가하고 템플릿 파일에서 {{ object_list.last }}를 할 경우 위와 같은 에러 발생

 

AssertionErrorAssertionError: Cannot reorder a query once a slice has been taken.

ListView에서  paginate_by와 ordering를 같이사용하고 템플릿 파일에서 {{ object_list.last }}를 할 경우 위와 같은 에러 발생

 

결론은 오더링 또는 필터된 쿼리셋을 템플릿에서 슬라이싱 할 경우 에러 발생

 


 

https://www.bugsnag.com/blog/django-2-release

 

Watch out for new possible sources of errors in Django 2.0 | Bugsnag Blog

A major release of Django 2 is now available. Learn about some potential error sources to look out for and be aware of in this rundown of the changes.

www.bugsnag.com