diff --git a/campics_/content/migrations/0001_initial.py b/campics_/content/migrations/0001_initial.py index 5dbf6364a83c8c9ab1253ce9dab0533891823322..08d487e36131203616dc0e08ad10c3bb47d40c0a 100644 --- a/campics_/content/migrations/0001_initial.py +++ b/campics_/content/migrations/0001_initial.py @@ -1,25 +1,58 @@ -# Generated by Django 3.2.6 on 2021-10-03 06:33 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ] - - operations = [ - migrations.CreateModel( - name='Feed', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('content', models.TextField()), - ('image', models.TextField()), - ('profile_image', models.TextField()), - ('user_id', models.TextField()), - ('like_count', models.IntegerField()), - ], - ), - ] +# Generated by Django 4.0.4 on 2022-05-31 14:31 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='Feed', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('content', models.TextField()), + ('image', models.TextField()), + ('profile_image', models.TextField()), + ('email', models.EmailField(blank=True, max_length=100, null=True, verbose_name='email')), + ('user_id', models.CharField(blank=True, max_length=30, null=True)), + ('like_count', models.IntegerField()), + ('views', models.IntegerField()), + ('type', models.BooleanField(default=False)), + ('univ', models.CharField(max_length=30)), + ], + ), + migrations.CreateModel( + name='FeedLike', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('feed_id', models.IntegerField()), + ('email', models.CharField(blank=True, max_length=30, null=True)), + ('is_like', models.BooleanField(default=False)), + ], + ), + 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.AddIndex( + model_name='feedview', + index=models.Index(fields=['email'], name='content_fee_email_a02fc8_idx'), + ), + migrations.AddIndex( + model_name='feedlike', + index=models.Index(fields=['feed_id'], name='content_fee_feed_id_1c82cf_idx'), + ), + migrations.AddIndex( + model_name='feedlike', + index=models.Index(fields=['email'], name='content_fee_email_3901d6_idx'), + ), + ] diff --git a/campics_/content/migrations/0002_alter_feed_user_id.py b/campics_/content/migrations/0002_alter_feed_user_id.py deleted file mode 100644 index 11f40026c3afb010a9fd7cc056ed351e32549054..0000000000000000000000000000000000000000 --- a/campics_/content/migrations/0002_alter_feed_user_id.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.2.6 on 2021-10-11 12:03 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('content', '0001_initial'), - ] - - operations = [ - migrations.AlterField( - model_name='feed', - name='user_id', - field=models.CharField(blank=True, max_length=30, null=True), - ), - ] diff --git a/campics_/content/migrations/0003_feed_email.py b/campics_/content/migrations/0003_feed_email.py deleted file mode 100644 index 64c28db9a93977126eb87a702ae01c26005a68a6..0000000000000000000000000000000000000000 --- a/campics_/content/migrations/0003_feed_email.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.2.6 on 2021-10-11 12:05 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('content', '0002_alter_feed_user_id'), - ] - - operations = [ - migrations.AddField( - model_name='feed', - name='email', - field=models.EmailField(blank=True, max_length=100, null=True, verbose_name='email'), - ), - ] diff --git a/campics_/content/migrations/0004_auto_20211011_2128.py b/campics_/content/migrations/0004_auto_20211011_2128.py deleted file mode 100644 index 3da633f2acf2764e5ee5ba703e44d78a7766c6cb..0000000000000000000000000000000000000000 --- a/campics_/content/migrations/0004_auto_20211011_2128.py +++ /dev/null @@ -1,45 +0,0 @@ -# Generated by Django 3.2.6 on 2021-10-11 12:28 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('content', '0003_feed_email'), - ] - - operations = [ - migrations.CreateModel( - name='FeedLike', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('feed_id', models.IntegerField()), - ('email', models.CharField(blank=True, max_length=30, null=True)), - ('is_like', models.BooleanField(default=False)), - ('content', models.TextField()), - ], - ), - 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()), - ], - ), - migrations.AddIndex( - model_name='reply', - index=models.Index(fields=['feed_id'], name='content_rep_feed_id_49ae3d_idx'), - ), - migrations.AddIndex( - model_name='feedlike', - index=models.Index(fields=['feed_id'], name='content_fee_feed_id_1c82cf_idx'), - ), - migrations.AddIndex( - model_name='feedlike', - index=models.Index(fields=['email'], name='content_fee_email_3901d6_idx'), - ), - ] diff --git a/campics_/content/migrations/0005_remove_feedlike_content_fee_email_3901d6_idx.py b/campics_/content/migrations/0005_remove_feedlike_content_fee_email_3901d6_idx.py deleted file mode 100644 index f0e6567950ca4773868af95fdca9654d8f5ebe4b..0000000000000000000000000000000000000000 --- a/campics_/content/migrations/0005_remove_feedlike_content_fee_email_3901d6_idx.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 3.2.6 on 2021-10-11 12:31 - -from django.db import migrations - - -class Migration(migrations.Migration): - - dependencies = [ - ('content', '0004_auto_20211011_2128'), - ] - - operations = [ - migrations.RemoveIndex( - model_name='feedlike', - name='content_fee_email_3901d6_idx', - ), - ] diff --git a/campics_/content/migrations/0006_feedlike_content_fee_email_3901d6_idx.py b/campics_/content/migrations/0006_feedlike_content_fee_email_3901d6_idx.py deleted file mode 100644 index 3d5896c148bee96e7bab419f2574b087b337857f..0000000000000000000000000000000000000000 --- a/campics_/content/migrations/0006_feedlike_content_fee_email_3901d6_idx.py +++ /dev/null @@ -1,17 +0,0 @@ -# Generated by Django 3.2.6 on 2021-10-11 12:31 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('content', '0005_remove_feedlike_content_fee_email_3901d6_idx'), - ] - - operations = [ - migrations.AddIndex( - model_name='feedlike', - index=models.Index(fields=['email'], name='content_fee_email_3901d6_idx'), - ), - ] diff --git a/campics_/content/migrations/0007_auto_20211012_0007.py b/campics_/content/migrations/0007_auto_20211012_0007.py deleted file mode 100644 index 6d87eb8f6951396ed36a8348e6dd76284ab0ebb5..0000000000000000000000000000000000000000 --- a/campics_/content/migrations/0007_auto_20211012_0007.py +++ /dev/null @@ -1,22 +0,0 @@ -# Generated by Django 3.2.6 on 2021-10-11 15:07 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('content', '0006_feedlike_content_fee_email_3901d6_idx'), - ] - - operations = [ - migrations.RemoveField( - model_name='feedlike', - name='content', - ), - migrations.AddField( - model_name='reply', - name='email', - field=models.EmailField(blank=True, max_length=100, null=True, verbose_name='email'), - ), - ] diff --git a/campics_/content/migrations/0008_auto_20211014_1246.py b/campics_/content/migrations/0008_auto_20211014_1246.py deleted file mode 100644 index e2981dc6725a84997055fa85ea9e4eb0b42c0bb4..0000000000000000000000000000000000000000 --- a/campics_/content/migrations/0008_auto_20211014_1246.py +++ /dev/null @@ -1,26 +0,0 @@ -# Generated by Django 3.2.6 on 2021-10-14 12:46 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('content', '0007_auto_20211012_0007'), - ] - - 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()), - ('is_bookmarked', models.BooleanField(default=True)), - ], - ), - migrations.AddIndex( - model_name='bookmark', - index=models.Index(fields=['email'], name='content_boo_email_03c3c8_idx'), - ), - ] diff --git a/campics_/content/models.py b/campics_/content/models.py index 1f3666ed766e3de4db7c25d9fc5d729ec1ce7651..fad019284df68f737eec213f508c4c289a6a83ff 100644 --- a/campics_/content/models.py +++ b/campics_/content/models.py @@ -51,7 +51,6 @@ class FeedView(models.Model): class Bookmark(models.Model): email = models.EmailField(verbose_name='email', max_length=100) feed_id = models.IntegerField() - is_bookmarked = models.BooleanField(default=True) class Meta: indexes = [ diff --git a/campics_/content/urls.py b/campics_/content/urls.py index 9a89be71f651c2f6d93593fce27a6b3af5eb29d1..05f812bd6a96f33a4585b02d129f9f2b3c2b9007 100644 --- a/campics_/content/urls.py +++ b/campics_/content/urls.py @@ -4,7 +4,7 @@ from .views import UploadFeed, CreateReply, LikeFeed, ViewFeed, BookmarkFeed, De urlpatterns = [ path('upload', UploadFeed.as_view(), name='upload_feed'), - path('reply/create', CreateReply.as_view(), name='reply_create'), + path('like', LikeFeed.as_view(), name='like'), path('view', ViewFeed.as_view(), name='view'), path('bookmark', BookmarkFeed.as_view(), name='bookmark'), diff --git a/campics_/content/views.py b/campics_/content/views.py index 8c737e6821a6a6ea9babf72c22626f3a5680fabb..8b50b8839e75a2b47d12f1d079702fab250c51c8 100644 --- a/campics_/content/views.py +++ b/campics_/content/views.py @@ -2,13 +2,13 @@ from django.shortcuts import render from rest_framework.views import APIView from content.models import Feed, Reply, FeedLike, FeedView, Bookmark from rest_framework.response import Response -from user.models import User +from user.models import User, Univ from rest_framework.response import Response import os from jinstagram.settings import MEDIA_ROOT from uuid import uuid4 from datetime import datetime - +from django.db.models import Q class UploadFeed(APIView): def post(self, request): @@ -23,8 +23,11 @@ class UploadFeed(APIView): profile_image = request.data.get('profile_image') user_id = request.data.get('user_id') email = request.data.get('email') - univ = request.data.get('univ') - Feed.objects.create(content=content, image=image, profile_image=profile_image, user_id=user_id, email=email, like_count=0, view_count=0, univ=univ) + + user = User.objects.filter(Q(email = email)).first() + univ = user.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) @@ -77,77 +80,23 @@ class ViewFeed(APIView): class CreateReply(APIView): def post(self, request): feed_id = request.data.get('feed_id') - user_id = request.data.get('user_id') - content = request.data.get('content') email = request.data.get('email') - Reply.objects.create(feed_id=feed_id, - user_id=user_id, - content=content, - email=email - ) - return Response(status=200, data=dict(message='댓글 작성 완료.')) - - -class DeleteReply(APIView): - def post(self, request): - reply_id = request.data.get('reply_id') - email = request.data.get('email') + # feed_id = 1 + # email = "ksshhses@ajou.ac.kr" - reply = Reply.objects.filter(id=reply_id).first() + feed = Feed.objects.filter(id=feed_id).first() - if reply is None: + if feed is None: return Response(status=500, data=dict(message='삭제 실패')) - if reply.email == email: - reply.delete() - return Response(status=200, data=dict(message='성공')) + if feed.email == email: + feed.delete() + return render(request, "jinstagram/main.html") #프로필페이지 else: return Response(status=500, data=dict(message='삭제 실패')) - -class BookmarkFeed(APIView): - def post(self, request): - feed_id = request.data.get('feed_id') - email = request.data.get('email') - is_bookmarked = request.data.get('is_bookmarked', 'True') - - if is_bookmarked.lower() == 'false': - is_bookmarked = False - else: - is_bookmarked = True - bookmark = Bookmark.objects.filter(feed_id=feed_id, email=email).first() - - if bookmark is None: - Bookmark.objects.create(feed_id=feed_id, - email=email, - is_bookmarked=is_bookmarked, - ) - else: - bookmark.is_bookmarked = is_bookmarked - bookmark.save() - - return Response(status=200, data=dict(message='북마크 설정 완료.')) - ## 시환님꺼 -class DetailFeed(APIView): - def get(self, request): - email = request.session.get('email', None) - if email is None: - return render(request, 'user/login.html') - - user = User.objects.filter(email=email).first() - if user is None: - return render(request, 'user/login.html') - - # feed 가지고 오기 - feed = Feed.objects.get(feed_id=id) - - if feed.email == user.email: - return(request, 'deatil_delete.html', feed) - else: - return(request, 'detail.html', feed) - class DeleteFeed(APIView): def post(self, request): feed_id = request.data.get('feed_id') @@ -190,4 +139,4 @@ class searchUser(APIView): if user_list.count() == 0: return Response(status=404, data=dict(message='유저가 없습니다.')) else: - return Response(status=200, data=dict(user=user_list)) + return Response(status=200, data=dict(user=user_list)) \ No newline at end of file diff --git a/campics_/jinstagram/settings.py b/campics_/jinstagram/settings.py index bc2761e9e2a2c63ca1378cfc3da016f72f595f86..0c5813da4e8222533f76e30593e2804229123bc4 100644 --- a/campics_/jinstagram/settings.py +++ b/campics_/jinstagram/settings.py @@ -78,9 +78,18 @@ WSGI_APPLICATION = 'jinstagram.wsgi.application' DATABASES = { 'default': { - 'ENGINE': 'django.db.backends.sqlite3', - 'NAME': BASE_DIR / 'db.sqlite3', - } + 'ENGINE': 'django.db.backends.mysql', + 'NAME': 'campics', + 'USER': 'root', + 'PASSWORD': '1101', + 'HOST': 'localhost', + 'PORT': '3306', + } + # 'default': { + # # 'ENGINE': 'django.db.backends.sqlite3', + # # 'NAME': BASE_DIR / 'db.sqlite3', + # + # } } diff --git a/campics_/jinstagram/views.py b/campics_/jinstagram/views.py index efe779439d614e1d34e4f846ed3669b1d42541c1..47b295b409d0b76e1840d908bc52cfb75573763c 100644 --- a/campics_/jinstagram/views.py +++ b/campics_/jinstagram/views.py @@ -123,8 +123,6 @@ class Detail(APIView): for feed in feed_object_list: like_count = FeedLike.objects.filter(feed_id=feed.id, is_like=True).count() is_like = FeedLike.objects.filter(feed_id=feed.id, is_like=True, email=email).exists() - is_bookmarked = Bookmark.objects.filter(email=email, is_bookmarked=True, feed_id=feed.id).exists() - reply_list = Reply.objects.filter(feed_id=feed.id) profile_image = User.objects.filter(email=feed.email).first().thumbnail or 'default_profile.jpg' feed_list.append(dict( id=feed.id, @@ -133,9 +131,7 @@ class Detail(APIView): image=feed.image, content=feed.content, like_count=like_count, - is_like=is_like, - reply_list=reply_list, - is_bookmarked=is_bookmarked + is_like=is_like )) return render(request, @@ -143,8 +139,6 @@ class Detail(APIView): context=dict(feed_list=feed_list, user=user)) - - class Profile(APIView): def get(self, request): email = request.session.get('email', None) @@ -162,7 +156,6 @@ class Profile(APIView): for feed in feed_object_list: like_count = FeedLike.objects.filter(feed_id=feed.id, is_like=True).count() is_like = FeedLike.objects.filter(feed_id=feed.id, is_like=True, email=email).exists() - reply_count = Reply.objects.filter(feed_id=feed.id).count() row_feed_list.append(dict( id=feed.id, profile_image=feed.profile_image, @@ -171,7 +164,6 @@ class Profile(APIView): content=feed.content, like_count=like_count, is_like=is_like, - reply_count=reply_count )) if len(row_feed_list) == 3: @@ -181,42 +173,9 @@ class Profile(APIView): if len(row_feed_list) > 0: feed_list.append(dict(row_feed_list=row_feed_list)) - following_count = Follow.objects.filter(follower=email, is_live=True).count() - follower_count = Follow.objects.filter(following=email, is_live=True).count() - - bookmark_list = Bookmark.objects.filter(email=email, is_bookmarked=True).order_by('-id') - bookmark_feed_list = [] - row_bookmark_feed_list = [] - for bookmark in bookmark_list: - feed = Feed.objects.filter(id=bookmark.feed_id).first() - if feed is None: - continue - like_count = FeedLike.objects.filter(feed_id=feed.id, is_like=True).count() - is_like = FeedLike.objects.filter(feed_id=feed.id, is_like=True, email=email).exists() - reply_count = Reply.objects.filter(feed_id=feed.id).count() - row_bookmark_feed_list.append(dict( - id=feed.id, - profile_image=feed.profile_image, - user_id=feed.user_id, - image=feed.image, - content=feed.content, - like_count=like_count, - is_like=is_like, - reply_count=reply_count - )) - - if len(row_bookmark_feed_list) == 3: - bookmark_feed_list.append(dict(row_bookmark_feed_list=row_bookmark_feed_list)) - row_bookmark_feed_list = [] - - if len(row_bookmark_feed_list) > 0: - bookmark_feed_list.append(dict(row_bookmark_feed_list=row_bookmark_feed_list)) return render(request, 'jinstagram/profile.html', context=dict(feed_list=feed_list, - bookmark_feed_list=bookmark_feed_list, feed_count=feed_count, - following_count=following_count, - follower_count=follower_count, user=user)) diff --git a/campics_/templates/user/join.html b/campics_/templates/user/join.html index 9379856650738d3a3cf579866025de60e8646759..641e63148c0e8361851c2033805646d5c87bcd05 100644 --- a/campics_/templates/user/join.html +++ b/campics_/templates/user/join.html @@ -43,7 +43,7 @@ {% csrf_token %} <div class="input-group mb-3"> <span class="input-group-text"><text class="me-3">아이디</text> </span> - <input type="text" id="user_id" nickname="user_id" class="form-control"> + <input type="text" id="user_id" nickname="user_id" class="form-control">#사실은 이메일 형식 <button class="btn btn-outline-secondary" type="button" id="button-addon1">중복검사</button> </div> <div class="input-group mb-3"> @@ -58,7 +58,7 @@ <span class="input-group-text">학교이름</span> <input type="text" id="univname" nickname="univname" class="form-control"> <a class="btn btn-outline-secondary" type="button" id="button-addon1">검색</a> - </div> + </div> <div class="row "> <div class="col text-center my-3"> <!-- <input type="submit" value="확인" class="btn btn-success"> --> diff --git a/campics_/user/migrations/0001_initial.py b/campics_/user/migrations/0001_initial.py index c69eb5ca29cb431e0700ee833b3aa92c39c20e4d..3f1ec9bd087bddbd6333dbe89621e8ad10a0ab25 100644 --- a/campics_/user/migrations/0001_initial.py +++ b/campics_/user/migrations/0001_initial.py @@ -1,28 +1,37 @@ -# Generated by Django 3.2.6 on 2021-10-09 13:56 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - initial = True - - dependencies = [ - ] - - operations = [ - migrations.CreateModel( - name='User', - fields=[ - ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), - ('password', models.CharField(max_length=128, verbose_name='password')), - ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), - ('email', models.EmailField(blank=True, max_length=100, null=True, verbose_name='email')), - ('user_id', models.CharField(blank=True, max_length=30, null=True)), - ('thumbnail', models.CharField(blank=True, max_length=256, null=True)), - ], - options={ - 'db_table': 'users', - }, - ), - ] +# Generated by Django 4.0.4 on 2022-05-31 14:31 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + initial = True + + dependencies = [ + ] + + operations = [ + migrations.CreateModel( + name='User', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('password', models.CharField(max_length=128, verbose_name='password')), + ('last_login', models.DateTimeField(blank=True, null=True, verbose_name='last login')), + ('name', models.CharField(blank=True, max_length=30, null=True)), + ('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)), + ('thumbnail', models.CharField(blank=True, default='default_profile.jpg', max_length=256, null=True)), + ('univ', models.CharField(max_length=30)), + ], + options={ + 'db_table': 'users', + }, + ), + migrations.CreateModel( + name='Univ', + fields=[ + ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), + ('univ', models.CharField(max_length=30)), + ], + ), + ] diff --git a/campics_/user/migrations/0002_user_name.py b/campics_/user/migrations/0002_user_name.py deleted file mode 100644 index b44d6dd07f114228af61e01db93fca1df086bb5d..0000000000000000000000000000000000000000 --- a/campics_/user/migrations/0002_user_name.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.2.6 on 2021-10-11 07:24 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('user', '0001_initial'), - ] - - operations = [ - migrations.AddField( - model_name='user', - name='name', - field=models.CharField(blank=True, max_length=30, null=True), - ), - ] diff --git a/campics_/user/migrations/0003_alter_user_email.py b/campics_/user/migrations/0003_alter_user_email.py deleted file mode 100644 index 51becb3db2ecfc4f192eb8708d26a7aabb232da4..0000000000000000000000000000000000000000 --- a/campics_/user/migrations/0003_alter_user_email.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.2.6 on 2021-10-11 07:31 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('user', '0002_user_name'), - ] - - operations = [ - migrations.AlterField( - model_name='user', - name='email', - field=models.EmailField(blank=True, max_length=100, null=True, unique=True, verbose_name='email'), - ), - ] diff --git a/campics_/user/migrations/0004_alter_user_thumbnail.py b/campics_/user/migrations/0004_alter_user_thumbnail.py deleted file mode 100644 index 8e695b05587aa78e3e6eaa6d5bd817ae9ddd83eb..0000000000000000000000000000000000000000 --- a/campics_/user/migrations/0004_alter_user_thumbnail.py +++ /dev/null @@ -1,18 +0,0 @@ -# Generated by Django 3.2.6 on 2021-10-11 12:03 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('user', '0003_alter_user_email'), - ] - - operations = [ - migrations.AlterField( - model_name='user', - name='thumbnail', - field=models.CharField(blank=True, default='default_profile.jpg', max_length=256, null=True), - ), - ] diff --git a/campics_/user/migrations/0005_auto_20211014_1123.py b/campics_/user/migrations/0005_auto_20211014_1123.py deleted file mode 100644 index 783af974b370657c7d5fa6004d824fc3caca64e6..0000000000000000000000000000000000000000 --- a/campics_/user/migrations/0005_auto_20211014_1123.py +++ /dev/null @@ -1,29 +0,0 @@ -# Generated by Django 3.2.6 on 2021-10-14 11:23 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('user', '0004_alter_user_thumbnail'), - ] - - operations = [ - 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.AddConstraint( - model_name='follow', - constraint=models.UniqueConstraint(fields=('follower', 'following'), name='follower-following'), - ), - ] diff --git a/campics_/user/migrations/0006_auto_20211014_1134.py b/campics_/user/migrations/0006_auto_20211014_1134.py deleted file mode 100644 index 05e61ff19f03a76c1972afa2944d21ed585d33d8..0000000000000000000000000000000000000000 --- a/campics_/user/migrations/0006_auto_20211014_1134.py +++ /dev/null @@ -1,21 +0,0 @@ -# Generated by Django 3.2.6 on 2021-10-14 11:34 - -from django.db import migrations, models - - -class Migration(migrations.Migration): - - dependencies = [ - ('user', '0005_auto_20211014_1123'), - ] - - operations = [ - 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'), - ), - ] diff --git a/campics_/user/models.py b/campics_/user/models.py index 8861897c858d356bdc31998e817577e4b915497e..8685cf407ada3edf3fe7788d92c2c3f607aad9b8 100644 --- a/campics_/user/models.py +++ b/campics_/user/models.py @@ -43,4 +43,4 @@ class Univ(models.Model): univ = models.CharField(max_length=15) class Meta: - db_table = 'univ' \ No newline at end of file + db_table = 'univ' diff --git a/campics_/user/views.py b/campics_/user/views.py index 0c5577654af51bc7a354f83abfbbaef3a9b8b011..f9d7a1f89824b272f434aa63c8c914a58ac4b6e3 100644 --- a/campics_/user/views.py +++ b/campics_/user/views.py @@ -46,7 +46,7 @@ class Join(APIView): # email = "ksshhses@khu.ac.kr" user_id = request.data.get('nickname') name = request.data.get('name') - univ = request.data.get('univname'); + univ = request.data.get('univname') if User.objects.filter(email=email).exists() : return Response(status=500, data=dict(message='해당 이메일 주소가 존재합니다.'))