From 6593a4ec6405db422aa8fc14f40b08eca656441e Mon Sep 17 00:00:00 2001 From: LvJz21 Date: Sun, 21 Aug 2022 12:51:00 +0900 Subject: [PATCH 1/6] =?UTF-8?q?=EB=A7=88=EC=9D=B4=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80css=EA=B9=8C=EC=A7=80=EB=A7=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- diaryProject/Account/templates/login.html | 2 +- diaryProject/Account/templates/signup.html | 2 +- diaryProject/MyPage/__init__.py | 0 diaryProject/MyPage/admin.py | 3 + diaryProject/MyPage/apps.py | 6 + diaryProject/MyPage/models.py | 3 + diaryProject/MyPage/static/calendar.css | 92 ++++++++++ diaryProject/MyPage/static/js/calendar.js | 110 ++++++++++++ diaryProject/MyPage/static/js/reverse.js | 47 +++++ diaryProject/MyPage/static/mypage.css | 162 ++++++++++++++++++ diaryProject/MyPage/templates/mypage.html | 56 ++++++ diaryProject/MyPage/tests.py | 3 + diaryProject/MyPage/urls.py | 24 +++ diaryProject/MyPage/views.py | 5 + diaryProject/db.sqlite3 | Bin 159744 -> 159744 bytes .../templates/{ => diaryApp}/base.html | 0 diaryProject/diaryApp/templates/index.html | 2 +- diaryProject/diaryProject/settings.py | 1 + diaryProject/diaryProject/urls.py | 1 + 19 files changed, 516 insertions(+), 3 deletions(-) create mode 100644 diaryProject/MyPage/__init__.py create mode 100644 diaryProject/MyPage/admin.py create mode 100644 diaryProject/MyPage/apps.py create mode 100644 diaryProject/MyPage/models.py create mode 100644 diaryProject/MyPage/static/calendar.css create mode 100644 diaryProject/MyPage/static/js/calendar.js create mode 100644 diaryProject/MyPage/static/js/reverse.js create mode 100644 diaryProject/MyPage/static/mypage.css create mode 100644 diaryProject/MyPage/templates/mypage.html create mode 100644 diaryProject/MyPage/tests.py create mode 100644 diaryProject/MyPage/urls.py create mode 100644 diaryProject/MyPage/views.py rename diaryProject/diaryApp/templates/{ => diaryApp}/base.html (100%) diff --git a/diaryProject/Account/templates/login.html b/diaryProject/Account/templates/login.html index 64cbe3e..c7387ee 100644 --- a/diaryProject/Account/templates/login.html +++ b/diaryProject/Account/templates/login.html @@ -1,4 +1,4 @@ -{% extends 'base.html' %} +{% extends 'diaryApp/base.html' %} {% load static %} {% block style %} diff --git a/diaryProject/Account/templates/signup.html b/diaryProject/Account/templates/signup.html index e605150..d23ead4 100644 --- a/diaryProject/Account/templates/signup.html +++ b/diaryProject/Account/templates/signup.html @@ -1,4 +1,4 @@ -{% extends 'base.html' %} +{% extends 'diaryApp/base.html' %} {% load static %} {% block style %} diff --git a/diaryProject/MyPage/__init__.py b/diaryProject/MyPage/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/diaryProject/MyPage/admin.py b/diaryProject/MyPage/admin.py new file mode 100644 index 0000000..8c38f3f --- /dev/null +++ b/diaryProject/MyPage/admin.py @@ -0,0 +1,3 @@ +from django.contrib import admin + +# Register your models here. diff --git a/diaryProject/MyPage/apps.py b/diaryProject/MyPage/apps.py new file mode 100644 index 0000000..7096ef3 --- /dev/null +++ b/diaryProject/MyPage/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class MypageConfig(AppConfig): + default_auto_field = 'django.db.models.BigAutoField' + name = 'MyPage' diff --git a/diaryProject/MyPage/models.py b/diaryProject/MyPage/models.py new file mode 100644 index 0000000..71a8362 --- /dev/null +++ b/diaryProject/MyPage/models.py @@ -0,0 +1,3 @@ +from django.db import models + +# Create your models here. diff --git a/diaryProject/MyPage/static/calendar.css b/diaryProject/MyPage/static/calendar.css new file mode 100644 index 0000000..89ec8fc --- /dev/null +++ b/diaryProject/MyPage/static/calendar.css @@ -0,0 +1,92 @@ +* { + z-index: 10; +} + +.calender { + position: relative; +} + +.days { + display: flex; +} + +.day { + padding-top: 8px; + padding-bottom: 3px; + width: calc(98%/7); + padding-left: 0.5px; + text-align: center; + transition: all .3s; + color: white; + font-weight: bold; +} + +.dates { + display: flex; + width: 100%; + flex-flow: row wrap; +} + +.date { + cursor: pointer; + padding: 9px 4px; + margin: 4px; + width: 30px; + text-align: center; + background-color: white; + border: 1px solid black; + border-radius: 5px; + transition: all .3s; + font-weight: bold; +} + +.go-today { + width: 80%; + border-left: 1px solid #333333; + border-right: 1px solid #333333; +} + +.nav-btn { + width: 20px; + height: 20px; + border: none; + font-size: 16px; + line-height: 15px; + background-color: transparent; + cursor: pointer; +} + +.day:nth-child(7n+1), .date:nth-child(7n+1) { + color: #d13e3e; +} + +.day:nth-child(7n), .date:nth-child(7n) { + color: #396ee2; +} + +.today { + position: relative; + background-color: #fffc1c96; +} + +.selected { + background-color: black; + color: #c0bebe !important; +} + +.other { + color: rgb(168, 164, 164) !important; +} + +.date_event { + display: block; + width: 10px; + height: 10px; + background-color: red; + margin: auto; + border-radius: 100%; +} + +.event-itm { + font-size: 0; +} \ No newline at end of file diff --git a/diaryProject/MyPage/static/js/calendar.js b/diaryProject/MyPage/static/js/calendar.js new file mode 100644 index 0000000..5197916 --- /dev/null +++ b/diaryProject/MyPage/static/js/calendar.js @@ -0,0 +1,110 @@ +let date = new Date(); +//Date 객체 생성 (밀리초 정수 값까지 담아둠) + +/* 캘린더 생성 함수 */ +const renderCalendar = () => { + const viewYear = date.getFullYear(); + //현지시간 기준 연도 + const viewMonth = date.getMonth(); + //현지시간 기준 (월은 0부터 시작하는 것 주의!) + + document.querySelector('.year').textContent = `${viewYear}`; + document.querySelector('.month').textContent = `${viewMonth + 1}`; + + //파라미터 = year, month, date, hours, minutes, seconds, ms (year, month만 생략가능) + const prevLast = new Date(viewYear, viewMonth, 0); + const thisLast = new Date(viewYear, viewMonth + 1, 0); + //해당 월의 마지막 날짜 + + const PrevDate = prevLast.getDate(); + console.log(PrevDate) + const PrevDay = prevLast.getDay(); + //일요일 = 0 + + const ThisDate = thisLast.getDate(); + const ThisDay = thisLast.getDay(); + + const prevDates = []; + const thisDates = [...Array(ThisDate + 1).keys()].slice(1); + // keys() 배열의 각 인덱스를 키 값으로 가지는 새로운 Array Iterator 객체를 반환 + // slice(begin, end) 매개변수는 optional, 기본은 0, begin~end까지 얕은 복사본 (end제외) + const nextDates = []; + + /* 기본 규격으로 이루어진 칸 중 지난달과 연결된 남은 칸 */ + + //if 조건문 = 지난달 마지막날이 '월요일'이 아니면 ) + if (PrevDate !== 6){ + for (let i=0; i < PrevDay + 1; i++){ + prevDates.unshift(PrevDate - i) + } + } + + /* 기본 규격으로 이루어진 칸 중 다음달과 연결된 칸 */ + for (let i=1; i < 7 - ThisDay; i++){ + nextDates.push(i); + } + + const dates = prevDates.concat(thisDates, nextDates); + // 인자로 주어진 배열이나 값들을 기존 배열에 합쳐서 새 배열 반환 (남은 지난 달 날짜들 + 이번 달 날짜들 + 남은 다음 달 날짜들) + + const firstDateIndex = dates.indexOf(1); + // '1'일이 시작되는 게 몇 번째인지 (지난 달 + 이번 달 + 다음 달) 합쳐둔 날짜 배열에서 + // indexOf니까 제일 처음 나오는 '1'을 찾음 = 이번 달 기준의 '1' + const lastDateIndex = dates.lastIndexOf(ThisDate); + // 이번 달의 '31일 또는 30일' = 마지막날이 몇 번째인지 + // lastIndexOf니까 지난 달의 마지막 날짜를 건너뛰고 이번 달의 마지막 날만 찾음 + + + + dates.forEach((date, i) => { + const condition = i >= firstDateIndex && i < lastDateIndex + 1 ?'this':'other'; + //이번달이면 this, 아니면 other의 문자열을 채움 + // date this 또는 date other이라는 클래스를 갖는 div태그를 생성 - 내용은 date + dates[i] = `
${date}
`; + }); + + // dates.forEach((date, i)=>{ + // const condition = i>= firstDateIndex && i < lastDateIndex + 1 ? + // 'this': + // 'other'; + // dates[i] = ` + //
+ //
+ // ${date} + //
+ + //
+ //
EVENT
+ //
+ //
+ // `; + // }); + + + document.querySelector('.dates').innerHTML = dates.join(''); + //배열의 모든 요소를 연결하여 하나의 문자열을 만듦, 매개변수 = seperator + + const today = new Date(); + if (viewMonth === today.getMonth() && viewYear === today.getFullYear()){ + for (let date of document.querySelectorAll('.date-itm')){ + if (+date.innerText === today.getDate()){ + date.parentNode.classList.add('today') + break; + } + } + } +}; + +renderCalendar(); +const prevMonth = () => { + date.setMonth(date.getMonth() - 1); + renderCalendar(); +} +const nextMonth = () => { + date.setMonth(date.getMonth() + 1); + renderCalendar(); +} +const goToday = () => { + date = new Date(); + renderCalendar(); +} \ No newline at end of file diff --git a/diaryProject/MyPage/static/js/reverse.js b/diaryProject/MyPage/static/js/reverse.js new file mode 100644 index 0000000..7b1d65b --- /dev/null +++ b/diaryProject/MyPage/static/js/reverse.js @@ -0,0 +1,47 @@ +const touchedTab = document.querySelector('.touched-wrapper'); +const exitBtn = document.querySelector('touched-close'); + +const selectDate = []; + +const dateFunc = () => { + const dates = document.querySelectorAll('.date'); + const year = document.querySelector('.year'); + const month = document.querySelector('.month'); + dates.forEach((element)=>{ + element.addEventListener('click', ()=>{ + if(element.classList.contains('other') || element.classList('selected')){ + dates.forEach((item)=>{ item.classList.remove('selected');}); + element.classList.remove('selected'); + selectDate.length = 0; + }else if(selectDate.length > 0){ + dates.forEach((item)=>{item.classList.remove('selected');}); + selectDate.push([year.innerHTML, month.innerHTML, element.innerHTML]); + touchedTab.classList.add('open'); + }else { + element.classList.add('selected'); + selectDate.push([year.innerHTML, month.innerHTML, element.innerHTML]); + touchedTab.classList.add('open'); + } + }); + }); +}; + +/* 달력 초기화 함수 */ +const reset = () => { + selectDate.length = 0; + dateFunc(); +} + +window.onload = () => { + const navBtn = document.querySelectorAll('.nav-btn'); + navBtn.forEach(info => { + if(info.classList.contains('month-prev')){ + info.addEventListener('click', ()=>{prevMonth(); reset();}) + }else if(info.classList.contains('go-today')){ + info.addEventListener('click', ()=>{goToday(); reset();}) + }else if(info.classList.contains('month-next')){ + info.addEventListener('click', ()=>{nextMonth(); reset();}) + } + }); + reset(); +} \ No newline at end of file diff --git a/diaryProject/MyPage/static/mypage.css b/diaryProject/MyPage/static/mypage.css new file mode 100644 index 0000000..ee4b643 --- /dev/null +++ b/diaryProject/MyPage/static/mypage.css @@ -0,0 +1,162 @@ +* { + z-index: 10; +} + +.basic-info { + width: 100%; + height: 20%; + display: flex; + flex-direction: row; + align-items: center; +} + +.profile { + width: 100px; + height: 100px; + border-radius: 100%; + border: 10px solid #fadc72; + background-color: white; + margin-left: 40px; +} + +.name-wrap { + margin-left: 10px; +} + +.nick-name { + font-size: 30px; + font-weight: bolder; + margin-left: 10px; + color: white; +} + +.level-name { + background-color: #fadc72; + padding: 4px 4px; + border-radius: 10px; +} + +.middle-info { + width: 100%; + height: 30%; + margin: 0px auto; + display: flex; + flex-direction: row; +} + + +.fishing-bag > img { + margin-top: 0%; + margin-left: 20px; + width: 85%; + height: 90%; +} + +.calendar { + width: 90%; + margin: 0px auto; + height: 40%; + background-color: rgba(255, 255, 255, 0.384); + border-radius: 10px; +} + +.ym-wrapper { + background-color: aqua; + position: absolute; + top: -20px; + height: 10px; + width: 100%; + position: relative; +} + +.footer { + position: absolute; + width: 75%; + height: 10%; + margin: 0px auto; + position: relative; +} + +.main-btn { + width: 30%; + height: 100%; + position: relative; + overflow: hidden; + margin: 0px auto; +} + + +.main-btn img { + position: absolute; + width: 100%; + height: 140%; + margin: 0px auto; +} + +.main-btn img:hover { + position: absolute; + width: 100%; + height: 140%; + margin: 0px auto; + opacity: 60%; + +} + +.flex-col { + display: flex; + flex-direction: column; +} + +.year { + color: yellowgreen; + font-size: 20px; + font-weight: bold; + margin: 0px auto; +} + +.calendar_nav { + + display: flex; + flex-direction: row; + justify-content: center; +} + +.month { + color: #fadc72; + font-size: 25px; + font-weight: bold; +} + +.nav-btn { + font-weight: bolder; + margin-right: 9px; + margin-top: 7px; +} + +.this-month { + top: 10px; + padding: 10px; + font-size: 16px; + font-weight: bold; +} + +.total-num { + font-size: 40px; + margin-left: 20px; +} + +.count { + font-size: 20px; +} + + +.monthly-total { + position: relative; + margin-top: 5%; + width: 90%; + height: 60%; + background-color: white; + border-radius: 10px; + margin-right: 20px; + position: relative; +} diff --git a/diaryProject/MyPage/templates/mypage.html b/diaryProject/MyPage/templates/mypage.html new file mode 100644 index 0000000..e0a4562 --- /dev/null +++ b/diaryProject/MyPage/templates/mypage.html @@ -0,0 +1,56 @@ +{% extends 'diaryApp/base.html' %} +{% load static %} +{% block style %} + + +{% endblock style %} +{% block content %} +
+
+
+
Jihoo21_m
+
발자국을 남긴 우주인
+
+
+
+
+ +
+
+
+
+
+ +
+ +
+
+
이달의 탐사
+ 11 + +
+
+
+
+
+
SUN
+
MON
+
TUE
+
WED
+
THU
+
FRI
+
SAT
+
+
+
+ + + + +{% endblock content %} \ No newline at end of file diff --git a/diaryProject/MyPage/tests.py b/diaryProject/MyPage/tests.py new file mode 100644 index 0000000..7ce503c --- /dev/null +++ b/diaryProject/MyPage/tests.py @@ -0,0 +1,3 @@ +from django.test import TestCase + +# Create your tests here. diff --git a/diaryProject/MyPage/urls.py b/diaryProject/MyPage/urls.py new file mode 100644 index 0000000..176f39d --- /dev/null +++ b/diaryProject/MyPage/urls.py @@ -0,0 +1,24 @@ +"""diaryProject URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/4.1/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: path('', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: path('', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.urls import include, path + 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) +""" +from django.contrib import admin +from django.urls import path, include +import MyPage.views +from django.conf import settings + +urlpatterns = [ + + path('', MyPage.views.mypage, name='mypage'), +] diff --git a/diaryProject/MyPage/views.py b/diaryProject/MyPage/views.py new file mode 100644 index 0000000..538cc1e --- /dev/null +++ b/diaryProject/MyPage/views.py @@ -0,0 +1,5 @@ +from django.shortcuts import render + +# Create your views here. +def mypage(request): + return render(request, 'mypage.html') \ No newline at end of file diff --git a/diaryProject/db.sqlite3 b/diaryProject/db.sqlite3 index d7fe8a7792fe9371d6b277eff0e8fb6aa7a83956..ab7eaee571d09a71450344f5299f167035b1795c 100644 GIT binary patch delta 234 zcmZp8z}fJCbAmKu_e2?I)@}y9aIcLiZ}b>hHV5i&HsE35ox;E$&9{1G&8g`GB7gIHL%b%GEguwurlSgv@){Lv$Qm}FfiUMm-md3hlT$<1OIvc&-}0W c?`#$<*w4?)!z{}P)6UX-r+)jLdPbEG0DJdFjsO4v delta 76 zcmV-S0JHyq;0b`>36L8Bijf>c1&RPJPkpgu>@EQVvr#XzFbV?>9smzp4yg_vvmqc5 i4znI^<^c)=58MC`^AG9|+_MpY&JTm!f4AI!0VMFZk{XQw diff --git a/diaryProject/diaryApp/templates/base.html b/diaryProject/diaryApp/templates/diaryApp/base.html similarity index 100% rename from diaryProject/diaryApp/templates/base.html rename to diaryProject/diaryApp/templates/diaryApp/base.html diff --git a/diaryProject/diaryApp/templates/index.html b/diaryProject/diaryApp/templates/index.html index b959eee..dc01fa5 100644 --- a/diaryProject/diaryApp/templates/index.html +++ b/diaryProject/diaryApp/templates/index.html @@ -1,4 +1,4 @@ -{% extends 'base.html' %} +{% extends 'diaryApp/base.html' %} {% load static %} {% block style %} diff --git a/diaryProject/diaryProject/settings.py b/diaryProject/diaryProject/settings.py index 3a865d2..b631eae 100644 --- a/diaryProject/diaryProject/settings.py +++ b/diaryProject/diaryProject/settings.py @@ -40,6 +40,7 @@ 'django.contrib.staticfiles', 'diaryApp', 'Account', + 'MyPage', ] MIDDLEWARE = [ diff --git a/diaryProject/diaryProject/urls.py b/diaryProject/diaryProject/urls.py index 550fe75..66ba7e4 100644 --- a/diaryProject/diaryProject/urls.py +++ b/diaryProject/diaryProject/urls.py @@ -27,6 +27,7 @@ path('detail/', views.detail, name='detail'), path('diary', DiaryView, name="diary"), path('home/', include('diaryApp.urls')), + path('mypage/', include('MyPage.urls')), ] if settings.DEBUG: From 46b916df63e05276740c456cf122892123f603dd Mon Sep 17 00:00:00 2001 From: LvJz21 Date: Sun, 21 Aug 2022 12:57:07 +0900 Subject: [PATCH 2/6] base directory .. --- diaryProject/diaryApp/templates/{diaryApp => }/base.html | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename diaryProject/diaryApp/templates/{diaryApp => }/base.html (100%) diff --git a/diaryProject/diaryApp/templates/diaryApp/base.html b/diaryProject/diaryApp/templates/base.html similarity index 100% rename from diaryProject/diaryApp/templates/diaryApp/base.html rename to diaryProject/diaryApp/templates/base.html From 770c26eb7861b60dba00c75cada97fec71b9c346 Mon Sep 17 00:00:00 2001 From: LvJz21 Date: Sun, 21 Aug 2022 12:58:36 +0900 Subject: [PATCH 3/6] db migrate --- diaryProject/db.sqlite3 | Bin 159744 -> 176128 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/diaryProject/db.sqlite3 b/diaryProject/db.sqlite3 index ab7eaee571d09a71450344f5299f167035b1795c..e4f1705c1eb694633e63754d66b42c91d8ba9c0e 100644 GIT binary patch delta 913 zcmZp8z}fJCYl5_3F9QREHW0%=#zY-s(Ow3V5M99cc!NAzc)WXWp zRL{`T$k4)Y^LohuF-FNIgKY+kECS4Y%qOO^J1{n}uzzK?-`?xMSRxOyfS<*mfwh+3123!BTqK>5pDyn-<*D&(i}+~s_cC%OIUcBD;e#Xf|(0}*7GuYGfiR?5!cpc zY>q5ROv*`xIwQWIC_gO|gRAZwf?ueQkB)*;PHI_dj*>!VUP)?tY7tm;x}P(nEL*6bXJDx7^uTmRTQ&v; zR_j3R>57?*5~^sn#2casXfQCa{Fy#2iSafEn>SD=5KOO3X1un&(}B@}d3%34W8sfw z4om`zJ_sy2ATVhHiv$;k00X}&A1iMmk2UuaZUN3eoO?MIa0mcHqSVBa{G#~Gl=x&5OY%Gd35aL=o6b6w5WSM$hyOX^i*SY`xgTp&^C}lj#-iN}df{HIKprFiZy?Da&i|WNc4J8szo3Gj ze~1E5L{yd+NJ?<7pUf^`xLHx5oOAPf$pA4%i6(<>28=8M%z_M^)7c#uo3{I>Fgh@A zKk3Y9A;Zp`%OJ!wiD5cl0;2>U(|w~Sa_K$8GSc93P>{QGUqaSiyH$;S8-!w z#un|8#H5_mywvje_>|1VqDsetg7}=w?9^hg(DaBoOtP#HX6YQJzth#`Gu`3=I*Ug< nP?NFIG&66zz-%TlmhJuNjD Date: Sun, 21 Aug 2022 13:03:43 +0900 Subject: [PATCH 4/6] base extend --- diaryProject/Account/templates/login.html | 2 +- diaryProject/MyPage/templates/mypage.html | 2 +- diaryProject/diaryApp/templates/fishing.html | 2 +- diaryProject/diaryApp/templates/index.html | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/diaryProject/Account/templates/login.html b/diaryProject/Account/templates/login.html index c7387ee..64cbe3e 100644 --- a/diaryProject/Account/templates/login.html +++ b/diaryProject/Account/templates/login.html @@ -1,4 +1,4 @@ -{% extends 'diaryApp/base.html' %} +{% extends 'base.html' %} {% load static %} {% block style %} diff --git a/diaryProject/MyPage/templates/mypage.html b/diaryProject/MyPage/templates/mypage.html index e0a4562..84a696d 100644 --- a/diaryProject/MyPage/templates/mypage.html +++ b/diaryProject/MyPage/templates/mypage.html @@ -1,4 +1,4 @@ -{% extends 'diaryApp/base.html' %} +{% extends 'base.html' %} {% load static %} {% block style %} diff --git a/diaryProject/diaryApp/templates/fishing.html b/diaryProject/diaryApp/templates/fishing.html index dc50c6a..0e02bfb 100644 --- a/diaryProject/diaryApp/templates/fishing.html +++ b/diaryProject/diaryApp/templates/fishing.html @@ -31,7 +31,7 @@

