Skip to content
Snippets Groups Projects
Commit 1a61a913 authored by BinBin's avatar BinBin
Browse files

검색, 좋아요, 필터링, 삭제 부분 제외 완료

parent c544526d
Branches
No related tags found
No related merge requests found
Showing
with 81 additions and 198 deletions
# Generated by Django 4.0.4 on 2022-05-31 14:31 # Generated by Django 4.0.4 on 2022-06-05 08:43
from django.db import migrations, models from django.db import migrations, models
...@@ -11,6 +11,14 @@ class Migration(migrations.Migration): ...@@ -11,6 +11,14 @@ class Migration(migrations.Migration):
] ]
operations = [ operations = [
migrations.CreateModel(
name='Bookmark',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('email', models.EmailField(max_length=100, verbose_name='email')),
('feed_id', models.IntegerField()),
],
),
migrations.CreateModel( migrations.CreateModel(
name='Feed', name='Feed',
fields=[ fields=[
...@@ -20,10 +28,10 @@ class Migration(migrations.Migration): ...@@ -20,10 +28,10 @@ class Migration(migrations.Migration):
('profile_image', models.TextField()), ('profile_image', models.TextField()),
('email', models.EmailField(blank=True, max_length=100, null=True, verbose_name='email')), ('email', models.EmailField(blank=True, max_length=100, null=True, verbose_name='email')),
('user_id', models.CharField(blank=True, max_length=30, null=True)), ('user_id', models.CharField(blank=True, max_length=30, null=True)),
('like_count', models.IntegerField()), ('like_count', models.IntegerField(default=0)),
('views', models.IntegerField()), ('view_count', models.IntegerField(default=0)),
('type', models.BooleanField(default=False)), ('type', models.BooleanField(default=False)),
('univ', models.CharField(max_length=30)), ('univ', models.CharField(max_length=15)),
], ],
), ),
migrations.CreateModel( migrations.CreateModel(
...@@ -39,10 +47,30 @@ class Migration(migrations.Migration): ...@@ -39,10 +47,30 @@ class Migration(migrations.Migration):
name='FeedView', name='FeedView',
fields=[ fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('email', models.EmailField(max_length=100, verbose_name='email')),
('feed_id', models.IntegerField()), ('feed_id', models.IntegerField()),
('email', models.CharField(blank=True, max_length=30, null=True)),
('is_view', models.BooleanField(default=False)),
], ],
), ),
migrations.CreateModel(
name='Reply',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('feed_id', models.IntegerField()),
('created_at', models.DateTimeField(auto_now_add=True)),
('user_id', models.CharField(blank=True, max_length=30, null=True)),
('content', models.TextField()),
('email', models.EmailField(blank=True, max_length=100, null=True, verbose_name='email')),
],
),
migrations.AddIndex(
model_name='reply',
index=models.Index(fields=['feed_id'], name='content_rep_feed_id_49ae3d_idx'),
),
migrations.AddIndex(
model_name='feedview',
index=models.Index(fields=['feed_id'], name='content_fee_feed_id_0b2735_idx'),
),
migrations.AddIndex( migrations.AddIndex(
model_name='feedview', model_name='feedview',
index=models.Index(fields=['email'], name='content_fee_email_a02fc8_idx'), index=models.Index(fields=['email'], name='content_fee_email_a02fc8_idx'),
...@@ -55,4 +83,8 @@ class Migration(migrations.Migration): ...@@ -55,4 +83,8 @@ class Migration(migrations.Migration):
model_name='feedlike', model_name='feedlike',
index=models.Index(fields=['email'], name='content_fee_email_3901d6_idx'), index=models.Index(fields=['email'], name='content_fee_email_3901d6_idx'),
), ),
migrations.AddIndex(
model_name='bookmark',
index=models.Index(fields=['email'], name='content_boo_email_03c3c8_idx'),
),
] ]
# Generated by Django 4.0.4 on 2022-06-01 06:23
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('content', '0008_auto_20211014_1246'),
]
operations = [
migrations.AddField(
model_name='feed',
name='created_at',
field=models.DateTimeField(auto_now_add=True, default=django.utils.timezone.now),
preserve_default=False,
),
]
# Generated by Django 4.0.4 on 2022-06-01 07:43
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('content', '0009_feed_created_at'),
]
operations = [
migrations.AddField(
model_name='feed',
name='univ',
field=models.CharField(default=django.utils.timezone.now, max_length=15),
preserve_default=False,
),
]
# Generated by Django 4.0.4 on 2022-06-01 08:39
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('content', '0010_feed_univ'),
]
operations = [
migrations.RemoveField(
model_name='feed',
name='created_at',
),
]
# Generated by Django 4.0.4 on 2022-06-04 03:37
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('content', '0011_remove_feed_created_at'),
]
operations = [
migrations.CreateModel(
name='FeedView',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('email', models.EmailField(max_length=100, verbose_name='email')),
('feed_id', models.IntegerField()),
],
),
migrations.AddField(
model_name='feed',
name='type',
field=models.BooleanField(default=False),
),
migrations.AddField(
model_name='feed',
name='views',
field=models.IntegerField(default=0),
),
migrations.AddIndex(
model_name='feedview',
index=models.Index(fields=['email'], name='content_fee_email_a02fc8_idx'),
),
]
# Generated by Django 4.0.4 on 2022-06-04 06:57
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('content', '0012_feedview_feed_type_feed_views_and_more'),
]
operations = [
migrations.RenameField(
model_name='feed',
old_name='views',
new_name='view_count',
),
migrations.AddField(
model_name='feedview',
name='is_view',
field=models.BooleanField(default=False),
),
migrations.AlterField(
model_name='feed',
name='like_count',
field=models.IntegerField(default=0),
),
migrations.AlterField(
model_name='feedview',
name='email',
field=models.CharField(blank=True, max_length=30, null=True),
),
migrations.AddIndex(
model_name='feedview',
index=models.Index(fields=['feed_id'], name='content_fee_feed_id_0b2735_idx'),
),
]
from django.urls import path from django.urls import path
from .views import UploadFeed, CreateReply, LikeFeed, ViewFeed, BookmarkFeed, DeleteFeed, searchUniv, searchUser from .views import UploadFeed, LikeFeed, ViewFeed, DeleteFeed, searchUniv, searchUser
urlpatterns = [ urlpatterns = [
...@@ -7,8 +7,6 @@ urlpatterns = [ ...@@ -7,8 +7,6 @@ urlpatterns = [
path('like', LikeFeed.as_view(), name='like'), path('like', LikeFeed.as_view(), name='like'),
path('view', ViewFeed.as_view(), name='view'), path('view', ViewFeed.as_view(), name='view'),
path('bookmark', BookmarkFeed.as_view(), name='bookmark'),
## 시환님꺼 ## 시환님꺼
path('delete', DeleteFeed.as_view(), name='delete_feed'), path('delete', DeleteFeed.as_view(), name='delete_feed'),
path('searchUniv', searchUniv.as_view(), name='seacrh_univ'), path('searchUniv', searchUniv.as_view(), name='seacrh_univ'),
......
from django.shortcuts import render from django.shortcuts import render
from rest_framework.views import APIView from rest_framework.views import APIView
from content.models import Feed, Reply, FeedLike, FeedView, Bookmark from content.models import Feed, FeedLike, FeedView
from rest_framework.response import Response from rest_framework.response import Response
from user.models import User, Univ from user.models import User, Univ
from rest_framework.response import Response from rest_framework.response import Response
...@@ -30,7 +30,6 @@ class UploadFeed(APIView): ...@@ -30,7 +30,6 @@ class UploadFeed(APIView):
Feed.objects.create(content=content, image=image, profile_image=profile_image, user_id=user_id, email=email, like_count=0, univ=univ) Feed.objects.create(content=content, image=image, profile_image=profile_image, user_id=user_id, email=email, like_count=0, univ=univ)
return Response(status=200) return Response(status=200)
class LikeFeed(APIView): class LikeFeed(APIView):
def post(self, request): def post(self, request):
feed_id = request.data.get('feed_id') feed_id = request.data.get('feed_id')
......
...@@ -77,19 +77,18 @@ WSGI_APPLICATION = 'jinstagram.wsgi.application' ...@@ -77,19 +77,18 @@ WSGI_APPLICATION = 'jinstagram.wsgi.application'
# https://docs.djangoproject.com/en/3.2/ref/settings/#databases # https://docs.djangoproject.com/en/3.2/ref/settings/#databases
DATABASES = { DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'campics',
'USER': 'root',
'PASSWORD': '1101',
'HOST': 'localhost',
'PORT': '3306',
}
# 'default': { # 'default': {
# # 'ENGINE': 'django.db.backends.sqlite3', # 'ENGINE': 'django.db.backends.mysql',
# # 'NAME': BASE_DIR / 'db.sqlite3', # 'NAME': 'campics',
# # 'USER': 'root',
# 'PASSWORD': '1101',
# 'HOST': 'localhost',
# 'PORT': '3306',
# } # }
'default': {
'ENGINE': 'django.db.backends.sqlite3',
'NAME': BASE_DIR / 'db.sqlite3',
}
} }
......
...@@ -350,7 +350,7 @@ ...@@ -350,7 +350,7 @@
</div> </div>
<div id="modal_add_feed_content" class="modal modal_overlay_content"> <div id="modal_add_feed_content" class="modal modal_overlay">
<div class="modal_window"> <div class="modal_window">
<div class="modal_title"> <div class="modal_title">
<div class="modal_title_side"></div> <div class="modal_title_side"></div>
......
# Generated by Django 4.0.4 on 2022-05-31 14:31 # Generated by Django 4.0.4 on 2022-06-05 08:43
from django.db import migrations, models from django.db import migrations, models
...@@ -21,17 +21,44 @@ class Migration(migrations.Migration): ...@@ -21,17 +21,44 @@ class Migration(migrations.Migration):
('email', models.EmailField(blank=True, max_length=100, null=True, unique=True, verbose_name='email')), ('email', models.EmailField(blank=True, max_length=100, null=True, unique=True, verbose_name='email')),
('user_id', models.CharField(blank=True, max_length=30, null=True)), ('user_id', models.CharField(blank=True, max_length=30, null=True)),
('thumbnail', models.CharField(blank=True, default='default_profile.jpg', max_length=256, null=True)), ('thumbnail', models.CharField(blank=True, default='default_profile.jpg', max_length=256, null=True)),
('univ', models.CharField(max_length=30)), ('univ', models.CharField(max_length=15)),
], ],
options={ options={
'db_table': 'users', 'db_table': 'users',
}, },
), ),
migrations.CreateModel(
name='Follow',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('follower', models.EmailField(max_length=100, verbose_name='email')),
('following', models.EmailField(max_length=100, verbose_name='email')),
('is_live', models.BooleanField(default=False)),
],
options={
'db_table': 'follow',
},
),
migrations.CreateModel( migrations.CreateModel(
name='Univ', name='Univ',
fields=[ fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('univ', models.CharField(max_length=30)), ('univ', models.CharField(max_length=15)),
], ],
options={
'db_table': 'univ',
},
),
migrations.AddIndex(
model_name='follow',
index=models.Index(fields=['follower'], name='follow_followe_227ce4_idx'),
),
migrations.AddIndex(
model_name='follow',
index=models.Index(fields=['following'], name='follow_followi_9fea95_idx'),
),
migrations.AddConstraint(
model_name='follow',
constraint=models.UniqueConstraint(fields=('follower', 'following'), name='follower-following'),
), ),
] ]
# Generated by Django 4.0.4 on 2022-06-01 02:41
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('user', '0006_auto_20211014_1134'),
]
operations = [
migrations.CreateModel(
name='Univ',
fields=[
('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('univ', models.CharField(max_length=15)),
],
options={
'db_table': 'univ',
},
),
]
# Generated by Django 4.0.4 on 2022-06-01 07:43
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
dependencies = [
('user', '0007_univ'),
]
operations = [
migrations.AddField(
model_name='user',
name='univ',
field=models.CharField(default=django.utils.timezone.now, max_length=15),
preserve_default=False,
),
]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment