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 bc7443b + bdc3220 commit 5787190
Show file tree
Hide file tree
Showing 26 changed files with 193 additions and 35 deletions.
Binary file modified runningmate/addproject/__pycache__/admin.cpython-39.pyc
Binary file not shown.
Binary file modified runningmate/addproject/__pycache__/models.cpython-310.pyc
Binary file not shown.
Binary file modified runningmate/addproject/__pycache__/models.cpython-39.pyc
Binary file not shown.
Binary file modified runningmate/addproject/__pycache__/views.cpython-310.pyc
Binary file not shown.
2 changes: 2 additions & 0 deletions runningmate/addproject/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@
@admin.register(Project)
class ProjectAdmin(admin.ModelAdmin):
list_display = ['id', 'startday', 'endday', 'title', 'body', 'writer', 'color']

admin.site.register(Follow)
24 changes: 19 additions & 5 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 06:52
# Generated by Django 4.0.4 on 2022-07-10 13:50

import colorfield.fields
from django.conf import settings
Expand All @@ -12,14 +12,14 @@ class Migration(migrations.Migration):

dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('auth', '0012_alter_user_first_name_max_length'),
]

operations = [
migrations.CreateModel(
name='User',
name='Follow',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('name', models.CharField(max_length=10)),
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
],
),
migrations.CreateModel(
Expand All @@ -31,8 +31,22 @@ 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', to=settings.AUTH_USER_MODEL)),
('followers', models.ManyToManyField(related_name='following', 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)),
],
),
migrations.AddField(
model_name='follow',
name='project',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='addproject.project'),
),
migrations.AddField(
model_name='follow',
name='user',
field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL),
),
migrations.AlterUniqueTogether(
name='follow',
unique_together={('user', 'project')},
),
]
21 changes: 21 additions & 0 deletions runningmate/addproject/migrations/0002_alter_project_followers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Generated by Django 4.0.5 on 2022-07-10 14:23

from django.conf import settings
from django.db import migrations, models


class Migration(migrations.Migration):

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

operations = [
migrations.AlterField(
model_name='project',
name='followers',
field=models.ManyToManyField(related_name='followers', through='addproject.Follow', to=settings.AUTH_USER_MODEL),
),
]
Binary file not shown.
19 changes: 13 additions & 6 deletions runningmate/addproject/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,30 @@ class Project(models.Model): #프로젝트 추가
title = models.CharField(max_length=200)
body = models.TextField(null=True)
writer = models.ForeignKey(User,on_delete=models.CASCADE, null=True)
followers = models.ManyToManyField(User, related_name='following')

followers = models.ManyToManyField(User, related_name='followers', through = 'Follow')
def __str__(self):
return self.title

def summary(self):
return self.body[:30]

@property
def followers_count(self):
return self.followers.count()


COLOR_PALETTE = [
("#50cfbc","1",),("#fe7782","2",),("#45bfff","3",),("#ffbc54","4",),("#735bf2","5",),
]
color = ColorField(samples=COLOR_PALETTE)


class User(models.Model):
id = models.AutoField(primary_key=True)
name = models.CharField(max_length=10)

class Follow(models.Model):
user = models.ForeignKey(User, on_delete=models.CASCADE)
project = models.ForeignKey(Project, on_delete=models.CASCADE)

class Meta:
unique_together = (('user', 'project'))


Binary file modified runningmate/mateapp/__pycache__/models.cpython-310.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.
4 changes: 2 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 06:52
# Generated by Django 4.0.4 on 2022-07-10 13:50

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

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

operations = [
Expand Down
Binary file not shown.
68 changes: 55 additions & 13 deletions runningmate/mateapp/templates/mateapp/mainpage.html
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@
display: inline-block;
padding-right: 10px;
}


</style>

<div id = "rec3">
Expand Down Expand Up @@ -80,7 +82,7 @@
<script src="{% static 'js/calendar.js'%}"></script>
</div>
<div class = "item" id = "schedule_1">
{% if calendar.count == 0 %}
{% if calendar.0.title == None %}
<div id = 'no_schedule'>아직 등록된 일정이 없어요</div>
{% else %}
<div id = "sch1">
Expand All @@ -99,10 +101,8 @@
{% endif %}
</div>
<div class = "item" id = "schedule_2">
{% if calendar.count == 0 %}
<div id = 'no_schedule'>아직 등록된 일정이 없어요</div>
{% elif calendar.count == 1 %}
<div id = 'no_schedule'>아직 등록된 일정이 없어요</div>
{% if calendar.1.title == None %}
<div id = 'no_schedule'>아직 등록된 일정이 없어요</div>
{% else %}
<div id = "sch2">
<section id = "cal_title2" style="color: {{calendar.1.color}}; ">{{calendar.1.title}}</section>
Expand All @@ -121,13 +121,22 @@
</div>


