Closed devgraphy closed 3 years ago
urls.py
urlpatterns = [
path('rank/',getRank),
path('hello/',helloAPI),
path('users/',userList),
path('<str:id>/',getUser),
]
위치를 수정하니 views를 못 찾는 문제는 해결... 그 이유는...?
이후 TypeError at /membership/rank/ The
fieldsoption must be a list or tuple or "__all__". Got str.
문제가 바로 발생...
class RankSerializer(serializers.ModelSerializer):
class Meta:
model = Rank
fields = ['who']
fields = ('who') -> ['who'] 로 변경하여 해결
Rank 정보는 테이블로 따로 관리하는 것보다 view 단에서 userlist를 points필드로 내림차순 정렬하여 API로 제공하는 방식으로 해결
console error