Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
asheroh committed Jul 10, 2022
2 parents 71a8f51 + ebc2ed6 commit 76a21ec
Show file tree
Hide file tree
Showing 24 changed files with 48 additions and 41 deletions.
Binary file modified runningmate/addproject/__pycache__/models.cpython-310.pyc
Binary file not shown.
Binary file modified runningmate/addproject/__pycache__/views.cpython-310.pyc
Binary file not shown.
Binary file modified runningmate/addproject/__pycache__/views.cpython-39.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions runningmate/addproject/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.0.4 on 2022-07-10 13:50
# Generated by Django 4.0.4 on 2022-07-10 18:02

import colorfield.fields
from django.conf import settings
Expand Down Expand Up @@ -31,7 +31,7 @@ class Migration(migrations.Migration):
('title', models.CharField(max_length=200)),
('body', models.TextField(null=True)),
('color', colorfield.fields.ColorField(default='#FFFFFF', image_field=None, max_length=18, samples=[('#50cfbc', '1'), ('#fe7782', '2'), ('#45bfff', '3'), ('#ffbc54', '4'), ('#735bf2', '5')])),
('followers', models.ManyToManyField(related_name='following', through='addproject.Follow', to=settings.AUTH_USER_MODEL)),
('followers', models.ManyToManyField(related_name='followers', through='addproject.Follow', to=settings.AUTH_USER_MODEL)),
('writer', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
Expand Down
21 changes: 0 additions & 21 deletions runningmate/addproject/migrations/0002_alter_project_followers.py

This file was deleted.

Binary file not shown.
16 changes: 12 additions & 4 deletions runningmate/addproject/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,20 @@ def newproject(request):

def createproject(request):
new_project = Project()
new_project.title = request.POST.get('title')
new_project.body = request.POST.get('body')
new_project.startday = request.POST.get('startday')
new_project.endday = request.POST.get('endday')
new_project.title = request.POST.get('title') # 과목명
new_project.body = request.POST.get('body') # 프로젝트명
new_project.startday = request.POST.get('startday') # 프로젝트 시작일을 받음
new_project.endday = request.POST.get('endday') # 프로젝트 마감일을 받음
new_project.writer = request.user
new_project.color = request.POST.get('color')
new_project.save()
new_project.followers.add(request.user)
for i in range(1,7):
a = request.POST.get(f"teammate{i}")
if a:
new_project.followers.add(User.objects.get(username=a))


return redirect('mateapp:showmain')

def project(request):
Expand Down
Binary file modified runningmate/mateapp/__pycache__/models.cpython-310.pyc
Binary file not shown.
Binary file modified runningmate/mateapp/__pycache__/models.cpython-39.pyc
Binary file not shown.
Binary file modified runningmate/mateapp/__pycache__/urls.cpython-310.pyc
Binary file not shown.
Binary file modified runningmate/mateapp/__pycache__/views.cpython-310.pyc
Binary file not shown.
Binary file modified runningmate/mateapp/__pycache__/views.cpython-39.pyc
Binary file not shown.
5 changes: 3 additions & 2 deletions runningmate/mateapp/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.0.4 on 2022-07-10 13:50
# Generated by Django 4.0.4 on 2022-07-10 18:02

import colorfield.fields
from django.conf import settings
Expand All @@ -11,8 +11,8 @@ class Migration(migrations.Migration):
initial = True

dependencies = [
('addproject', '0001_initial'),
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('addproject', '0001_initial'),
]

operations = [
Expand All @@ -22,6 +22,7 @@ class Migration(migrations.Migration):
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('day', models.DateField(auto_now_add=True)),
('title', models.CharField(max_length=30)),
('body', models.TextField()),
('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='posts', to='addproject.project')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='작성자')),
],
Expand Down
Binary file not shown.
1 change: 1 addition & 0 deletions runningmate/mateapp/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class Meta:
class Post(models.Model):
day = models.DateField(auto_now_add=True) # 현재 생성일자를 출력
title = models.CharField(max_length=30) # 할 일 리스트를 게시판 형식 제목으로 받음
body = models.TextField()
user = models.ForeignKey(User,verbose_name="작성자",on_delete=models.CASCADE) # 옆에 작성한 사람 얼굴이 떠야하니까 유저 모델 및 on_delete 적용
project = models.ForeignKey(Project, on_delete=models.CASCADE, related_name="posts")

Expand Down
4 changes: 2 additions & 2 deletions runningmate/mateapp/templates/mateapp/calendar.html
Original file line number Diff line number Diff line change
Expand Up @@ -156,9 +156,9 @@
<div class="item2" id="today_date">
<!-- <button class="nav-btn go-prev" onclick="preDay()">&lt;</button> -->
<div id="today_day">
<div class="day_week">
<div class="day_week" style="margin-bottom:3px">
</div>
<div class="date_week">
<div class="date_week" style="margin-bottom:0 ;" >
</div>
</div>
<!-- <button class="nav-btn go-next" onclick="nextDay()">&gt;</button> -->
Expand Down
5 changes: 3 additions & 2 deletions runningmate/mateapp/templates/mateapp/project.html
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,9 @@ <h3>{{project.summary}}</h3>
<div class = "item3" id = "{{post.id}}">
<a href = "{% url 'mateapp:post_detail' project.id post.id %}" style="display: inline-block;width: 100%; height: 100%;text-decoration: none;" >
<div id = "mimoji_place" >
<section id = "mimoji" style="width: 70px; height:70px; border-radius: 50%; background-color: {{project.color}};; ;margin:10px;">

<section id = "mimoji" style="width: 70px; height:70px; border-radius: 50%; background-color: {{project.color}};; ;margin:10px; background-image: url({{ post.user.profile.profile.url }});
background-size: contain; background-repeat: no-repeat; background-position: center;" >

</section>
</div>
<section id = "meeting_date">{{post.day}}</section>
Expand Down
10 changes: 7 additions & 3 deletions runningmate/mateapp/templates/mateapp/project_post.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,10 +95,12 @@ <h3>{{project.summary}}</h3>
<div class = "item3" id = "pro_runningspace">
<section id = "post_date">{{post.day}}</section>
<section id = "post_title">{{post.title}}</section>
<section id = "post_body" >{{post.body}}</section>


<form action="{% url 'mateapp:create_comment' project.id post.id %}" method="POST" enctype="multipart/form-data">
{%csrf_token%}
<div style="width: 100%;text-align:center;margin-top: 35vmin;">
<div style="width: 100%;text-align:center;margin-top: 33vmin;">

<input type="text" name="content" id='content' required placeholder=" 댓글을 입력해주세요" style="width: 80%;">
<input type="submit" value="전송" id = "submit_title2" >
Expand All @@ -109,8 +111,10 @@ <h3>{{project.summary}}</h3>
{% for comment in boards %}
<div class = "item3" id = "{{comment.id}}">
<div id = "mimoji_place" >
<section id = "mimoji" style="width: 70px; height:70px; border-radius: 50%; background:{{project.color}}; ;margin:10px;background-image: url({{ user.profile.profile.url }})">


<section id = "mimoji" style="width: 70px; height:70px; border-radius: 50%; background-color: {{project.color}};; ;margin:10px; background-image: url({{ comment.user.profile.profile.url }});
background-size: contain; background-repeat: no-repeat; background-position: center;" >

</section>
</div>
<section id = "name" style="color:{{project.color}}">{{comment.user}}</section>
Expand Down
8 changes: 5 additions & 3 deletions runningmate/mateapp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
def showmain(request):
calendar = Calendar.objects.filter(writer=request.user, endday__contains=datetime.date.today(
)).order_by('endday') # 글을 작성한 유저의 캘린더 정보만 가져오겠다. 가까운 날짜 순으로 정렬
projects = Project.objects.all()
projects = Project.objects.filter(followers=request.user)
profile = Profile.objects.all()
posts = Post.objects.all().order_by('-day')
return render(request, 'mateapp/mainpage.html', {'calendar': calendar, 'projects':projects,'posts':posts, })

Expand Down Expand Up @@ -163,7 +164,7 @@ def timetable(request):
return redirect('mateapp:showmain') # render 보단 redirect 가 낫다.

def project_detail(request, project_id):
projects = Project.objects.all()
projects = Project.objects.filter(followers=request.user)
project = Project.objects.get(pk=project_id)
posts = Post.objects.all()
post = Post.objects.filter(project=project)
Expand All @@ -186,7 +187,8 @@ def create_post(request, project_id):
if request.method == "POST":
# project = Project.objects.get(title=project_title)
post_title = request.POST['title']
Post.objects.create(title=post_title, user=request.user, project=project) # post는 세가지 필드가 있는데,
post_body = request.POST['body']
Post.objects.create(title=post_title, user=request.user, project=project, body=post_body) # post는 세가지 필드가 있는데,
# 어떤 모델이든간에 pk가 있어야함 Foreign key는 생략이 될 수가 없음, 일대다 관계일때 쓴다는건데
#
return redirect('mateapp:project_detail', project_id)
Expand Down
2 changes: 1 addition & 1 deletion runningmate/runningmate/static/css/calender.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
.container2{
display:grid;
grid-template-columns: 2fr 1.5fr 2fr;
grid-template-rows: 1fr 5fr 1fr 2.5fr 1.5fr 1.5fr 1.5fr 15px;
grid-template-rows: 1fr 5fr 1fr 1.5fr 1.5fr 1.5fr 1.5fr 15px;
height: 100%;
row-gap: 15px;
column-gap: 20px;
Expand Down
11 changes: 11 additions & 0 deletions runningmate/runningmate/static/css/project.css
Original file line number Diff line number Diff line change
Expand Up @@ -389,4 +389,15 @@ h4{
font-family: 'AppleSDGothicNeoM';
font-weight: 500;
font-size: 1.8vmin;
}

#post_body{
margin-left: 20px;

font-family: 'AppleSDGothicNeoM';
font-style: normal;
font-weight: 400;
font-size: 20px;
line-height: 30px;
color: #222B45;
}
Binary file modified runningmate/users/__pycache__/forms.cpython-39.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion runningmate/users/migrations/0001_initial.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Generated by Django 4.0.4 on 2022-07-10 13:50
# Generated by Django 4.0.4 on 2022-07-10 18:02

from django.conf import settings
from django.db import migrations, models
Expand Down
Binary file not shown.

0 comments on commit 76a21ec

Please sign in to comment.