목록전체 글 (462)
hyeonga_code

- 상속 테이블 1. 장고 실행 2.앱 생성 3. 상속 클래스 테이블 생성 > 'models.py' 'models.py' ===== 1 2 3 4 5 6 7 8 9 10 from django.db import models # Create your models here. class Board(models.Model): subject = models.CharField(max_length=100) writer = models.CharField(max_length=100) content = models.TextField() def __str__(self): return f"{self.writer} 가 작성한 {self.subject}" cs 갑자기 보드를 참조하게 됨 보드는 리플라이에게 역참조지시자를 사용하여 ..

- 계정 비밀번호 변경 1. 업데이트 페이지에 버튼 생성 > > 'update.html' 'update.html' ===== 1 2 3 4 5 6 UPDATE PAGE Change Password Colored by Color Scripter cs 2. 경로 설정 > 'urls.py' 'urls.py' ===== 1 2 3 4 5 6 from django.urls import path, include from . import views urlpatterns = [ path('chpass/', views.chpass, name="chpass") ] Colored by Color Scripter cs 3. 함수 설정 > 'views.py' 'views.py' ===== 1 2 3 4 5 6 7 8 9 10 ..

- 계정 프로필 수정 1. 프로필 페이지에 수정 버튼 생성 > > 'profile.html' 'profile.html' ===== 1 2 3 4 5 PROFILE PAGE Update Colored by Color Scripter cs 2. 경로 설정 > 'urls.py' 'urls.py' ===== 1 2 3 4 5 6 from django.urls import path, include from . import views urlpatterns = [ path('update/', views.update, name='update'), ] Colored by Color Scripter cs 3. 함수 생성 > 'views.py' 'views.py' ===== 1 2 3 4 5 6 from django.sho..

- 계정 회원가입 1. 메인페이지에 회원가입 버튼 생성 > > 'index.html' 'index.html' ===== 1 2 3 4 5 6 7 8 MAIN PAGE {% if request.user.is_authenticated %} {% else %} Signup {% endif %} Colored by Color Scripter cs 2. 경로 설정 > 'urls.py' 'urls.py' ===== 1 2 3 4 5 6 from django.urls import path, include from . import views urlpatterns = [ path('signup/', views.signup, name='signup'), ] Colored by Color Scripter cs 3. 회원가입..

- 계정 삭제 기능 1. 프로필 페이지에서 계정 삭제 > > 'profile.html' 'profile.html' ===== 1 2 3 4 5 PROFILE PAGE Delete cs 2. 경로 설정 > 'urls.py' 'urls.py' ===== 1 2 3 4 5 6 from django.urls import path, include from . import views urlpatterns = [ path('delete/', views.delete, name='delete'), ] cs 3. 함수 설정 > 'views.py' 'views.py' ===== 1 2 3 4 5 6 from django.shortcuts import render, redirect from django.contrib.auth..

- 계정 프로필 페이지 1. 로그인 시, 프로필 확인 버튼 생성 > > 'index.html' 'index.html' ===== 1 2 3 4 5 6 7 8 MAIN PAGE {% if request.user.is_authenticated %} Profile {% else %} {% endif %} Colored by Color Scripter cs 2. 경로 설정 > 'urls.py' 'urls.py' ===== 1 2 3 4 5 6 from django.urls import path, include from . import views urlpatterns = [ path('profile/', views.profile, name='profile'), ] Colored by Color Scripter c..

- 계정 로그아웃 기능 1. 로그아웃 버튼 생성 > > 'index.html' 'index.html' ===== 1 2 3 4 5 6 7 8 9 10 11 h1>MAIN PAGE {% if request.user.is_authenticated %} {{ request.user }} Welcome!! Logout {% else %} {% endif %} Log in cs 2. 경로 설정 > 'urls.py' 'urls.py' ==== 1 2 3 4 5 6 7 from django.urls import path, include from . import views urlpatterns = [ path('index/logout/', views.ulogout, name='logout'), #??? 왜 index/..

- 계정_로그인 페이지 1. 로그인 페이지 생성 > 'urls.py' 'urls.py' ===== 1 2 3 4 5 6 7 8 from django.contrib import admin from django.urls import path, include urlpatterns = [ path('admin/', admin.site.urls), path('adm/', include('adm.urls')), ] Colored by Color Scripter cs 2. 경로 설정 > 'urls.py' 'urls.py' ===== 1 2 3 4 5 6 7 8 from django.urls import path, include from . import views urlpatterns = [ path('index/',..

- 테이블 이미지값 1. 기본 설정값 > 'settings.py' 'settings' ===== 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 TEMPLATES = [ 'DIRS': [BASE_DIR/'templates'] ] INSTALLED_APPS = [ 'fname.apps.FnameConfig' ] MEDIA_URL = '/media/' MEDIA_ROOT = BASE_DIR/"media" #_ path와 dirs 설정 혼합 ''' static(A,B) A로 시작하는 요청인지 B에서 파일을 찾겠다 B(폴더)에서 A파일을 찾을 것 A = /media/ B = BASE_DIR/media 어떤 사진이든 url 추가하지 않아도 불러올 수 있음 ''' Colored by Color..

- 테이블 삭제 1. 사진에 삭제 링크 작성 > > 'detail.html' 'detail.html' ===== 1 2 3 4 5 6 7 8 9 10 11 {{f1.c_name}} CODE : {{f1.c_code}} + 사진 클릭 시, 데이터 삭제 #_ 추가 DETAIL {{f.c_content}} Update 'urls.py' 'urls.py' ===== 1 2 3 4 5 6 7 8 9 10 11 from django.urls import path from . import views urlpatterns=[ path('index/', views.index, name='index' ), path('create/', views.create, name='create'), path('detail/', vie..