Django 튜토리얼

장고 튜토리얼 개발 정리

Django 튜토리얼 장고 튜토리얼 개발 정리

Part 3

Writing your first Django app, part 3

https://docs.djangoproject.com/en/3.0/intro/tutorial03/

Github Tag: https://github.com/studroid/writing-your-fisrt-django-app/commits/Part-3-Finished  

 

참고 자료

URL Dispatcher

Cool URI Don't Change: https://www.w3.org/Provider/Style/URI

order_by에서 필드명 앞에 -를 붙이면 desc(내림차순), 없으면 asc(오름차순) 정렬
https://docs.djangoproject.com/en/3.0/ref/models/querysets/#django.db.models.query.QuerySet.order_by
Polls 앱 안에 템플릿 경로를 templates/polls를  만드는 이유
Template namespacing
Now we might be able to get away with putting our templates directly in polls/templates (rather than creating another polls subdirectory), but it would actually be a bad idea. Django will choose the first template it finds whose name matches, and if you had a template with the same name in a different application, Django would be unable to distinguish between them. We need to be able to point Django at the right one, and the best way to ensure this is by namespacing them. That is, by putting those templates inside another directory named for the application itself.
파이썬의 예외 처리: try, except, else, finally
https://gomguard.tistory.com/122
Template에서 코멘트 처리 - {# #}, {% comment "title" %} {% endcomment %}
https://docs.djangoproject.com/en/3.0/topics/templates/#comments
URLConf의 name을 이용한 url 생성 시 아래와 같이 쓸 수도 있음
{% with url_name="client-detail-view" %}
{% url url_name client.id %}
{% endwith %}

댓글

댓글 본문
버전 관리
김시준
현재 버전
선택 버전
graphittie 자세히 보기