분류 전체보기502 [Django] 게시판 생성 📌 settingd.py 내용 추가 """ Django settings for study1 project. Generated by 'django-admin startproject' using Django 4.1.4. For more information on this file, see For the full list of settings and their values, see """ from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsui.. 2023. 4. 27. [Django] 비밀번호 수정 📌 passwordform.html {% csrf_token %} 비밀번호 변경 현재 비밀번호 변경 비밀번호 변경 비밀번호 재입력 📌 passoword.html 📌 urls.py 내용 추가 # -*- coding: utf-8 -*- """ Created on Wed Dec 21 10:19:40 2022 @author: KITCOOP member/urls.py """ from django.urls import path from . import views # urlpatterns=[ # 요청시 view.py # 의 login 함수 실행 path("login/",views.login, name="login"), # path('join/', views.join,name='join'), path('main/', .. 2023. 4. 27. [Django] 파일 업로드 📌 join.html {% extends "base1.html" %} {# 한줄주석#} {% block content %} {% csrf_token %} 사진등록 아이디 비밀번호 이름 성별 남 여 전화번호 이메일 {% endblock %} 📌 views.py picture 추가부분 def picture(request) : if request.method != 'POST' : return render(request,'member/pictureform.html') else : pass BASE_DIR/file/picture 폴더 생성 : 이미지 업로드 폴더 📌 settings.py 내용 추가 """ Django settings for study1 project. Generated by 'django-admi.. 2023. 4. 27. [Django] 회원탈퇴 📌 views.py 추가부분 def delete(request,id) : try: login = request.session["login"] except: context = {"msg":"로그인하세요","url":"../../login"} return render(request,"alert.html",context) else : context = {"msg" : "본인만 가능합니다.",\\ "url":"../../main"} return render(request,"alert.html",context) def delete_rtn(request,id) : if request.method !="POST" : member = Member.object.get(id=id) return render(request,.. 2023. 4. 27. [Django] 회원가입, 로그아웃, 업데이트 📌 veiws.py main 아래 추가부분 def logout(request) : auth.logout(request) #세션종료 return HttpResponseRedirect("../login/") # urls.py : info// => info요청 url에서 id값을 id를 매개변수로 전달 def info(request,id) : try : login = request.session["login"] except : # 로그아웃상태. context = {"msg":"로그인하세요","url":"../../login"} return render(request,"alert.html",context) else : #로그인 된 경우 if login == id or login =='admin' : member.. 2023. 4. 27. [Django] main페이지 생성 📌 main.html 내용 수정 **{% extends "base1.html" %}** {% block content %} {%if request.session.login %} {{request.session.login}}로 로그인 되었습니다. 로그아웃 회원정보보기 {% if request.session.login == 'admin'%} 회원목록 보기 {% endif %} {% else %} {# 로그인 안된 경우 #} {% endif %} {% endblock content %} 📌 member/urls.py 내용 수정 # -*- coding: utf-8 -*- """ Created on Wed Dec 21 10:19:40 2022 @author:KITCOOP member/urls.py """ from.. 2023. 4. 27. [Django] 이미지 연동 📌 settings.py 내용 수정 """ Django settings for study1 project. Generated by 'django-admin startproject' using Django 4.1.4. For more information on this file, see For the full list of settings and their values, see """ from pathlib import Path # Build paths inside the project like this: BASE_DIR / 'subdir'. BASE_DIR = Path(__file__).resolve().parent.parent # Quick-start development settings - unsui.. 2023. 4. 27. [Django] 로그인 오류 시 알람 처리 📌 views.py 내용 수정 from django.shortcuts import render from .models import Member from django.http import HttpResponseRedirect # Create your views here. # member/views.py # 127.0.0.1:8000/member/login 요청시 호출되는 함수 **def login(request) : if request.method != "POST" : return render(request, "member/login.html") else : id1 = request.POST["id"] pass1 = request.POST["pass"] try : # 입력된 id값으로 Member 객체에서.. 2023. 4. 27. 이전 1 ··· 11 12 13 14 15 16 17 ··· 63 다음