본문 바로가기
  • 소소한 개발자 이야기

웹프로그래밍3

[view] 상품 주문하기, 주문 정보 조회하기 product_detail.html 수정 product 앱 > templates > product.html 코드를 아래와 같이 수정해 주세요. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 {% extends "base.html" %} {% load humanize %} {% block contents %} # 상품명 가격 등록날짜 {% for product in product_list %} {{ product.id }} {{ product.name }} {{ product.price|intcomma }} 원 {{ product.register_date|date:'Y-m-d H:i' }} {% endf.. 2020. 8. 12.
[view] 상품 등록하기, 상세 보기 상품 등록 html 생성 우선, product앱의 templates 폴더에 상품 등록 html을 만들어 주세요. forms.py 생성 product 앱에 forms.py도 생성해 주세요!! forms.py를 생성하셨으면 코드를 아래와 같이 입력해주세요. 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 from django import forms from .models import Product class RegisterForm(forms.Form): name = forms.CharField( error_messages={ 'required': '상품명.. 2020. 7. 30.
[view] 회원 가입, 로그인 만들기 먼저 코딩을 하기에 앞서 필요한 템플릿을 만들어 주세요 fcuser > templates > base.html 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 {% block contents %} {% endblock %} Colored by Color Scripter fcuser > template > index.html 1 2 3 4 5 6 {% extends "base.html" %} {% block contents %} Hello world! {{ email }} {% endblock %} fcuser > template > register.html 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18.. 2020. 7. 24.