<div class = "item" id = "runningmate_text">러닝메이트</div>
<div class = "item" id = "runningmate_text">러닝메이트


</div>
<!-- <img src="{{ user.profile.profile.url }}" width="50px" height="50px"> -->
<div class = "item" id = "runningmate">

<!-- 등록된 과목 없으면 -->
<div id = "no_runningmate">아직 등록된 러닝메이트가 없어요.</div>
{% for project in projects %}

{% for follower in project.followers.all %}

<div id = "f1" style = " width:90px; height:90px; margin-top:0;background-color:; border-radius: 50%; background-image: url({{ follower.profile.profile.url }});
background-size: contain; background-repeat: no-repeat; background-position: center; background-color:{{project.color}};"></div>
{% endfor %}

<!-- 있으면 러닝메이트 띄움 -->
{% endfor %}
<!-- <div id = "f1" style="margin-left: 3vmin;"><div class = "friend" id = "friend1"></div><h4>이영서</h4></div>
<div id = "f2"><div class = "friend" id = "friend2"></div><h4>오준서</h4></div>
<div id = "f3"><div class = "friend" id = "friend3"></div><h4>윤영서</h4></div>
Expand All @@ -139,16 +148,32 @@



<div class = "item" id = "chatting_text">최근 프로젝트
<div class = "item" id = "chatting_text">최근 회의
{{ profile.profile }}
</div>
<div class = "item" id = "chatting_1">
<div id = "no_project">아직 등록된 프로젝트가 없어요.</div>
{% for post in posts %}

{%empty%}
<div id = "no_project">아직 등록된 회의가 없어요.</div>
{%endfor%}

<section id = "recentpro_project" style="color:{{projects.0.color}}">{{posts.0.project}}</section>
<section id = "recentpro_title">{{posts.0.title}}</section>
<section id = "recentpro_date">{{posts.0.day}}</section>

</div>
<div class = "item" id = "chatting_2">
<section id = "recentpro_project" style="color:{{projects.1.color}}">{{posts.1.project}}</section>
<section id = "recentpro_title">{{posts.1.title}}</section>
<section id = "recentpro_date">{{posts.1.day}}</section>


</div>
<div class = "item" id = "chatting_3">
<section id = "recentpro_project" style="color:{{projects.2.color}}">{{posts.2.project}}</section>
<section id = "recentpro_title" >{{posts.2.title}}</section>
<section id = "recentpro_date">{{posts.2.day}}</section>

</div>

Expand All @@ -161,11 +186,28 @@

{% if projects %}
{% for project in projects %}
<div class="scroll--element" id = "subject1" style="background-color: {{project.color}};">



<div class="scroll--element" style="background-color: {{project.color}};">
<div id = "{{project.id}}">
<h6>{{project.startday}}~{{project.endday}}</h6>
<h2>{{project.title}}</h2>
<h3>{{project.summary}}</h3>
<h3 style="margin-bottom: 0;">{{project.summary}}</h3>
<div class = "mimoji" style="width: 95% ;text-align:right; ">


{% for follower in project.followers.all %}
<div id = "f1" style = " width:30px; height:30px; margin-top:20px;text-align:right;background-color:; border-radius: 50%; background-image: url({{ follower.profile.profile.url }});
background-size: contain; background-repeat: no-repeat; background-position: center; background-color:white;"></div>
{% empty %}
<div id = "f1" style = " width:30px; height:30px; margin-top:20px;text-align:right;background-color:; border-radius: 50%; background-image: url({{ follower.profile.profile.url }});
background-size: contain; background-repeat: no-repeat; background-position: center; background-color:white;visibility: hidden "></div>


{% endfor %}

</div>
</div>
</div>
{% endfor %}
Expand Down
23 changes: 21 additions & 2 deletions runningmate/mateapp/templates/mateapp/project.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,10 @@
#meeting_date{
color: {{project.color}};
}

#friend1, #friend2, #friend3, #friend4,#friend5, #friend6{
background-color: {{project.color}};;
}
</style>
<div id = "rec3">
<div class = "container3">
Expand All @@ -76,8 +80,23 @@ <h2>{{project.title}}</h2>
<h3>{{project.summary}}</h3>
</div>
</div>
<div class = "item3" id = "pro_runningmate_text">러닝메이트</div>
<div class = "item3" id = "pro_runningmate"></div>
<div class = "item3" id = "pro_runningmate_text">러닝메이트

</div>
<div class = "item3" id = "pro_runningmate" style="text-align:center">



{% for follower in project.followers.all %}

