티스토리 뷰

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

 

'Django' 카테고리의 다른 글

queryset  (0) 2019.07.15
Angular4  (0) 2019.07.14
Class ListView()  (0) 2019.07.13
장고 폼의 기초  (0) 2019.07.11
클래스 기반 뷰의 모범적인 이용  (0) 2019.07.11
최근에 올라온 글
글 보관함