Skip to content

Commit

Permalink
chore: add back db files
Browse files Browse the repository at this point in the history
  • Loading branch information
chloe1129 committed Jul 19, 2022
1 parent a74b0fa commit 99f08ca
Show file tree
Hide file tree
Showing 172 changed files with 655 additions and 104 deletions.
61 changes: 58 additions & 3 deletions backend/Untitled.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,45 @@
"cells": [
{
"cell_type": "code",
"execution_count": 2,
"execution_count": 1,
"id": "0d104680",
"metadata": {
"pycharm": {
"name": "#%%\n"
}
},
"outputs": [],
"outputs": [
{
"ename": "ImproperlyConfigured",
"evalue": "Set the IS_DEV environment variable",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mKeyError\u001b[0m Traceback (most recent call last)",
"File \u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/environ/environ.py:403\u001b[0m, in \u001b[0;36mEnv.get_value\u001b[0;34m(self, var, cast, default, parse_default)\u001b[0m\n\u001b[1;32m 402\u001b[0m \u001b[38;5;28;01mtry\u001b[39;00m:\n\u001b[0;32m--> 403\u001b[0m value \u001b[38;5;241m=\u001b[39m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mENVIRON\u001b[49m\u001b[43m[\u001b[49m\u001b[43mvar_name\u001b[49m\u001b[43m]\u001b[49m\n\u001b[1;32m 404\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m \u001b[38;5;28;01mas\u001b[39;00m exc:\n",
"File \u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/os.py:679\u001b[0m, in \u001b[0;36m_Environ.__getitem__\u001b[0;34m(self, key)\u001b[0m\n\u001b[1;32m 677\u001b[0m \u001b[38;5;28;01mexcept\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m:\n\u001b[1;32m 678\u001b[0m \u001b[38;5;66;03m# raise KeyError with the original key value\u001b[39;00m\n\u001b[0;32m--> 679\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m \u001b[38;5;167;01mKeyError\u001b[39;00m(key) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;28mNone\u001b[39m\n\u001b[1;32m 680\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mdecodevalue(value)\n",
"\u001b[0;31mKeyError\u001b[0m: 'IS_DEV'",
"\nThe above exception was the direct cause of the following exception:\n",
"\u001b[0;31mImproperlyConfigured\u001b[0m Traceback (most recent call last)",
"Input \u001b[0;32mIn [1]\u001b[0m, in \u001b[0;36m<cell line: 6>\u001b[0;34m()\u001b[0m\n\u001b[1;32m 3\u001b[0m os\u001b[38;5;241m.\u001b[39menviron[\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mDJANGO_ALLOW_ASYNC_UNSAFE\u001b[39m\u001b[38;5;124m\"\u001b[39m] \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mtrue\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 5\u001b[0m \u001b[38;5;28;01mimport\u001b[39;00m \u001b[38;5;21;01mdjango\u001b[39;00m\n\u001b[0;32m----> 6\u001b[0m \u001b[43mdjango\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43msetup\u001b[49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/django/__init__.py:19\u001b[0m, in \u001b[0;36msetup\u001b[0;34m(set_prefix)\u001b[0m\n\u001b[1;32m 16\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mdjango\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01murls\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m set_script_prefix\n\u001b[1;32m 17\u001b[0m \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mdjango\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mutils\u001b[39;00m\u001b[38;5;21;01m.\u001b[39;00m\u001b[38;5;21;01mlog\u001b[39;00m \u001b[38;5;28;01mimport\u001b[39;00m configure_logging\n\u001b[0;32m---> 19\u001b[0m configure_logging(\u001b[43msettings\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mLOGGING_CONFIG\u001b[49m, settings\u001b[38;5;241m.\u001b[39mLOGGING)\n\u001b[1;32m 20\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m set_prefix:\n\u001b[1;32m 21\u001b[0m set_script_prefix(\n\u001b[1;32m 22\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124m/\u001b[39m\u001b[38;5;124m'\u001b[39m \u001b[38;5;28;01mif\u001b[39;00m settings\u001b[38;5;241m.\u001b[39mFORCE_SCRIPT_NAME \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28;01mNone\u001b[39;00m \u001b[38;5;28;01melse\u001b[39;00m settings\u001b[38;5;241m.\u001b[39mFORCE_SCRIPT_NAME\n\u001b[1;32m 23\u001b[0m )\n",
"File \u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/django/conf/__init__.py:84\u001b[0m, in \u001b[0;36mLazySettings.__getattr__\u001b[0;34m(self, name)\u001b[0m\n\u001b[1;32m 82\u001b[0m \u001b[38;5;124;03m\"\"\"Return the value of a setting and cache it in self.__dict__.\"\"\"\u001b[39;00m\n\u001b[1;32m 83\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_wrapped \u001b[38;5;129;01mis\u001b[39;00m empty:\n\u001b[0;32m---> 84\u001b[0m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_setup\u001b[49m\u001b[43m(\u001b[49m\u001b[43mname\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 85\u001b[0m val \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mgetattr\u001b[39m(\u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_wrapped, name)\n\u001b[1;32m 87\u001b[0m \u001b[38;5;66;03m# Special case some settings which require further modification.\u001b[39;00m\n\u001b[1;32m 88\u001b[0m \u001b[38;5;66;03m# This is done here for performance reasons so the modified value is cached.\u001b[39;00m\n",
"File \u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/django/conf/__init__.py:71\u001b[0m, in \u001b[0;36mLazySettings._setup\u001b[0;34m(self, name)\u001b[0m\n\u001b[1;32m 64\u001b[0m desc \u001b[38;5;241m=\u001b[39m (\u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msetting \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m\"\u001b[39m \u001b[38;5;241m%\u001b[39m name) \u001b[38;5;28;01mif\u001b[39;00m name \u001b[38;5;28;01melse\u001b[39;00m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124msettings\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 65\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m ImproperlyConfigured(\n\u001b[1;32m 66\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mRequested \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m, but settings are not configured. \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 67\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mYou must either define the environment variable \u001b[39m\u001b[38;5;132;01m%s\u001b[39;00m\u001b[38;5;124m \u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 68\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mor call settings.configure() before accessing settings.\u001b[39m\u001b[38;5;124m\"\u001b[39m\n\u001b[1;32m 69\u001b[0m \u001b[38;5;241m%\u001b[39m (desc, ENVIRONMENT_VARIABLE))\n\u001b[0;32m---> 71\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_wrapped \u001b[38;5;241m=\u001b[39m \u001b[43mSettings\u001b[49m\u001b[43m(\u001b[49m\u001b[43msettings_module\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/django/conf/__init__.py:179\u001b[0m, in \u001b[0;36mSettings.__init__\u001b[0;34m(self, settings_module)\u001b[0m\n\u001b[1;32m 176\u001b[0m \u001b[38;5;66;03m# store the settings module in case someone later cares\u001b[39;00m\n\u001b[1;32m 177\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mSETTINGS_MODULE \u001b[38;5;241m=\u001b[39m settings_module\n\u001b[0;32m--> 179\u001b[0m mod \u001b[38;5;241m=\u001b[39m \u001b[43mimportlib\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mimport_module\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mSETTINGS_MODULE\u001b[49m\u001b[43m)\u001b[49m\n\u001b[1;32m 181\u001b[0m tuple_settings \u001b[38;5;241m=\u001b[39m (\n\u001b[1;32m 182\u001b[0m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mALLOWED_HOSTS\u001b[39m\u001b[38;5;124m'\u001b[39m,\n\u001b[1;32m 183\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mINSTALLED_APPS\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 184\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mTEMPLATE_DIRS\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 185\u001b[0m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mLOCALE_PATHS\u001b[39m\u001b[38;5;124m\"\u001b[39m,\n\u001b[1;32m 186\u001b[0m )\n\u001b[1;32m 187\u001b[0m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39m_explicit_settings \u001b[38;5;241m=\u001b[39m \u001b[38;5;28mset\u001b[39m()\n",
"File \u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/importlib/__init__.py:126\u001b[0m, in \u001b[0;36mimport_module\u001b[0;34m(name, package)\u001b[0m\n\u001b[1;32m 124\u001b[0m \u001b[38;5;28;01mbreak\u001b[39;00m\n\u001b[1;32m 125\u001b[0m level \u001b[38;5;241m+\u001b[39m\u001b[38;5;241m=\u001b[39m \u001b[38;5;241m1\u001b[39m\n\u001b[0;32m--> 126\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[43m_bootstrap\u001b[49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43m_gcd_import\u001b[49m\u001b[43m(\u001b[49m\u001b[43mname\u001b[49m\u001b[43m[\u001b[49m\u001b[43mlevel\u001b[49m\u001b[43m:\u001b[49m\u001b[43m]\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mpackage\u001b[49m\u001b[43m,\u001b[49m\u001b[43m \u001b[49m\u001b[43mlevel\u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m<frozen importlib._bootstrap>:1050\u001b[0m, in \u001b[0;36m_gcd_import\u001b[0;34m(name, package, level)\u001b[0m\n",
"File \u001b[0;32m<frozen importlib._bootstrap>:1027\u001b[0m, in \u001b[0;36m_find_and_load\u001b[0;34m(name, import_)\u001b[0m\n",
"File \u001b[0;32m<frozen importlib._bootstrap>:1006\u001b[0m, in \u001b[0;36m_find_and_load_unlocked\u001b[0;34m(name, import_)\u001b[0m\n",
"File \u001b[0;32m<frozen importlib._bootstrap>:688\u001b[0m, in \u001b[0;36m_load_unlocked\u001b[0;34m(spec)\u001b[0m\n",
"File \u001b[0;32m<frozen importlib._bootstrap_external>:883\u001b[0m, in \u001b[0;36mexec_module\u001b[0;34m(self, module)\u001b[0m\n",
"File \u001b[0;32m<frozen importlib._bootstrap>:241\u001b[0m, in \u001b[0;36m_call_with_frames_removed\u001b[0;34m(f, *args, **kwds)\u001b[0m\n",
"File \u001b[0;32m~/Desktop/dev/1.inProgress/HowTrash/backend/backend/settings.py:21\u001b[0m, in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[1;32m 16\u001b[0m env \u001b[38;5;241m=\u001b[39m environ\u001b[38;5;241m.\u001b[39mEnv(DEBUG\u001b[38;5;241m=\u001b[39m(\u001b[38;5;28mbool\u001b[39m, \u001b[38;5;28;01mTrue\u001b[39;00m))\n\u001b[1;32m 17\u001b[0m environ\u001b[38;5;241m.\u001b[39mEnv\u001b[38;5;241m.\u001b[39mread_env(\n\u001b[1;32m 18\u001b[0m env_file\u001b[38;5;241m=\u001b[39mos\u001b[38;5;241m.\u001b[39mpath\u001b[38;5;241m.\u001b[39mjoin(BASE_DIR, \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mdb.env\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 19\u001b[0m )\n\u001b[0;32m---> 21\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m \u001b[43menv\u001b[49m\u001b[43m(\u001b[49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[38;5;124;43mIS_DEV\u001b[39;49m\u001b[38;5;124;43m'\u001b[39;49m\u001b[43m)\u001b[49m:\n\u001b[1;32m 22\u001b[0m SECRET_KEY \u001b[38;5;241m=\u001b[39m env(\u001b[38;5;124m'\u001b[39m\u001b[38;5;124mSECRET_KEY\u001b[39m\u001b[38;5;124m'\u001b[39m)\n\u001b[1;32m 23\u001b[0m DB_URL \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m'\u001b[39m\u001b[38;5;124mlocalhost:8989\u001b[39m\u001b[38;5;124m'\u001b[39m\n",
"File \u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/environ/environ.py:197\u001b[0m, in \u001b[0;36mEnv.__call__\u001b[0;34m(self, var, cast, default, parse_default)\u001b[0m\n\u001b[1;32m 196\u001b[0m \u001b[38;5;28;01mdef\u001b[39;00m \u001b[38;5;21m__call__\u001b[39m(\u001b[38;5;28mself\u001b[39m, var, cast\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mNone\u001b[39;00m, default\u001b[38;5;241m=\u001b[39mNOTSET, parse_default\u001b[38;5;241m=\u001b[39m\u001b[38;5;28;01mFalse\u001b[39;00m):\n\u001b[0;32m--> 197\u001b[0m \u001b[38;5;28;01mreturn\u001b[39;00m \u001b[38;5;28;43mself\u001b[39;49m\u001b[38;5;241;43m.\u001b[39;49m\u001b[43mget_value\u001b[49m\u001b[43m(\u001b[49m\n\u001b[1;32m 198\u001b[0m \u001b[43m \u001b[49m\u001b[43mvar\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 199\u001b[0m \u001b[43m \u001b[49m\u001b[43mcast\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mcast\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 200\u001b[0m \u001b[43m \u001b[49m\u001b[43mdefault\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mdefault\u001b[49m\u001b[43m,\u001b[49m\n\u001b[1;32m 201\u001b[0m \u001b[43m \u001b[49m\u001b[43mparse_default\u001b[49m\u001b[38;5;241;43m=\u001b[39;49m\u001b[43mparse_default\u001b[49m\n\u001b[1;32m 202\u001b[0m \u001b[43m \u001b[49m\u001b[43m)\u001b[49m\n",
"File \u001b[0;32m/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/environ/environ.py:407\u001b[0m, in \u001b[0;36mEnv.get_value\u001b[0;34m(self, var, cast, default, parse_default)\u001b[0m\n\u001b[1;32m 405\u001b[0m \u001b[38;5;28;01mif\u001b[39;00m default \u001b[38;5;129;01mis\u001b[39;00m \u001b[38;5;28mself\u001b[39m\u001b[38;5;241m.\u001b[39mNOTSET:\n\u001b[1;32m 406\u001b[0m error_msg \u001b[38;5;241m=\u001b[39m \u001b[38;5;124m\"\u001b[39m\u001b[38;5;124mSet the \u001b[39m\u001b[38;5;132;01m{}\u001b[39;00m\u001b[38;5;124m environment variable\u001b[39m\u001b[38;5;124m\"\u001b[39m\u001b[38;5;241m.\u001b[39mformat(var)\n\u001b[0;32m--> 407\u001b[0m \u001b[38;5;28;01mraise\u001b[39;00m ImproperlyConfigured(error_msg) \u001b[38;5;28;01mfrom\u001b[39;00m \u001b[38;5;21;01mexc\u001b[39;00m\n\u001b[1;32m 409\u001b[0m value \u001b[38;5;241m=\u001b[39m default\n\u001b[1;32m 411\u001b[0m \u001b[38;5;66;03m# Resolve any proxied values\u001b[39;00m\n",
"\u001b[0;31mImproperlyConfigured\u001b[0m: Set the IS_DEV environment variable"
]
}
],
"source": [
"import os\n",
"os.environ['DJANGO_SETTINGS_MODULE'] = \"backend.settings\"\n",
Expand Down Expand Up @@ -70,9 +101,33 @@
},
{
"cell_type": "code",
"execution_count": null,
"execution_count": 4,
"id": "a0b06a11",
"metadata": {},
"outputs": [
{
"ename": "SyntaxError",
"evalue": "invalid syntax (2224374530.py, line 3)",
"output_type": "error",
"traceback": [
"\u001b[0;36m Input \u001b[0;32mIn [4]\u001b[0;36m\u001b[0m\n\u001b[0;31m if hello:\u001b[0m\n\u001b[0m ^\u001b[0m\n\u001b[0;31mSyntaxError\u001b[0m\u001b[0;31m:\u001b[0m invalid syntax\n"
]
}
],
"source": [
"hello = True\n",
"print(\n",
" if hello:\n",
" return'sorry'\n",
" return 'hello'\n",
")\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f50149c1",
"metadata": {},
"outputs": [],
"source": []
}
Expand Down
20 changes: 14 additions & 6 deletions backend/backend/settings.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from pathlib import Path


####환경변수 설정
import os
import environ
Expand All @@ -18,7 +19,12 @@
env_file=os.path.join(BASE_DIR, '.env')
)

SECRET_KEY = env('SECRET_KEY')
if not env('IS_DEV'):
SECRET_KEY = env('SECRET_KEY')
DB_URL = 'localhost:8989'
else:
SECRET_KEY = env('SECRET_KEY')
DB_URL = env('DATABASE_URL')

# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = env('DEBUG')
Expand All @@ -36,10 +42,11 @@
'django.contrib.staticfiles',
# add
'rest_framework',
'corsheaders',
'drf_yasg',
# local apps
'rebikeuser',
'rebiketrash',
'corsheaders',
]

MIDDLEWARE = [
Expand Down Expand Up @@ -80,7 +87,10 @@
# https://docs.djangoproject.com/en/4.0/ref/settings/#databases

DATABASES = {
'default': env.db()
'default': env.db(),
'OPTIONS': {
'init_command': "SET sql_mode='STRICT_TRANS_TABLES'"
}
}

# Password validation
Expand Down Expand Up @@ -110,9 +120,7 @@

USE_I18N = True

USE_TZ = True

CORS_ALLOW_CREDENTIALS = True
USE_TZ = False

# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/4.0/howto/static-files/
Expand Down
27 changes: 18 additions & 9 deletions backend/backend/urls.py
Original file line number Diff line number Diff line change
@@ -1,18 +1,27 @@

from django.contrib import admin
from django.urls import path, include
from django.contrib import admin
from django.urls import path, include
from rest_framework.permissions import AllowAny
from django.contrib import admin
from django.urls import path, include
from rest_framework import permissions
from django.urls import include, re_path
from django.contrib import admin
from django.urls import path, include, re_path
from rest_framework.permissions import AllowAny
from drf_yasg.views import get_schema_view
from drf_yasg import openapi

schema_view_v1 = get_schema_view(
openapi.Info(
title="Open API",
default_version='v1',
description="간단한 설명",
terms_of_service="https://www.google.com/policies/terms/",
),
public=True,
permission_classes=(AllowAny,),
)

urlpatterns = [
path('admin/', admin.site.urls),
path('user/', include('rebikeuser.urls')),
path('trash/', include('rebiketrash.urls')),

re_path(r'^swagger(?P<format>\.json|\.yaml)$', schema_view_v1.without_ui(cache_timeout=0), name='schema-json'),
re_path(r'^swagger/$', schema_view_v1.with_ui('swagger', cache_timeout=0), name='schema-swagger-ui'),
re_path(r'^redoc/$', schema_view_v1.with_ui('redoc', cache_timeout=0), name='schema-redoc'),
]
6 changes: 4 additions & 2 deletions backend/rebiketrash/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,15 @@

from .models import trash_kind, uploaded_trash_image


@admin.register(trash_kind)
class TrashkindAdmin(admin.ModelAdmin):
list_display = ['kind', 'way']
search_fields = ['kind']


@admin.register(uploaded_trash_image)
class UploadedtrashimageAdmin(admin.ModelAdmin):
list_display = ['uploaded_trash_image_id', 'img', 'created_at', 'updated_at','user_id', 'trash_kind']
list_display = ['uploaded_trash_image_id', 'active', 'img',
'created_at', 'updated_at', 'user_id', 'trash_kind']
search_fields = ['uploaded_trash_image_id']

11 changes: 6 additions & 5 deletions backend/rebiketrash/models.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
from django.db import models
from rebikeuser.models import user
from rebikeuser.models import user


class trash_kind(models.Model):
kind = models.CharField(primary_key=True, max_length=30)
way = models.CharField(max_length=200)
created_at = models.DateTimeField()
updated_at = models.DateTimeField()
created_at = models.DateTimeField(auto_now_add=True, blank=True)
updated_at = models.DateTimeField(auto_now_add=True, blank=True)

class Meta:
managed = False
Expand All @@ -17,11 +17,12 @@ class uploaded_trash_image(models.Model):
uploaded_trash_image_id = models.AutoField(primary_key=True)
active = models.IntegerField(default=1)
img = models.CharField(max_length=200)
created_at = models.DateTimeField()
updated_at = models.DateTimeField()
created_at = models.DateTimeField(auto_now_add=True, blank=True)
updated_at = models.DateTimeField(auto_now_add=True, blank=True)
user_id = models.ForeignKey(user, on_delete=models.CASCADE, db_column='user_id')
trash_kind = models.ForeignKey(trash_kind, on_delete=models.CASCADE, db_column='trash_kind')

class Meta:
managed = False
db_table = 'uploaded_trash_image'

Loading

0 comments on commit 99f08ca

Please sign in to comment.