<div id = "f1"class="scroll--element" style = " width:90px; height:90px; margin-top:0;background-color:; border-radius: 50%; background-image: url({{ follower.profile.profile.url }});
background-size: contain; background-repeat: no-repeat;background-position: center; background-color:{{project.color}}; margin-left:15px;"></div>

{% endfor %}



</div>
<div class = "item3" id = "pro_runningspace_text">
<span>러닝스페이스</span>

Expand Down
14 changes: 11 additions & 3 deletions runningmate/mateapp/templates/mateapp/project_post.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
padding-right: 10px;
}

#calender_logo {
#emer_logo {
width: 30px;
height: 30px;
background-image: url("{% static 'images/calender.png' %}");
Expand Down Expand Up @@ -78,7 +78,15 @@ <h3>{{project.summary}}</h3>
</div>
</div>
<div class = "item3" id = "pro_runningmate_text">러닝메이트</div>
<div class = "item3" id = "pro_runningmate"></div>
<div class = "item3" id = "pro_runningmate" style="text-align: center;">

{% for follower in project.followers.all %}

<div id = "f1"class="scroll--element" style = " width:90px; height:90px; margin-top:0;background-color:; border-radius: 50%; background-image: url({{ follower.profile.profile.url }});
background-size: contain; background-repeat: no-repeat;background-position: center; background-color:{{project.color}}; margin-left:15px;"></div>

{% endfor %}
</div>
<div class = "item3" id = "pro_runningspace_text">
<span>러닝스페이스</span>
<a href = "{% url 'mateapp:project_detail' project.id %}"><section id = "back" style="display:inline-block; font-size:15px;color:white;background-color: {{project.color}};width: 81px;
Expand All @@ -92,7 +100,7 @@ <h3>{{project.summary}}</h3>
{%csrf_token%}
<div style="width: 100%;text-align:center;margin-top: 35vmin;">

<input type="text" name="content" id='content' required placeholder=" 내용을 입력해주세요" style="width: 80%;">
<input type="text" name="content" id='content' required placeholder=" 댓글을 입력해주세요" style="width: 80%;">
<input type="submit" value="전송" id = "submit_title2" >
</div>
</form>
Expand Down
5 changes: 3 additions & 2 deletions runningmate/mateapp/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,9 @@ def showmain(request):
calendar = Calendar.objects.filter(writer=request.user, endday__contains=datetime.date.today(
)).order_by('endday') # 글을 작성한 유저의 캘린더 정보만 가져오겠다. 가까운 날짜 순으로 정렬
projects = Project.objects.all()
profile = Profile.objects.all()
return render(request, 'mateapp/mainpage.html', {'calendar': calendar, 'projects':projects })
posts = Post.objects.all().order_by('-day')
return render(request, 'mateapp/mainpage.html', {'calendar': calendar, 'projects':projects,'posts':posts, })


def showevent(request):
if request.method == 'POST':
Expand Down
8 changes: 8 additions & 0 deletions runningmate/runningmate/static/css/project.css
Original file line number Diff line number Diff line change
Expand Up @@ -381,4 +381,12 @@ a{
color: white;
font-family: 'AppleSDGothicNeoB';

}

h4{
text-align:center;
margin: 0;
font-family: 'AppleSDGothicNeoM';
font-weight: 500;
font-size: 1.8vmin;
}
32 changes: 32 additions & 0 deletions runningmate/runningmate/static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -727,4 +727,36 @@ input{
color: #5D7285;
justify-content: center;
align-items: center;
}

#recentpro_project{
font-family: AppleSDGothicNeoB;
margin-left: 13px;
margin-top: 10px;
}

#recentpro_title{
font-family: AppleSDGothicNeoB;
margin-left: 13px;
margin-top: 2px;
font-style: normal;
font-weight: 400;
font-size: 20px;
line-height: 19px;
letter-spacing: 1px;
color: #222B45;

}

#recentpro_date{
font-family: AppleSDGothicNeoM;
margin-left: 13px;
margin-top: 5px;
font-style: normal;
font-weight: 400;
font-size: 12px;
line-height: 14px;
letter-spacing: 0.75px;

color: #8F9BB3;
}
Binary file modified runningmate/users/__pycache__/forms.cpython-39.pyc
Binary file not shown.
4 changes: 4 additions & 0 deletions runningmate/users/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,10 @@ def save(self, request):
profile = Profile()
profile.user = user
profile.profile = self.cleaned_data.get('emoji')
profile.phone = self.cleaned_data.get('phone')
profile.major = self.cleaned_data.get('major')
profile.first_name = self.cleaned_data.get('first_name')
profile.last_name = self.cleaned_data.get('last_name')
profile.save()
return user

Expand Down
Loading

0 comments on commit 5787190

Please sign in to comment.