From 3f9a48e2f69f52a1e5e348e0a9399f59d6a529c8 Mon Sep 17 00:00:00 2001 From: KyoRuMan Date: Wed, 13 Jul 2022 23:36:14 +0900 Subject: [PATCH] simple setup --- backend/Untitled.ipynb | 32 ++++++++++++++++++++++++++------ backend/backend/urls.py | 1 + backend/rebikeuser/urls.py | 7 +++++++ backend/rebikeuser/views.py | 8 +++++++- backend/requirements.txt | 1 + 5 files changed, 42 insertions(+), 7 deletions(-) diff --git a/backend/Untitled.ipynb b/backend/Untitled.ipynb index 2f3e6cb..4545520 100644 --- a/backend/Untitled.ipynb +++ b/backend/Untitled.ipynb @@ -4,7 +4,11 @@ "cell_type": "code", "execution_count": 1, "id": "0d104680", - "metadata": {}, + "metadata": { + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "import os\n", @@ -19,7 +23,11 @@ "cell_type": "code", "execution_count": 2, "id": "b48ed5fa", - "metadata": {}, + "metadata": { + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [ "from rebikeuser.models import User" @@ -29,7 +37,11 @@ "cell_type": "code", "execution_count": 3, "id": "4c259257", - "metadata": {}, + "metadata": { + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [ { "data": { @@ -51,7 +63,11 @@ "cell_type": "code", "execution_count": 8, "id": "1ae3deb3", - "metadata": {}, + "metadata": { + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [ { "data": { @@ -72,7 +88,11 @@ "cell_type": "code", "execution_count": null, "id": "efd36010", - "metadata": {}, + "metadata": { + "pycharm": { + "name": "#%%\n" + } + }, "outputs": [], "source": [] } @@ -98,4 +118,4 @@ }, "nbformat": 4, "nbformat_minor": 5 -} +} \ No newline at end of file diff --git a/backend/backend/urls.py b/backend/backend/urls.py index 22db1ce..996b207 100644 --- a/backend/backend/urls.py +++ b/backend/backend/urls.py @@ -3,4 +3,5 @@ urlpatterns = [ path('admin/', admin.site.urls), + path('user/', include('rebikeuser.urls')), ] diff --git a/backend/rebikeuser/urls.py b/backend/rebikeuser/urls.py index e69de29..76441c8 100644 --- a/backend/rebikeuser/urls.py +++ b/backend/rebikeuser/urls.py @@ -0,0 +1,7 @@ +from django.urls import path +from . import views + + +urlpatterns =[ + path('login/', views.on_login) +] \ No newline at end of file diff --git a/backend/rebikeuser/views.py b/backend/rebikeuser/views.py index ef47668..2988630 100644 --- a/backend/rebikeuser/views.py +++ b/backend/rebikeuser/views.py @@ -1,4 +1,10 @@ from django.http import HttpResponse -from django.http.response import JsonResponse +from .models import User +def on_login(request): + qs = User.objects.all() + username = request.GET.get('username', '') + if username: + qs = qs.filter(user_name=username) + return HttpResponse(qs) diff --git a/backend/requirements.txt b/backend/requirements.txt index aced782..0fae788 100644 --- a/backend/requirements.txt +++ b/backend/requirements.txt @@ -5,3 +5,4 @@ PyMySQL==1.0.2 mysql-connector-python==8.0.23 setuptools==58.1.0 mysqlclient==2.1.1 +