Q. 오늘 하루 중 가장 마음에 들었던 일은?

- + diff --git a/diaryProject/diaryApp/templates/index.html b/diaryProject/diaryApp/templates/index.html index 603eb67..a6f9b0c 100644 --- a/diaryProject/diaryApp/templates/index.html +++ b/diaryProject/diaryApp/templates/index.html @@ -1,4 +1,4 @@ -{% extends 'diaryApp/base.html' %} +{% extends 'base.html' %} {% load static %} {% block style %} From b6aa8747f9c5d4db63d1c421013c91dd9f8ebfa1 Mon Sep 17 00:00:00 2001 From: LvJz21 Date: Sun, 21 Aug 2022 15:49:51 +0900 Subject: [PATCH 5/6] =?UTF-8?q?=EB=A7=88=EC=9D=B4=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=EB=8D=B0=EC=9D=B4=ED=84=B0=EC=97=B0=EA=B2=B0=EC=A4=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- diaryProject/Account/models.py | 2 +- diaryProject/Account/templates/login.html | 2 +- diaryProject/MyPage/static/mypage.css | 11 ++-- diaryProject/MyPage/templates/mypage.html | 56 ++++++++++++++++-- diaryProject/MyPage/urls.py | 3 +- diaryProject/MyPage/views.py | 27 ++++++++- diaryProject/db.sqlite3 | Bin 176128 -> 176128 bytes .../templates/{ => diaryApp}/base.html | 0 diaryProject/diaryApp/templates/index.html | 2 +- 9 files changed, 87 insertions(+), 16 deletions(-) rename diaryProject/diaryApp/templates/{ => diaryApp}/base.html (100%) diff --git a/diaryProject/Account/models.py b/diaryProject/Account/models.py index 181ac96..a439c82 100644 --- a/diaryProject/Account/models.py +++ b/diaryProject/Account/models.py @@ -24,4 +24,4 @@ class Diary(models.Model): creator = models.ForeignKey(User, on_delete=models.CASCADE, related_name="creator") def __str__(self): - return self.creator.name + return self.creator.username diff --git a/diaryProject/Account/templates/login.html b/diaryProject/Account/templates/login.html index 64cbe3e..c7387ee 100644 --- a/diaryProject/Account/templates/login.html +++ b/diaryProject/Account/templates/login.html @@ -1,4 +1,4 @@ -{% extends 'base.html' %} +{% extends 'diaryApp/base.html' %} {% load static %} {% block style %} diff --git a/diaryProject/MyPage/static/mypage.css b/diaryProject/MyPage/static/mypage.css index ee4b643..0199a79 100644 --- a/diaryProject/MyPage/static/mypage.css +++ b/diaryProject/MyPage/static/mypage.css @@ -17,6 +17,7 @@ border: 10px solid #fadc72; background-color: white; margin-left: 40px; + margin-top: 10%; } .name-wrap { @@ -31,6 +32,7 @@ } .level-name { + margin-top: 5%; background-color: #fadc72; padding: 4px 4px; border-radius: 10px; @@ -46,7 +48,7 @@ .fishing-bag > img { - margin-top: 0%; + margin-top: 10%; margin-left: 20px; width: 85%; height: 90%; @@ -54,7 +56,7 @@ .calendar { width: 90%; - margin: 0px auto; + margin: 10% auto; height: 40%; background-color: rgba(255, 255, 255, 0.384); border-radius: 10px; @@ -152,9 +154,8 @@ .monthly-total { position: relative; - margin-top: 5%; - width: 90%; - height: 60%; + width: 100%; + height: 70%; background-color: white; border-radius: 10px; margin-right: 20px; diff --git a/diaryProject/MyPage/templates/mypage.html b/diaryProject/MyPage/templates/mypage.html index 84a696d..9765eb3 100644 --- a/diaryProject/MyPage/templates/mypage.html +++ b/diaryProject/MyPage/templates/mypage.html @@ -1,4 +1,4 @@ -{% extends 'base.html' %} +{% extends 'diaryApp/base.html' %} {% load static %} {% block style %} @@ -8,7 +8,7 @@
-
Jihoo21_m
+
{{ user.username }}
발자국을 남긴 우주인
@@ -20,9 +20,9 @@
- +
- +
이달의 탐사
@@ -41,6 +41,9 @@
FRI
SAT
+ {% for diary in diarys %} + + {% endfor %}
@@ -53,4 +56,49 @@
+ + + {% endblock content %} \ No newline at end of file diff --git a/diaryProject/MyPage/urls.py b/diaryProject/MyPage/urls.py index 176f39d..7f6fbd2 100644 --- a/diaryProject/MyPage/urls.py +++ b/diaryProject/MyPage/urls.py @@ -20,5 +20,6 @@ urlpatterns = [ - path('', MyPage.views.mypage, name='mypage'), + path('main', MyPage.views.MainMypage, name='mypage'), + path('/', MyPage.views.calendar, name='calendar'), ] diff --git a/diaryProject/MyPage/views.py b/diaryProject/MyPage/views.py index 538cc1e..873e30f 100644 --- a/diaryProject/MyPage/views.py +++ b/diaryProject/MyPage/views.py @@ -1,5 +1,26 @@ from django.shortcuts import render +from django.views.decorators.csrf import csrf_exempt +from django.contrib.auth.decorators import login_required +from diaryApp.models import Diary +from datetime import datetime +import json +def MainMypage(request): + today = datetime.now().date() + # startdate = str(today.year) + '-' + str(today.month).zfill(2) + '-' + '01' + # enddate = str(today.year) + '-' + str(today.month).zfill(2) + '-' + '31' -# Create your views here. -def mypage(request): - return render(request, 'mypage.html') \ No newline at end of file + my_diary = Diary.objects.filter( + creator = request.user, + diary_created_at__month = today.month + ) + return render(request, 'mypage.html', {'diarys' : my_diary}) + +@csrf_exempt +@login_required(login_url='/registration/login') +def calendar(request, YearLooking, MonthLooking): + + + # print(YearLooking) + # print(MonthLooking) + + return render(request, 'mypage.html') diff --git a/diaryProject/db.sqlite3 b/diaryProject/db.sqlite3 index e4f1705c1eb694633e63754d66b42c91d8ba9c0e..c87ba55a08f233eab7867ca8946f43812db4dd87 100644 GIT binary patch delta 2921 zcmai$ZA@F&8OQHEHpXw)#|DDwOA;q!#T~PA&%Nhf-|H&U3^o`D;Vlkbk(iK*yhdc1DcbJT4!1>*7a{M1}@BoUig zT8$s=H`F+FI+0y{*IHd`VHiiXu7TYFfx^S1`+0MgfoE)Q+YWHq!Xa0ZGhRBR=a@^! z0;{)D=bjaKLGbX3M?fwf`vuuAiC&c#c~M#YBK4=Z%9GC#H8C?a&^4JFTGNc!gRbl))>i5v=59Qd$JwL zFUfvU^Q?v499C=6EFPut-LS2iAK%}=T+AK^rHD?Bzj;mQd=oxDY zXL>WS$?)Lh!tq&Nj&z*v^h8fAg!;#a+nqx72hp+mGhPf<0naXD}(YrWRV-Tat@i>CxVav9XDn zPPOmER62QbFc^_91bgwI)E7#2BxaSwJ${t#9$B38i(+qgaG+I1k%948+xh;P z_BNFdM|vjOySpb^!Y`bk%VguJdE622p;}F~imHREohqbiqsmdWQngSuQ#DaFQmv$F zpjx4+MPK36esuH&=yj|~Z)O;VM4qp-gL-a9*z4#VYhw$%>sz*OY6gHt4QSMWMh$4x zfJO~y)SxPV^B@?#cc0bUah;`|f%oAh*aDrlE!*#GKeeT8A=`7@zq$9gH@SK4I9G3d zWc`D6+1hV)TmEjjZfPgWx5|=ht1~eU(bUMY0fFDR`|Hg+%Ud@uyEfL=J}SJmb@l3* zmk-BAMn*>t`&}b9$`H*ajb@=h5)x#G5_ zju7v~sw#_8TWu*Oq-?I-`e^O)=5-R&+uz%~x3+ovMj2lvSBf7auRwh9KF>ZA1D|0z z(mnLx%4_7S+tGy}PnuTzBJV|#PZ8vX8p3mw7j}}{AjUk#&D8`9QBcgMqTu;lIb2Y9 z35!(({|3eJgDY1aTwZ^0`5jUyXN0gQD-DiPFj6^?7X?{vu$!3N(euEMw%hY?G)QDPRd< zxA`kF7eM7^j7LZnWVh)nG=RjtoC>N}Rk6Y=ZsRtI%aIC_kl?N?kvX*I9BEEv6=B|O zD4}T2Inqdpus(OiHo4~{X(UEut9bNe?Dw$_ZS&@4XVXjI%#daG4)ysl_KL_y=3mum zd~vgD_^yrglqt#K*ei$vl9XeBnC>rb?&SH|c_brshxvhvPd6?4k?fUxvZ%=G_y55L z?K%T&U9bFv{Wd&sKo?-kpBL++U$Q^9zo3I3Gw>1oFZ>wZEdP*nKL>|LfrBL2D6kV9 z0FY=Ouo3M99MM)_B^m(a7Q(y)v{WpS9x=>OU?ln?s3cks3`F;X3ZhP+C1O2IxcbKl z_nr&rc@k5Efxm~Z!3g)A@(;N;{@f5asAm{(Nh{S^kWcVo3`oUUt)e#n+aX}m z{(mX|$06X-O3wUNvBdr-?>I}X**|NgT2AruNR$Mb*t5T&Rr%CeYR~?l_v;Z+ zv(z2ioPYPR6IcG9#X9DTyfF$6lg5}2^4=(D$oXmvOtlzbH-GZO?aW;|1oq7NWJxKa z9#<1X&o0Aa%74mAOYn+MmXY3HWniAsn)~k6tvBv&t~5TC<98VsQ@W_|SYH1!3MyPi z09P3J9$X=lpMyC+nYt$(ex1MK$`&M%SAmZuwpthH(YN{5t&O!?uC43j)Vi^8=jyIN ric4COktmZZD#MtKc9PiF&DX#qNMibwAvciE3y$T7klqzQ@#z0Q#EG(V delta 1013 zcmaiyOKcle6o&6yj~&~|%o$TP81>-?X+R}*?%WxB9#SQex_Kz1JX}&9NgU%$n#A!V zP8&4d)a9{)q7YYdAwoz{sbU3aP`v=uWWfT71rlr!m52nJED&9$N~HE$X{)fPdUY4y z`E~wtkM23OO@D3EzjBDX{PE$F+~selu7!d=h#}a5-{E^$h7X`0VsIUDaL|d6J7N%C zMnP}UdOMSup37G3zH&LUFqgNM>apHuMejrH!je^~=X%e20#CYJ3RmCgIMCUC0J~zo z>G^E&Tq%>CF3c4(3#D_;R__twzk=XR@hkDDaK(v)-xIu-+IRt7I)Uo%6sGFCgaE$cua#yjWkf5U8MDhL2j{B; zr>)Uf->9njd76GvJwXYjF`~yP3CqM(sY$fBVdz9Noaah^geA9s8;O64meAL6#J}zP zjrFtP>*kJ)zMJklKYO8KE5)j&sacgQ*|wZ5sHMuxe8rHBa?z-V*S;Hm#h5ck#xxq! z2TqMt22*Ep)z=rQ)qKC5DvsLO(=VmQ78jTE{i%|&Y!&i*{TMN#gyp0uYbK#_-O!VX zgtPr=hg)*P5Q1AU1WhQwDy%wz@)OW~>~XDlx?H2&>RQ-Y`1X|~z+pZrF#5Mekq$g_`I>Z{ LU%`^Y*LL9^s=f-p diff --git a/diaryProject/diaryApp/templates/base.html b/diaryProject/diaryApp/templates/diaryApp/base.html similarity index 100% rename from diaryProject/diaryApp/templates/base.html rename to diaryProject/diaryApp/templates/diaryApp/base.html diff --git a/diaryProject/diaryApp/templates/index.html b/diaryProject/diaryApp/templates/index.html index a6f9b0c..603eb67 100644 --- a/diaryProject/diaryApp/templates/index.html +++ b/diaryProject/diaryApp/templates/index.html @@ -1,4 +1,4 @@ -{% extends 'base.html' %} +{% extends 'diaryApp/base.html' %} {% load static %} {% block style %} From 4511ba037fd8801b08ade59db52510ed48fc0cdf Mon Sep 17 00:00:00 2001 From: LvJz21 Date: Sun, 21 Aug 2022 15:52:14 +0900 Subject: [PATCH 6/6] =?UTF-8?q?=EB=A7=88=EC=9D=B4=ED=8E=98=EC=9D=B4?= =?UTF-8?q?=EC=A7=80=EB=94=94=EB=B9=84=EC=97=B0=EA=B2=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- diaryProject/Account/templates/signup.html | 2 +- diaryProject/MyPage/templates/mypage.html | 2 +- diaryProject/diaryApp/templates/{diaryApp => }/base.html | 0 3 files changed, 2 insertions(+), 2 deletions(-) rename diaryProject/diaryApp/templates/{diaryApp => }/base.html (100%) diff --git a/diaryProject/Account/templates/signup.html b/diaryProject/Account/templates/signup.html index d23ead4..e605150 100644 --- a/diaryProject/Account/templates/signup.html +++ b/diaryProject/Account/templates/signup.html @@ -1,4 +1,4 @@ -{% extends 'diaryApp/base.html' %} +{% extends 'base.html' %} {% load static %} {% block style %} diff --git a/diaryProject/MyPage/templates/mypage.html b/diaryProject/MyPage/templates/mypage.html index 9765eb3..053b513 100644 --- a/diaryProject/MyPage/templates/mypage.html +++ b/diaryProject/MyPage/templates/mypage.html @@ -1,4 +1,4 @@ -{% extends 'diaryApp/base.html' %} +{% extends 'base.html' %} {% load static %} {% block style %} diff --git a/diaryProject/diaryApp/templates/diaryApp/base.html b/diaryProject/diaryApp/templates/base.html similarity index 100% rename from diaryProject/diaryApp/templates/diaryApp/base.html rename to diaryProject/diaryApp/templates/base.html