Skip to content

Commit

Permalink
set_up
Browse files Browse the repository at this point in the history
  • Loading branch information
Ryokuman committed Jul 13, 2022
1 parent c8d589c commit 86c2d51
Show file tree
Hide file tree
Showing 6 changed files with 113 additions and 6 deletions.
101 changes: 101 additions & 0 deletions backend/Untitled.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": 1,
"id": "0d104680",
"metadata": {},
"outputs": [],
"source": [
"import os\n",
"os.environ['DJANGO_SETTINGS_MODULE'] = \"backend.settings\"\n",
"os.environ[\"DJANGO_ALLOW_ASYNC_UNSAFE\"] = \"true\"\n",
"\n",
"import django\n",
"django.setup()"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "b48ed5fa",
"metadata": {},
"outputs": [],
"source": [
"from rebikeuser.models import User"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "4c259257",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"<QuerySet [<User: User object (1)>, <User: User object (2)>, <User: User object (3)>]>"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"qs = User.objects.all()\n",
"qs"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "1ae3deb3",
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"'1234'"
]
},
"execution_count": 8,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"qs[1].user_pw"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "efd36010",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.2"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Empty file removed backend/rebikeuser/__init__.py
Empty file.
7 changes: 6 additions & 1 deletion backend/rebikeuser/admin.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
from django.contrib import admin
from .models import User

# Register your models here.

@admin.register(User)
class UserAdmin(admin.ModelAdmin):
list_display = ['id', 'user_name', 'user_alias', 'user_pw', 'user_email']
search_fields = ['id']
3 changes: 3 additions & 0 deletions backend/rebikeuser/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ class User(models.Model):
user_pw = models.CharField(max_length=64)
user_email = models.CharField(unique=True, max_length=50)

def __str__(self):
return self.user_name

class Meta:
managed = False
db_table = 'User'
3 changes: 0 additions & 3 deletions backend/rebikeuser/tests.py

This file was deleted.

5 changes: 3 additions & 2 deletions backend/rebikeuser/views.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from django.shortcuts import render
from django.http import HttpResponse
from django.http.response import JsonResponse


# Create your views here.

0 comments on commit 86c2d51

Please sign in to comment.