-
[Python] Django html 상속 extendsPython/Django 2021. 12. 1. 10:40
# base.html <!DOCTYPE html> {% load static %} <html lang="en"> <head> <meta charset="UTF-8"> <title>Title</title> <link rel="stylesheet" href="{% static 'css/mystyle.css' %}"/> </head> <body> {%block content%} {%endblock%} </body> </html>
# users.html {%extends 'myApp/base.html'%} {%block content%} {%if users%} <ol> {%for user in users%} <li>User Info</li> <ul> <li>Name : {{user.name}}</li> <li>Email : {{user.email}}</li> </ul> {%endfor%} </ol> {%endif%} {%endblock%}
'Python > Django' 카테고리의 다른 글
[Django] admin.ModelAdmin objects 정리 (0) 2021.12.03 [Django] User model에 대한 settings, admin 설정하기 (0) 2021.12.03 [Python] Django superuser (admin) 계정 만들기 (0) 2021.12.01 [Python] Django urls.py, views.py 초기 세팅 (0) 2021.11.30 [Python] TypeError: __init__() missing 1 required positional argument: 'on_delete' (0) 2021.11.30