파이썬/Django(108)
-
'with' expected at least one variable assignment
{% with lists =1 %} {% with lists= 1 %} {% with lists = 1 %} with는 변수와 값사이에 공백이 있으면 인식을 하지 못함
2021.01.16 -
Could not parse the remainder: '['a','b','c','d']' from '['a','b','c','d']'
{% with lists = ['a','b','c','d'] %} {% for list in lists %} {{ list }}{{ forloop.counter|add:1}} {% endfor %} {% endwith%} with는 리스트처리가 안됨
2021.01.16 -
'Manager' object is not callable
def gantt(request,work_id) : gantts = Gantt.objects().all() context = { 'gantts' : gantts } return render(request, 'gantt/gantt.html', context) Gantt.objects().all() -> Gantt.objects.all()로 변경해서 해결
2021.01.16 -
gantt() got an unexpected keyword argument 'id'Request Method: GETRequest URL: http://localhost/gantt/gantt/3
urls.py urlpatterns = [ path('gantt/', views.gantt, name='gantt'), ] views.py def gantt(request,gantt_id) : return HttpResponse('Hello World') path의 파라메터명과 함수의 파라메터명이 불일치하여 발생하는 오류 파라메터명을 동일하게 하면 해결 됨 path('gantt/', views.gantt, name='gantt'),
2021.01.16 -
The current path, gantt/gantt/, didn't match any of these.
urls.py urlpatterns = [ path('gantt', views.gantt, name='gantt'), ] 'gantt' -> 'gantt/'로 변경하면 해결 path('gantt/', views.gantt, name='gantt'),
2021.01.16 -
AttributeError at /gantt/gantt/'Gantt' object has no attribute 'get'Request Method: GETRequest URL: http://localhost/gantt/gantt/Django Version: 3.1.2Exception Type: AttributeErrorException Value:'Gantt' object has no attribute 'get'
views.py def gantt(request) : return HttpResponse('Hello World') urls.py urlpatterns = [ path('gantt/', views.Gantt, name='gantt'), ] http://localhost/gantt/gantt/ 호출시 에러 발생 urls.py에서 'views.Gantt''가 오타 'views.gantt'로 변경하면 해결됨
2021.01.16