diff --git a/diaryProject/Account/static/index.css b/diaryProject/Account/static/index.css new file mode 100644 index 0000000..80cf274 --- /dev/null +++ b/diaryProject/Account/static/index.css @@ -0,0 +1,6 @@ +img { + max-width: 200px; + max-height: 200px; + margin: 0 auto; + border-radius: 50%; +} \ No newline at end of file diff --git a/diaryProject/Account/static/signup.css b/diaryProject/Account/static/signup.css new file mode 100644 index 0000000..c3f0122 --- /dev/null +++ b/diaryProject/Account/static/signup.css @@ -0,0 +1,30 @@ + + +.login_btn { + width: 100px; + height: 40px; + left: 68px; + top: 505px; + background: #896AC9; + border-radius: 12px; + border: 0px; + font-weight: bolder; + color: white; + font-size: 20px; +} + +.signup_btn { + display: flex; + justify-content: center; +} + +.signup { + text-decoration: underline; + text-underline-position: under; + text-decoration-color: #896AC9; + margin-left: -150px; +} + +.login { + color: #A5ADB2; +} \ No newline at end of file diff --git a/diaryProject/Account/templates/index.html b/diaryProject/Account/templates/index.html new file mode 100644 index 0000000..33d8f87 --- /dev/null +++ b/diaryProject/Account/templates/index.html @@ -0,0 +1,28 @@ +{% extends 'base.html' %} +{% load static %} +{% block style %} +{% comment %} 여기에 연결할 css 추가 {% endcomment %} +{% endblock style %} +{% block js %} +{% comment %} 여기에 연결할 js - - - + + + + + + +{% endblock content %} diff --git a/diaryProject/MyPage/urls.py b/diaryProject/MyPage/urls.py index 176f39d..5e26ba7 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'), +] \ No newline at end of file diff --git a/diaryProject/MyPage/views.py b/diaryProject/MyPage/views.py index 538cc1e..273a98f 100644 --- a/diaryProject/MyPage/views.py +++ b/diaryProject/MyPage/views.py @@ -1,5 +1,28 @@ 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' + + my_diary = Diary.objects.filter( + creator = request.user, + diary_created_at__month = today.month + ) + + total = my_diary.count() + return render(request, 'mypage.html', {'diarys' : my_diary, 'total':total}) + +@csrf_exempt +@login_required(login_url='/registration/login') +def calendar(request, YearLooking, MonthLooking): + + + # print(YearLooking) + # print(MonthLooking) -# 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 1d16819..9555c9c 100644 Binary files a/diaryProject/db.sqlite3 and b/diaryProject/db.sqlite3 differ diff --git a/diaryProject/diaryApp/__pycache__/views.cpython-39.pyc b/diaryProject/diaryApp/__pycache__/views.cpython-39.pyc index 5ad2338..93ff06e 100644 Binary files a/diaryProject/diaryApp/__pycache__/views.cpython-39.pyc and b/diaryProject/diaryApp/__pycache__/views.cpython-39.pyc differ diff --git a/diaryProject/diaryApp/static/css/background.css b/diaryProject/diaryApp/static/css/background.css new file mode 100644 index 0000000..6eaee5f --- /dev/null +++ b/diaryProject/diaryApp/static/css/background.css @@ -0,0 +1,15 @@ +#background-container { + height: 100%; + width: 100%; + background-color: #161b39; + position: relative; +} + +canvas { + position: absolute; + height: 100%; + width: 100%; + top: 0; + left: 0; + z-index: 0; +} diff --git a/diaryProject/diaryApp/static/css/fishing.css b/diaryProject/diaryApp/static/css/fishing.css index e1b41c8..3560153 100644 --- a/diaryProject/diaryApp/static/css/fishing.css +++ b/diaryProject/diaryApp/static/css/fishing.css @@ -9,7 +9,11 @@ align-items: center; } - +.navigator { + position: absolute; + top: 50px; + left: 300px; +} .astro { height: 50%; width: 100%; @@ -93,6 +97,10 @@ margin-left: 20px; font-size: 21px; } +.random-diary-header p { + margin-left: 20px; + font-size: 18px; +} .random-diary-content { height: 500.5px; width: 100%; diff --git a/diaryProject/diaryApp/static/css/index.css b/diaryProject/diaryApp/static/css/index.css index a087511..880c7fe 100644 --- a/diaryProject/diaryApp/static/css/index.css +++ b/diaryProject/diaryApp/static/css/index.css @@ -15,81 +15,94 @@ body { } */ * { - font-family: 'Laila', sans-serif; + font-family: "Laila", sans-serif; } .modal { - background-image: url("http://localhost:8000/static/img/diary-border.svg"); - background-repeat: no-repeat; - background-position: center; - background-size: contain; + background-image: url("http://localhost:8000/static/img/diary-border.svg"); + background-repeat: no-repeat; + background-position: center; + background-size: contain; } .modal-container { - background: linear-gradient(180deg, #6F46A7 0%, #896AC9 33.85%, #C99DDD 91.15%); + background: linear-gradient( + 180deg, + #6f46a7 0%, + #896ac9 33.85%, + #c99ddd 91.15% + ); } - .container { - width: 100%; - height: 100%; - position: absolute; - z-index: 1; + width: 100%; + height: 100%; + position: absolute; + z-index: 1; } .btn_register button { - width: 246px; - height: 57px; - background: linear-gradient(90deg, #234567 0%, #345678 44.65%, #456789 91.21%); - border-radius: 12px; - border: 0px; - font-weight: bolder; - color: white; - font-size: 20px; - + width: 246px; + height: 57px; + background: linear-gradient( + 90deg, + #234567 0%, + #345678 44.65%, + #456789 91.21% + ); + border-radius: 12px; + border: 0px; + font-weight: bolder; + color: white; + font-size: 20px; } .navbar_logo { - margin-top: -10px; + margin-top: -10px; } .btn_register { - margin-left: 63px; - margin-top: 250px; + margin-left: 63px; + margin-top: 250px; } .shadow { - box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); + box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px 0 rgba(0, 0, 0, 0.06); } - .bg-white { - background-color: rgb(255, 255, 255); + background-color: rgb(255, 255, 255); } .bg-btn { + background-color: #896AC9; } .text-center { - text-align: center; + text-align: center; } .flex { /* display: flex; */ /* left : 90%; +======= + /* display: flex; */ + /* left : 90%; +>>>>>>> 96e7a89ecc0bea52bb430e51eba5d72e98426b23 right: 50%; */ - /* justify-content: center; + /* justify-content: center; flex-direction: column; align-content: center; align-items: center; */ - /* top : 50%; + /* top : 50%; bottom: 50%; */ + font-size: 1em; z-index: 2; } .modal-container { - z-index: 2; + z-index: 2; } .form-inner{ @@ -100,35 +113,22 @@ body { } .createDiary { - display: flex; - flex-direction: column; + display: flex; + flex-direction: column; } -.todoadd{ - display: flex; - flex-direction: column; -} -.todo-input{ - display: flex; - flex-direction: row; - z-index: 500; +.todoadd { + display: flex; + flex-direction: column; } - - -.user_info { - color: white; - display: flex; - flex-direction: column; - justify-content: center; - width: 250px; +.todo-input { + display: flex; + flex-direction: row; + z-index: 500; } -.todo_group { - display: flex; - flex-direction:row; -} +/* .user_info { -.user_info { color: white; display: flex; flex-direction: row; @@ -148,77 +148,117 @@ body { } .logouthref{ margin-right: 15%; + color: white; + display: flex; + flex-direction: column; + justify-content: center; + width: 250px; } .todo_group { - display: flex; - flex-direction:row; + display: flex; + flex-direction: row; +} +<<<<<<< HEAD +======= */ + +.user_info { + color: white; + display: flex; + flex-direction: row; + justify-content: space-between; + width: 250px; + margin-left: 9%; + margin-top: 7%; +} +.links { + display: flex; + flex-direction: row; + justify-content: space-between; + width: 120px; + font-size: small; + margin-left: 85%; + margin-top: 1%; +} +.logouthref { + margin-right: 15%; +} + +.navbar-container { + position: absolute; + margin-right: 10px; } + +.todo_group { + display: flex; + flex-direction: row; +} + .navbar_menu_item { - width: 200px ; - position: absolute; + width: 200px; + position: absolute; } .user_info a { - position: absolute; - right: 50px; + position: absolute; + right: 50px; } .btn-open-modal { - width: 247px; - height: 57px; - color: white; - text-align: center; - align-items: center; + width: 247px; + height: 57px; + color: white; + text-align: center; + align-items: center; } .diary_write_btn { - font-family: 'Noto Serif KR', serif; + font-family: "Noto Serif KR", serif; } .modal-title { - font-size: 30px; - padding-top: 50px; - font-weight: bold; - color: #28104E; + font-size: 30px; + padding-top: 50px; + font-weight: bold; + color: #28104e; } h3 { - font-size: 23px; + font-size: 23px; } -input[type=text] { - width: 270px; - height: 150px; - font-family: 'Noto Serif KR', serif; - font-size: 12px; - border: 0; - border-radius: 15px; - outline: none; +input[type="text"] { + width: 270px; + height: 150px; + font-family: "Noto Serif KR", serif; + font-size: 12px; + border: 0; + border-radius: 15px; + outline: none; } .register_btn { - width: 20px; + width: 20px; } .diary button { - width: 70px; - height: 30px; - border-radius: 12px; - border: 0px; - font-family: 'Noto Serif KR', serif; - color: black; - font-size: 15px; - margin-top: 10px; - margin-left: 95px; -} - -input{ - color: white; + width: 70px; + height: 30px; + border-radius: 12px; + border: 0px; + font-family: "Noto Serif KR", serif; + color: black; + font-size: 15px; + margin-top: 10px; + margin-left: 95px; +} + +input { + color: white; } input::placeholder { - color: white; - font-family: 'Noto Serif KR', serif; + color: white; + font-family: "Noto Serif KR", serif; } diff --git a/diaryProject/diaryApp/static/img/earth.png b/diaryProject/diaryApp/static/img/earth.png new file mode 100644 index 0000000..3fdea02 Binary files /dev/null and b/diaryProject/diaryApp/static/img/earth.png differ diff --git a/diaryProject/diaryApp/static/img/planet1.png b/diaryProject/diaryApp/static/img/planet1.png new file mode 100644 index 0000000..e5c3498 Binary files /dev/null and b/diaryProject/diaryApp/static/img/planet1.png differ diff --git a/diaryProject/diaryApp/static/img/planet2.png b/diaryProject/diaryApp/static/img/planet2.png new file mode 100644 index 0000000..a704a97 Binary files /dev/null and b/diaryProject/diaryApp/static/img/planet2.png differ diff --git a/diaryProject/diaryApp/static/img/planet3.png b/diaryProject/diaryApp/static/img/planet3.png new file mode 100644 index 0000000..01cdeb5 Binary files /dev/null and b/diaryProject/diaryApp/static/img/planet3.png differ diff --git a/diaryProject/diaryApp/static/img/planet_special.png b/diaryProject/diaryApp/static/img/planet_special.png new file mode 100644 index 0000000..da76366 Binary files /dev/null and b/diaryProject/diaryApp/static/img/planet_special.png differ diff --git a/diaryProject/diaryApp/static/img/star1.png b/diaryProject/diaryApp/static/img/star1.png new file mode 100644 index 0000000..1029063 Binary files /dev/null and b/diaryProject/diaryApp/static/img/star1.png differ diff --git a/diaryProject/diaryApp/static/img/star2.png b/diaryProject/diaryApp/static/img/star2.png new file mode 100644 index 0000000..7672b84 Binary files /dev/null and b/diaryProject/diaryApp/static/img/star2.png differ diff --git a/diaryProject/diaryApp/static/img/star3.png b/diaryProject/diaryApp/static/img/star3.png new file mode 100644 index 0000000..7ce1f2e Binary files /dev/null and b/diaryProject/diaryApp/static/img/star3.png differ diff --git a/diaryProject/diaryApp/static/js/fishing.js b/diaryProject/diaryApp/static/js/fishing.js index 2777484..bb4fb38 100644 --- a/diaryProject/diaryApp/static/js/fishing.js +++ b/diaryProject/diaryApp/static/js/fishing.js @@ -62,3 +62,13 @@ const fishingHandler = () => { astronaunt.src = "http://localhost:8000/static/img/LV1_fishing.svg"; } }; + +const getToday = () => { + const today = new Date(); + const year = today.getFullYear(); + const month = today.getMonth() + 1; + const date = today.getDate(); + + document.querySelector('.random-diary-header span').innerHTML = `${year}년 ${month}월 ${date}일`; +} +getToday(); diff --git a/diaryProject/diaryApp/static/signup.css b/diaryProject/diaryApp/static/signup.css new file mode 100644 index 0000000..3aa1c5c --- /dev/null +++ b/diaryProject/diaryApp/static/signup.css @@ -0,0 +1,51 @@ +.container { + font-family: 'Laila', sans-serif; +} + +* { + margin: 0; + padding: 0; + } + + body { + font-family: 'Noto Sans KR', sans-serif; + display: flex; + justify-content: center; + align-items: center; + height: 100vh; + } + + .login-form h1 { + font-size: 32px; + text-align: center; + margin-bottom: 50px; + } + + .int-area { + width: 400px; + position: relative; + margin-top: 20px; + } + + .int-area:first-child { + margin-top: 0; + } + + .int-area input { + width: 100%; + padding: 20px 10px 10px; + background-color: transparent; + border: none; + border-bottom: 1px solid black; + font-size: 18px; + outline: none; + } + + .int-area label { + position: absolute; + left: 10px; + top: 15px; + font-size: 18px; + transition: top 0.5s ease; + } + \ No newline at end of file diff --git a/diaryProject/diaryApp/templates/background.html b/diaryProject/diaryApp/templates/background.html new file mode 100644 index 0000000..322001a --- /dev/null +++ b/diaryProject/diaryApp/templates/background.html @@ -0,0 +1,18 @@ +{% extends 'base.html' %} +{% load static %} +{% block style %} +{% comment %} 여기에 연결할 css 추가 {% endcomment %} + +{% endblock style %} + +{% block js %} +{% comment %} 여기에 연결할 js 추가 {% endcomment %} + +{% endblock js %} + +{% block content %} +
+ + +
+{% endblock content %} \ No newline at end of file diff --git a/diaryProject/diaryApp/templates/diaryApp/base.html b/diaryProject/diaryApp/templates/diaryApp/base.html new file mode 100644 index 0000000..364b723 --- /dev/null +++ b/diaryProject/diaryApp/templates/diaryApp/base.html @@ -0,0 +1,32 @@ + + + + + + + + snulion + {% load static %} + + {% block style %} {% endblock style %} + + + +
+ + {% block content %} {% endblock %} +
+ + + + + {% block js %} {% endblock js %} + + diff --git a/diaryProject/diaryApp/templates/fishing.html b/diaryProject/diaryApp/templates/fishing.html index 490c921..66f6451 100644 --- a/diaryProject/diaryApp/templates/fishing.html +++ b/diaryProject/diaryApp/templates/fishing.html @@ -10,8 +10,12 @@ {% endblock js %} {% block content %}
+
-
+
다른 우주인의
오늘은 어땠을까?
@@ -19,15 +23,24 @@
- 00년 00월 00일
user의 일기
+
+ 00년 00월 00일 +

{{randomDiary.creator}}님의 일기

+
-

{{{{user.id}}.id}}님의 오늘의 Todo

+

{{randomDiary.creator}}님의 오늘의 Todo

+
    + {% for todo in randomDiary.todos %} +
  • {{todo}}
  • + {% endfor %} +

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

+ {{randomDiary.content}}
diff --git a/diaryProject/diaryApp/templates/index.html b/diaryProject/diaryApp/templates/index.html index edeac96..60c20bd 100644 --- a/diaryProject/diaryApp/templates/index.html +++ b/diaryProject/diaryApp/templates/index.html @@ -13,8 +13,8 @@ 안녕하세요, {{user.username}} 님!
@@ -102,9 +102,6 @@

Diary

- {% comment %}
-
- {% endcomment %}
{% endif %}
diff --git a/diaryProject/diaryApp/templates/registration/login.html b/diaryProject/diaryApp/templates/registration/login.html new file mode 100644 index 0000000..6cecd54 --- /dev/null +++ b/diaryProject/diaryApp/templates/registration/login.html @@ -0,0 +1,32 @@ +{% load static %} + + + + + + + + Login + + + +
+
+
+ {% csrf_token %} {% if error %} +

{{error}}

+ {% endif %} + +
+ +
+ +
+
+
+ + \ No newline at end of file diff --git a/diaryProject/diaryApp/templates/registration/signup.html b/diaryProject/diaryApp/templates/registration/signup.html new file mode 100644 index 0000000..a5892cf --- /dev/null +++ b/diaryProject/diaryApp/templates/registration/signup.html @@ -0,0 +1,43 @@ +{% load static %} + + + + + + + + + + + Document + + + + +
+
+ {% csrf_token %} + {% if error %} +

{{error}}

+ {% endif %} +

Login

+
+
+ + +
+
+ + +
+
+ +
+
+
+ + \ No newline at end of file diff --git a/diaryProject/diaryApp/views.py b/diaryProject/diaryApp/views.py index 913d2c8..7930ec7 100644 --- a/diaryProject/diaryApp/views.py +++ b/diaryProject/diaryApp/views.py @@ -4,6 +4,7 @@ from .models import Diary from django.views.decorators.csrf import csrf_exempt from django.http import JsonResponse +from random import randint # Create your views here. def logout(request): @@ -15,7 +16,11 @@ def index(request): return render(request, 'index.html') def fishing(request): - return render(request, 'fishing.html') + user = request.user + diaryList = Diary.objects.exclude(creator=user.id) + rand = randint(0, len(diaryList)-1) + randomDiary = diaryList[rand] + return render(request, 'fishing.html', {'randomDiary': randomDiary}) def background(request): return render(request, 'background.html')