From f48870676475c8b5ddba52fa3a2a031c23ce4c92 Mon Sep 17 00:00:00 2001 From: Shim Kyumin Date: Wed, 31 Jul 2024 12:47:15 +0900 Subject: [PATCH 1/5] =?UTF-8?q?feat:=20=EB=82=B4=20=EB=A7=9B=EC=A7=91=20?= =?UTF-8?q?=EB=A6=AC=EC=8A=A4=ED=8A=B8=20=EA=B8=B0=EB=8A=A5=20=EA=B5=AC?= =?UTF-8?q?=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../migrations/0004_userrestaurantlist.py | 46 +++++++++++++++++++ restaurants/models.py | 8 ++++ restaurants/serializers.py | 10 +++- restaurants/urls.py | 8 +++- restaurants/views.py | 44 +++++++++++++++++- 5 files changed, 113 insertions(+), 3 deletions(-) create mode 100644 restaurants/migrations/0004_userrestaurantlist.py diff --git a/restaurants/migrations/0004_userrestaurantlist.py b/restaurants/migrations/0004_userrestaurantlist.py new file mode 100644 index 0000000..deac1ce --- /dev/null +++ b/restaurants/migrations/0004_userrestaurantlist.py @@ -0,0 +1,46 @@ +# Generated by Django 4.2.14 on 2024-07-31 03:43 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ("restaurants", "0003_searchhistory"), + ] + + operations = [ + migrations.CreateModel( + name="UserRestaurantList", + fields=[ + ( + "id", + models.BigAutoField( + auto_created=True, + primary_key=True, + serialize=False, + verbose_name="ID", + ), + ), + ( + "restaurant", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to="restaurants.restaurant", + ), + ), + ( + "user", + models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + to=settings.AUTH_USER_MODEL, + ), + ), + ], + options={ + "unique_together": {("user", "restaurant")}, + }, + ), + ] diff --git a/restaurants/models.py b/restaurants/models.py index 0dc9d4e..1d9700d 100644 --- a/restaurants/models.py +++ b/restaurants/models.py @@ -34,3 +34,11 @@ class SearchHistory(models.Model): class Meta: ordering = ["-timestamp"] + + +class UserRestaurantList(models.Model): + user = models.ForeignKey(User, on_delete=models.CASCADE) + restaurant = models.ForeignKey(Restaurant, on_delete=models.CASCADE) + + class Meta: + unique_together = ("user", "restaurant") diff --git a/restaurants/serializers.py b/restaurants/serializers.py index 452e64a..f0ce4bc 100644 --- a/restaurants/serializers.py +++ b/restaurants/serializers.py @@ -1,5 +1,5 @@ from rest_framework import serializers -from .models import Restaurant, SearchHistory +from .models import Restaurant, SearchHistory, UserRestaurantList class RestaurantSerializer(serializers.ModelSerializer): @@ -23,3 +23,11 @@ class SearchHistorySerializer(serializers.ModelSerializer): class Meta: model = SearchHistory fields = ["query", "timestamp"] + + +class UserRestaurantListSerializer(serializers.ModelSerializer): + restaurant = RestaurantSerializer() + + class Meta: + model = UserRestaurantList + fields = "__all__" diff --git a/restaurants/urls.py b/restaurants/urls.py index 9bf61e7..d91f411 100644 --- a/restaurants/urls.py +++ b/restaurants/urls.py @@ -3,7 +3,13 @@ urlpatterns = [ - path("restaurants/", views.restaurant_list, name="restaurant-list"), + # path("restaurants/", views.restaurant_list, name="restaurant-list"), path("api-auth/", include("rest_framework.urls", namespace="rest_framework")), path("search/", views.search, name="search"), + path( + "restaurants//", + views.add_remove_restaurant, + name="add-remove-restaurant", + ), + path("restaurants/", views.user_restaurant_list, name="user-restaurant-list"), ] diff --git a/restaurants/views.py b/restaurants/views.py index 9ec565e..2bf8b90 100644 --- a/restaurants/views.py +++ b/restaurants/views.py @@ -1,12 +1,15 @@ # from django.shortcuts import render from rest_framework.decorators import api_view from rest_framework.response import Response -from .models import Restaurant, SearchHistory +from rest_framework import status +from .models import Restaurant, SearchHistory, UserRestaurantList from .serializers import ( RestaurantSerializer, RestaurantListSerializer, SearchHistorySerializer, + UserRestaurantListSerializer, ) +from django.contrib.auth.decorators import login_required @api_view(["GET"]) @@ -40,3 +43,42 @@ def search(request): else: return Response({"error": "Unsupported method"}, status=405) + + +@api_view(["GET"]) +@login_required +def user_restaurant_list(request): + user_restaurants = UserRestaurantList.objects.filter(user=request.user) + serializer = UserRestaurantListSerializer(user_restaurants, many=True) + return Response(serializer.data, status=status.HTTP_200_OK) + + +@api_view(["POST", "DELETE"]) +@login_required +def add_remove_restaurant(request, pk): + try: + restaurant = Restaurant.objects.get(pk=pk) + if request.method == "POST": + UserRestaurantList.objects.create(user=request.user, restaurant=restaurant) + return Response( + {"message": "Restaurant added successfully"}, + status=status.HTTP_201_CREATED, + ) + elif request.method == "DELETE": + user_restaurant = UserRestaurantList.objects.get( + user=request.user, restaurant=restaurant + ) + user_restaurant.delete() + return Response( + {"message": "Restaurant deleted successfully"}, + status=status.HTTP_204_NO_CONTENT, + ) + except Restaurant.DoesNotExist: + return Response( + {"message": "Restaurant not found"}, status=status.HTTP_404_NOT_FOUND + ) + except UserRestaurantList.DoesNotExist: + return Response( + {"message": "Restaurant not found in your list"}, + status=status.HTTP_404_NOT_FOUND, + ) From 37af76bed365f128e38155b9c19f46adbbd9a246 Mon Sep 17 00:00:00 2001 From: Shim Kyumin Date: Wed, 31 Jul 2024 12:48:20 +0900 Subject: [PATCH 2/5] =?UTF-8?q?chore:=20users=20=EC=95=B1=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- users/__init__.py | 0 users/admin.py | 3 --- users/apps.py | 6 ------ users/migrations/0001_initial.py | 31 ------------------------------- users/migrations/__init__.py | 0 users/models.py | 11 ----------- users/serializers.py | 8 -------- users/tests.py | 3 --- users/views.py | 3 --- 9 files changed, 65 deletions(-) delete mode 100644 users/__init__.py delete mode 100644 users/admin.py delete mode 100644 users/apps.py delete mode 100644 users/migrations/0001_initial.py delete mode 100644 users/migrations/__init__.py delete mode 100644 users/models.py delete mode 100644 users/serializers.py delete mode 100644 users/tests.py delete mode 100644 users/views.py diff --git a/users/__init__.py b/users/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/users/admin.py b/users/admin.py deleted file mode 100644 index 4185d36..0000000 --- a/users/admin.py +++ /dev/null @@ -1,3 +0,0 @@ -# from django.contrib import admin - -# Register your models here. diff --git a/users/apps.py b/users/apps.py deleted file mode 100644 index 88f7b17..0000000 --- a/users/apps.py +++ /dev/null @@ -1,6 +0,0 @@ -from django.apps import AppConfig - - -class UsersConfig(AppConfig): - default_auto_field = "django.db.models.BigAutoField" - name = "users" diff --git a/users/migrations/0001_initial.py b/users/migrations/0001_initial.py deleted file mode 100644 index b5b9347..0000000 --- a/users/migrations/0001_initial.py +++ /dev/null @@ -1,31 +0,0 @@ -# Generated by Django 4.2.14 on 2024-07-26 14:19 - -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", - ), - ), - ("email", models.CharField(max_length=255)), - ("password", models.CharField(max_length=255)), - ("nickname", models.CharField(blank=True, max_length=255, null=True)), - ("image", models.CharField(blank=True, max_length=255, null=True)), - ("reliability", models.SmallIntegerField(blank=True, null=True)), - ], - ), - ] diff --git a/users/migrations/__init__.py b/users/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/users/models.py b/users/models.py deleted file mode 100644 index b061854..0000000 --- a/users/models.py +++ /dev/null @@ -1,11 +0,0 @@ -from django.db import models - -# Create your models here. - - -class User(models.Model): - email = models.CharField(max_length=255) - password = models.CharField(max_length=255) - nickname = models.CharField(max_length=255, null=True, blank=True) - image = models.CharField(max_length=255, null=True, blank=True) - reliability = models.SmallIntegerField(null=True, blank=True) diff --git a/users/serializers.py b/users/serializers.py deleted file mode 100644 index 0ec035c..0000000 --- a/users/serializers.py +++ /dev/null @@ -1,8 +0,0 @@ -from rest_framework import serializers -from .models import User - - -class UserSerializer(serializers.ModelSerializer): - class Meta: - model = User - fields = "__all__" diff --git a/users/tests.py b/users/tests.py deleted file mode 100644 index a79ca8b..0000000 --- a/users/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -# from django.test import TestCase - -# Create your tests here. diff --git a/users/views.py b/users/views.py deleted file mode 100644 index fd0e044..0000000 --- a/users/views.py +++ /dev/null @@ -1,3 +0,0 @@ -# from django.shortcuts import render - -# Create your views here. From c40bc01ab23f71a25c7508291885f28dc26bf4dd Mon Sep 17 00:00:00 2001 From: Shim Kyumin Date: Wed, 31 Jul 2024 13:04:27 +0900 Subject: [PATCH 3/5] =?UTF-8?q?chore:=20Revert=20"chore:=20users=20?= =?UTF-8?q?=EC=95=B1=20=EC=82=AD=EC=A0=9C"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This reverts commit 37af76bed365f128e38155b9c19f46adbbd9a246. --- users/__init__.py | 0 users/admin.py | 3 +++ users/apps.py | 6 ++++++ users/migrations/0001_initial.py | 31 +++++++++++++++++++++++++++++++ users/migrations/__init__.py | 0 users/models.py | 11 +++++++++++ users/serializers.py | 8 ++++++++ users/tests.py | 3 +++ users/views.py | 3 +++ 9 files changed, 65 insertions(+) create mode 100644 users/__init__.py create mode 100644 users/admin.py create mode 100644 users/apps.py create mode 100644 users/migrations/0001_initial.py create mode 100644 users/migrations/__init__.py create mode 100644 users/models.py create mode 100644 users/serializers.py create mode 100644 users/tests.py create mode 100644 users/views.py diff --git a/users/__init__.py b/users/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/users/admin.py b/users/admin.py new file mode 100644 index 0000000..4185d36 --- /dev/null +++ b/users/admin.py @@ -0,0 +1,3 @@ +# from django.contrib import admin + +# Register your models here. diff --git a/users/apps.py b/users/apps.py new file mode 100644 index 0000000..88f7b17 --- /dev/null +++ b/users/apps.py @@ -0,0 +1,6 @@ +from django.apps import AppConfig + + +class UsersConfig(AppConfig): + default_auto_field = "django.db.models.BigAutoField" + name = "users" diff --git a/users/migrations/0001_initial.py b/users/migrations/0001_initial.py new file mode 100644 index 0000000..b5b9347 --- /dev/null +++ b/users/migrations/0001_initial.py @@ -0,0 +1,31 @@ +# Generated by Django 4.2.14 on 2024-07-26 14:19 + +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", + ), + ), + ("email", models.CharField(max_length=255)), + ("password", models.CharField(max_length=255)), + ("nickname", models.CharField(blank=True, max_length=255, null=True)), + ("image", models.CharField(blank=True, max_length=255, null=True)), + ("reliability", models.SmallIntegerField(blank=True, null=True)), + ], + ), + ] diff --git a/users/migrations/__init__.py b/users/migrations/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/users/models.py b/users/models.py new file mode 100644 index 0000000..b061854 --- /dev/null +++ b/users/models.py @@ -0,0 +1,11 @@ +from django.db import models + +# Create your models here. + + +class User(models.Model): + email = models.CharField(max_length=255) + password = models.CharField(max_length=255) + nickname = models.CharField(max_length=255, null=True, blank=True) + image = models.CharField(max_length=255, null=True, blank=True) + reliability = models.SmallIntegerField(null=True, blank=True) diff --git a/users/serializers.py b/users/serializers.py new file mode 100644 index 0000000..0ec035c --- /dev/null +++ b/users/serializers.py @@ -0,0 +1,8 @@ +from rest_framework import serializers +from .models import User + + +class UserSerializer(serializers.ModelSerializer): + class Meta: + model = User + fields = "__all__" diff --git a/users/tests.py b/users/tests.py new file mode 100644 index 0000000..a79ca8b --- /dev/null +++ b/users/tests.py @@ -0,0 +1,3 @@ +# from django.test import TestCase + +# Create your tests here. diff --git a/users/views.py b/users/views.py new file mode 100644 index 0000000..fd0e044 --- /dev/null +++ b/users/views.py @@ -0,0 +1,3 @@ +# from django.shortcuts import render + +# Create your views here. From c66dad109413911b5de90a8e175e19ac1caa1b38 Mon Sep 17 00:00:00 2001 From: Shim Kyumin Date: Wed, 31 Jul 2024 13:36:02 +0900 Subject: [PATCH 4/5] =?UTF-8?q?chore:=20users=20=EC=82=AD=EC=A0=9C?= =?UTF-8?q?=EB=A5=BC=20=EC=9C=84=ED=95=9C=20=EA=B2=BD=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD=20=EB=B0=8F=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...2_alter_friend_friend_alter_friend_user.py | 33 +++++++++++++++++++ friends/models.py | 2 +- ...antlist.py => 0004_userrestaurantslist.py} | 4 +-- restaurants/models.py | 2 +- restaurants/serializers.py | 4 +-- restaurants/views.py | 10 +++--- ..._alter_recommend_user_alter_review_user.py | 29 ++++++++++++++++ reviews/models.py | 2 +- 8 files changed, 74 insertions(+), 12 deletions(-) create mode 100644 friends/migrations/0002_alter_friend_friend_alter_friend_user.py rename restaurants/migrations/{0004_userrestaurantlist.py => 0004_userrestaurantslist.py} (93%) create mode 100644 reviews/migrations/0002_alter_recommend_user_alter_review_user.py diff --git a/friends/migrations/0002_alter_friend_friend_alter_friend_user.py b/friends/migrations/0002_alter_friend_friend_alter_friend_user.py new file mode 100644 index 0000000..dea5a20 --- /dev/null +++ b/friends/migrations/0002_alter_friend_friend_alter_friend_user.py @@ -0,0 +1,33 @@ +# Generated by Django 4.2.14 on 2024-07-31 04:15 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ("friends", "0001_initial"), + ] + + operations = [ + migrations.AlterField( + model_name="friend", + name="friend", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="friend_of", + to=settings.AUTH_USER_MODEL, + ), + ), + migrations.AlterField( + model_name="friend", + name="user", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, + related_name="friends", + to=settings.AUTH_USER_MODEL, + ), + ), + ] diff --git a/friends/models.py b/friends/models.py index 504a075..3a473bc 100644 --- a/friends/models.py +++ b/friends/models.py @@ -1,5 +1,5 @@ from django.db import models -from users.models import User +from accounts.models import User # Create your models here. diff --git a/restaurants/migrations/0004_userrestaurantlist.py b/restaurants/migrations/0004_userrestaurantslist.py similarity index 93% rename from restaurants/migrations/0004_userrestaurantlist.py rename to restaurants/migrations/0004_userrestaurantslist.py index deac1ce..d74b814 100644 --- a/restaurants/migrations/0004_userrestaurantlist.py +++ b/restaurants/migrations/0004_userrestaurantslist.py @@ -1,4 +1,4 @@ -# Generated by Django 4.2.14 on 2024-07-31 03:43 +# Generated by Django 4.2.14 on 2024-07-31 04:31 from django.conf import settings from django.db import migrations, models @@ -13,7 +13,7 @@ class Migration(migrations.Migration): operations = [ migrations.CreateModel( - name="UserRestaurantList", + name="UserRestaurantsList", fields=[ ( "id", diff --git a/restaurants/models.py b/restaurants/models.py index 1d9700d..41bed37 100644 --- a/restaurants/models.py +++ b/restaurants/models.py @@ -36,7 +36,7 @@ class Meta: ordering = ["-timestamp"] -class UserRestaurantList(models.Model): +class UserRestaurantsList(models.Model): user = models.ForeignKey(User, on_delete=models.CASCADE) restaurant = models.ForeignKey(Restaurant, on_delete=models.CASCADE) diff --git a/restaurants/serializers.py b/restaurants/serializers.py index f0ce4bc..05b35a9 100644 --- a/restaurants/serializers.py +++ b/restaurants/serializers.py @@ -1,5 +1,5 @@ from rest_framework import serializers -from .models import Restaurant, SearchHistory, UserRestaurantList +from .models import Restaurant, SearchHistory, UserRestaurantsList class RestaurantSerializer(serializers.ModelSerializer): @@ -29,5 +29,5 @@ class UserRestaurantListSerializer(serializers.ModelSerializer): restaurant = RestaurantSerializer() class Meta: - model = UserRestaurantList + model = UserRestaurantsList fields = "__all__" diff --git a/restaurants/views.py b/restaurants/views.py index 2bf8b90..37c8509 100644 --- a/restaurants/views.py +++ b/restaurants/views.py @@ -2,7 +2,7 @@ from rest_framework.decorators import api_view from rest_framework.response import Response from rest_framework import status -from .models import Restaurant, SearchHistory, UserRestaurantList +from .models import Restaurant, SearchHistory, UserRestaurantsList from .serializers import ( RestaurantSerializer, RestaurantListSerializer, @@ -48,7 +48,7 @@ def search(request): @api_view(["GET"]) @login_required def user_restaurant_list(request): - user_restaurants = UserRestaurantList.objects.filter(user=request.user) + user_restaurants = UserRestaurantsList.objects.filter(user=request.user) serializer = UserRestaurantListSerializer(user_restaurants, many=True) return Response(serializer.data, status=status.HTTP_200_OK) @@ -59,13 +59,13 @@ def add_remove_restaurant(request, pk): try: restaurant = Restaurant.objects.get(pk=pk) if request.method == "POST": - UserRestaurantList.objects.create(user=request.user, restaurant=restaurant) + UserRestaurantsList.objects.create(user=request.user, restaurant=restaurant) return Response( {"message": "Restaurant added successfully"}, status=status.HTTP_201_CREATED, ) elif request.method == "DELETE": - user_restaurant = UserRestaurantList.objects.get( + user_restaurant = UserRestaurantsList.objects.get( user=request.user, restaurant=restaurant ) user_restaurant.delete() @@ -77,7 +77,7 @@ def add_remove_restaurant(request, pk): return Response( {"message": "Restaurant not found"}, status=status.HTTP_404_NOT_FOUND ) - except UserRestaurantList.DoesNotExist: + except UserRestaurantsList.DoesNotExist: return Response( {"message": "Restaurant not found in your list"}, status=status.HTTP_404_NOT_FOUND, diff --git a/reviews/migrations/0002_alter_recommend_user_alter_review_user.py b/reviews/migrations/0002_alter_recommend_user_alter_review_user.py new file mode 100644 index 0000000..0c09793 --- /dev/null +++ b/reviews/migrations/0002_alter_recommend_user_alter_review_user.py @@ -0,0 +1,29 @@ +# Generated by Django 4.2.14 on 2024-07-31 04:15 + +from django.conf import settings +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + dependencies = [ + migrations.swappable_dependency(settings.AUTH_USER_MODEL), + ("reviews", "0001_initial"), + ] + + operations = [ + migrations.AlterField( + model_name="recommend", + name="user", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL + ), + ), + migrations.AlterField( + model_name="review", + name="user", + field=models.ForeignKey( + on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL + ), + ), + ] diff --git a/reviews/models.py b/reviews/models.py index 1ffa83d..aa5f532 100644 --- a/reviews/models.py +++ b/reviews/models.py @@ -1,5 +1,5 @@ from django.db import models -from users.models import User +from accounts.models import User from restaurants.models import Restaurant # Create your models here. From 53a495e759ab01b305ba5e2820eaea567ec14c51 Mon Sep 17 00:00:00 2001 From: Shim Kyumin Date: Wed, 31 Jul 2024 15:16:53 +0900 Subject: [PATCH 5/5] =?UTF-8?q?chore:=20users=20=EC=95=B1=20=EC=82=AD?= =?UTF-8?q?=EC=A0=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- users/__init__.py | 0 users/admin.py | 3 --- users/apps.py | 6 ------ users/migrations/0001_initial.py | 31 ------------------------------- users/migrations/__init__.py | 0 users/models.py | 11 ----------- users/serializers.py | 8 -------- users/tests.py | 3 --- users/views.py | 3 --- 9 files changed, 65 deletions(-) delete mode 100644 users/__init__.py delete mode 100644 users/admin.py delete mode 100644 users/apps.py delete mode 100644 users/migrations/0001_initial.py delete mode 100644 users/migrations/__init__.py delete mode 100644 users/models.py delete mode 100644 users/serializers.py delete mode 100644 users/tests.py delete mode 100644 users/views.py diff --git a/users/__init__.py b/users/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/users/admin.py b/users/admin.py deleted file mode 100644 index 4185d36..0000000 --- a/users/admin.py +++ /dev/null @@ -1,3 +0,0 @@ -# from django.contrib import admin - -# Register your models here. diff --git a/users/apps.py b/users/apps.py deleted file mode 100644 index 88f7b17..0000000 --- a/users/apps.py +++ /dev/null @@ -1,6 +0,0 @@ -from django.apps import AppConfig - - -class UsersConfig(AppConfig): - default_auto_field = "django.db.models.BigAutoField" - name = "users" diff --git a/users/migrations/0001_initial.py b/users/migrations/0001_initial.py deleted file mode 100644 index b5b9347..0000000 --- a/users/migrations/0001_initial.py +++ /dev/null @@ -1,31 +0,0 @@ -# Generated by Django 4.2.14 on 2024-07-26 14:19 - -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", - ), - ), - ("email", models.CharField(max_length=255)), - ("password", models.CharField(max_length=255)), - ("nickname", models.CharField(blank=True, max_length=255, null=True)), - ("image", models.CharField(blank=True, max_length=255, null=True)), - ("reliability", models.SmallIntegerField(blank=True, null=True)), - ], - ), - ] diff --git a/users/migrations/__init__.py b/users/migrations/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/users/models.py b/users/models.py deleted file mode 100644 index b061854..0000000 --- a/users/models.py +++ /dev/null @@ -1,11 +0,0 @@ -from django.db import models - -# Create your models here. - - -class User(models.Model): - email = models.CharField(max_length=255) - password = models.CharField(max_length=255) - nickname = models.CharField(max_length=255, null=True, blank=True) - image = models.CharField(max_length=255, null=True, blank=True) - reliability = models.SmallIntegerField(null=True, blank=True) diff --git a/users/serializers.py b/users/serializers.py deleted file mode 100644 index 0ec035c..0000000 --- a/users/serializers.py +++ /dev/null @@ -1,8 +0,0 @@ -from rest_framework import serializers -from .models import User - - -class UserSerializer(serializers.ModelSerializer): - class Meta: - model = User - fields = "__all__" diff --git a/users/tests.py b/users/tests.py deleted file mode 100644 index a79ca8b..0000000 --- a/users/tests.py +++ /dev/null @@ -1,3 +0,0 @@ -# from django.test import TestCase - -# Create your tests here. diff --git a/users/views.py b/users/views.py deleted file mode 100644 index fd0e044..0000000 --- a/users/views.py +++ /dev/null @@ -1,3 +0,0 @@ -# from django.shortcuts import render - -# Create your views here.