This commit is contained in:
Kseninia Mikhaylova 2024-05-28 16:02:18 +03:00
parent 7b89dd25e7
commit 2e09d6dcd4
6 changed files with 141 additions and 65 deletions

View File

@ -24,6 +24,15 @@
"detail": "pathlib",
"documentation": {}
},
{
"label": "dotenv",
"kind": 6,
"isExtraImport": true,
"importPath": "dotenv",
"description": "dotenv",
"detail": "dotenv",
"documentation": {}
},
{
"label": "admin",
"importPath": "django.contrib",
@ -97,11 +106,20 @@
"documentation": {}
},
{
"label": "AppConfig",
"importPath": "django.apps",
"description": "django.apps",
"label": "django.db.models.deletion",
"kind": 6,
"isExtraImport": true,
"detail": "django.apps",
"importPath": "django.db.models.deletion",
"description": "django.db.models.deletion",
"detail": "django.db.models.deletion",
"documentation": {}
},
{
"label": "migrations",
"importPath": "django.db",
"description": "django.db",
"isExtraImport": true,
"detail": "django.db",
"documentation": {}
},
{
@ -112,6 +130,22 @@
"detail": "django.db",
"documentation": {}
},
{
"label": "models",
"importPath": "django.db",
"description": "django.db",
"isExtraImport": true,
"detail": "django.db",
"documentation": {}
},
{
"label": "AppConfig",
"importPath": "django.apps",
"description": "django.apps",
"isExtraImport": true,
"detail": "django.apps",
"documentation": {}
},
{
"label": "TestCase",
"importPath": "django.test",
@ -1634,7 +1668,7 @@
"kind": 5,
"importPath": "back.api.settings",
"description": "back.api.settings",
"peekOfCode": "BASE_DIR = Path(__file__).resolve().parent.parent\n# Quick-start development settings - unsuitable for production\n# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/\n# SECURITY WARNING: keep the secret key used in production secret!\nSECRET_KEY = 'django-insecure-ruo!wst&sb8(f9)j5u4rda-w!673lj_-c0a%gx_t@)ff*q*2ze'\n# SECURITY WARNING: don't run with debug turned on in production!\nDEBUG = True\nALLOWED_HOSTS = []\n# Application definition\nINSTALLED_APPS = [",
"peekOfCode": "BASE_DIR = Path(__file__).resolve().parent.parent\n# Quick-start development settings - unsuitable for production\n# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/\n# SECURITY WARNING: keep the secret key used in production secret!\nSECRET_KEY = \"django-insecure-ruo!wst&sb8(f9)j5u4rda-w!673lj_-c0a%gx_t@)ff*q*2ze\"\n# SECURITY WARNING: don't run with debug turned on in production!\nDEBUG = True\nALLOWED_HOSTS = []\n# Application definition\nINSTALLED_APPS = [",
"detail": "back.api.settings",
"documentation": {}
},
@ -1643,7 +1677,7 @@
"kind": 5,
"importPath": "back.api.settings",
"description": "back.api.settings",
"peekOfCode": "SECRET_KEY = 'django-insecure-ruo!wst&sb8(f9)j5u4rda-w!673lj_-c0a%gx_t@)ff*q*2ze'\n# SECURITY WARNING: don't run with debug turned on in production!\nDEBUG = True\nALLOWED_HOSTS = []\n# Application definition\nINSTALLED_APPS = [\n 'inventory',\n 'django.contrib.admin',\n 'django.contrib.auth',\n 'django.contrib.contenttypes',",
"peekOfCode": "SECRET_KEY = \"django-insecure-ruo!wst&sb8(f9)j5u4rda-w!673lj_-c0a%gx_t@)ff*q*2ze\"\n# SECURITY WARNING: don't run with debug turned on in production!\nDEBUG = True\nALLOWED_HOSTS = []\n# Application definition\nINSTALLED_APPS = [\n \"inventory\",\n \"django.contrib.admin\",\n \"django.contrib.auth\",\n \"django.contrib.contenttypes\",",
"detail": "back.api.settings",
"documentation": {}
},
@ -1652,7 +1686,7 @@
"kind": 5,
"importPath": "back.api.settings",
"description": "back.api.settings",
"peekOfCode": "DEBUG = True\nALLOWED_HOSTS = []\n# Application definition\nINSTALLED_APPS = [\n 'inventory',\n 'django.contrib.admin',\n 'django.contrib.auth',\n 'django.contrib.contenttypes',\n 'django.contrib.sessions',\n 'django.contrib.messages',",
"peekOfCode": "DEBUG = True\nALLOWED_HOSTS = []\n# Application definition\nINSTALLED_APPS = [\n \"inventory\",\n \"django.contrib.admin\",\n \"django.contrib.auth\",\n \"django.contrib.contenttypes\",\n \"django.contrib.sessions\",\n \"django.contrib.messages\",",
"detail": "back.api.settings",
"documentation": {}
},
@ -1661,7 +1695,7 @@
"kind": 5,
"importPath": "back.api.settings",
"description": "back.api.settings",
"peekOfCode": "ALLOWED_HOSTS = []\n# Application definition\nINSTALLED_APPS = [\n 'inventory',\n 'django.contrib.admin',\n 'django.contrib.auth',\n 'django.contrib.contenttypes',\n 'django.contrib.sessions',\n 'django.contrib.messages',\n 'django.contrib.staticfiles',",
"peekOfCode": "ALLOWED_HOSTS = []\n# Application definition\nINSTALLED_APPS = [\n \"inventory\",\n \"django.contrib.admin\",\n \"django.contrib.auth\",\n \"django.contrib.contenttypes\",\n \"django.contrib.sessions\",\n \"django.contrib.messages\",\n \"django.contrib.staticfiles\",",
"detail": "back.api.settings",
"documentation": {}
},
@ -1670,7 +1704,7 @@
"kind": 5,
"importPath": "back.api.settings",
"description": "back.api.settings",
"peekOfCode": "INSTALLED_APPS = [\n 'inventory',\n 'django.contrib.admin',\n 'django.contrib.auth',\n 'django.contrib.contenttypes',\n 'django.contrib.sessions',\n 'django.contrib.messages',\n 'django.contrib.staticfiles',\n 'rest_framework',\n]",
"peekOfCode": "INSTALLED_APPS = [\n \"inventory\",\n \"django.contrib.admin\",\n \"django.contrib.auth\",\n \"django.contrib.contenttypes\",\n \"django.contrib.sessions\",\n \"django.contrib.messages\",\n \"django.contrib.staticfiles\",\n \"rest_framework\",\n]",
"detail": "back.api.settings",
"documentation": {}
},
@ -1679,7 +1713,7 @@
"kind": 5,
"importPath": "back.api.settings",
"description": "back.api.settings",
"peekOfCode": "MIDDLEWARE = [\n 'django.middleware.security.SecurityMiddleware',\n 'django.contrib.sessions.middleware.SessionMiddleware',\n 'django.middleware.common.CommonMiddleware',\n 'django.middleware.csrf.CsrfViewMiddleware',\n 'django.contrib.auth.middleware.AuthenticationMiddleware',\n 'django.contrib.messages.middleware.MessageMiddleware',\n 'django.middleware.clickjacking.XFrameOptionsMiddleware',\n]\nROOT_URLCONF = 'api.urls'",
"peekOfCode": "MIDDLEWARE = [\n \"django.middleware.security.SecurityMiddleware\",\n \"django.contrib.sessions.middleware.SessionMiddleware\",\n \"django.middleware.common.CommonMiddleware\",\n \"django.middleware.csrf.CsrfViewMiddleware\",\n \"django.contrib.auth.middleware.AuthenticationMiddleware\",\n \"django.contrib.messages.middleware.MessageMiddleware\",\n \"django.middleware.clickjacking.XFrameOptionsMiddleware\",\n]\nROOT_URLCONF = \"api.urls\"",
"detail": "back.api.settings",
"documentation": {}
},
@ -1688,7 +1722,7 @@
"kind": 5,
"importPath": "back.api.settings",
"description": "back.api.settings",
"peekOfCode": "ROOT_URLCONF = 'api.urls'\nTEMPLATES = [\n {\n 'BACKEND': 'django.template.backends.django.DjangoTemplates',\n 'DIRS': [],\n 'APP_DIRS': True,\n 'OPTIONS': {\n 'context_processors': [\n 'django.template.context_processors.debug',\n 'django.template.context_processors.request',",
"peekOfCode": "ROOT_URLCONF = \"api.urls\"\nTEMPLATES = [\n {\n \"BACKEND\": \"django.template.backends.django.DjangoTemplates\",\n \"DIRS\": [],\n \"APP_DIRS\": True,\n \"OPTIONS\": {\n \"context_processors\": [\n \"django.template.context_processors.debug\",\n \"django.template.context_processors.request\",",
"detail": "back.api.settings",
"documentation": {}
},
@ -1697,7 +1731,7 @@
"kind": 5,
"importPath": "back.api.settings",
"description": "back.api.settings",
"peekOfCode": "TEMPLATES = [\n {\n 'BACKEND': 'django.template.backends.django.DjangoTemplates',\n 'DIRS': [],\n 'APP_DIRS': True,\n 'OPTIONS': {\n 'context_processors': [\n 'django.template.context_processors.debug',\n 'django.template.context_processors.request',\n 'django.contrib.auth.context_processors.auth',",
"peekOfCode": "TEMPLATES = [\n {\n \"BACKEND\": \"django.template.backends.django.DjangoTemplates\",\n \"DIRS\": [],\n \"APP_DIRS\": True,\n \"OPTIONS\": {\n \"context_processors\": [\n \"django.template.context_processors.debug\",\n \"django.template.context_processors.request\",\n \"django.contrib.auth.context_processors.auth\",",
"detail": "back.api.settings",
"documentation": {}
},
@ -1706,7 +1740,7 @@
"kind": 5,
"importPath": "back.api.settings",
"description": "back.api.settings",
"peekOfCode": "WSGI_APPLICATION = 'api.wsgi.application'\n# Database\n# https://docs.djangoproject.com/en/5.0/ref/settings/#databases\nDATABASES = {\n \"default\": {\n \"ENGINE\": \"django.db.backends.postgresql\",\n \"OPTIONS\": {\n # in ~/.pg_service.conf\n 'service': 'to_inventory_db',\n \"passfile\": \".pgpass\",",
"peekOfCode": "WSGI_APPLICATION = \"api.wsgi.application\"\n# Database\n# https://docs.djangoproject.com/en/5.0/ref/settings/#databases\nDATABASES = {\n \"default\": {\n \"ENGINE\": \"django.db.backends.postgresql\",\n \"NAME\": os.environ.get(\"DB_NAME\"),\n \"USER\": os.environ.get(\"DB_USER\"),\n \"PASSWORD\": os.environ.get(\"DB_PASSWORD\"),\n \"HOST\": os.environ.get(\"DB_HOST\"),",
"detail": "back.api.settings",
"documentation": {}
},
@ -1715,7 +1749,7 @@
"kind": 5,
"importPath": "back.api.settings",
"description": "back.api.settings",
"peekOfCode": "DATABASES = {\n \"default\": {\n \"ENGINE\": \"django.db.backends.postgresql\",\n \"OPTIONS\": {\n # in ~/.pg_service.conf\n 'service': 'to_inventory_db',\n \"passfile\": \".pgpass\",\n },\n }\n}",
"peekOfCode": "DATABASES = {\n \"default\": {\n \"ENGINE\": \"django.db.backends.postgresql\",\n \"NAME\": os.environ.get(\"DB_NAME\"),\n \"USER\": os.environ.get(\"DB_USER\"),\n \"PASSWORD\": os.environ.get(\"DB_PASSWORD\"),\n \"HOST\": os.environ.get(\"DB_HOST\"),\n \"PORT\": os.environ.get(\"DB_PORT\"),\n }\n}",
"detail": "back.api.settings",
"documentation": {}
},
@ -1724,7 +1758,7 @@
"kind": 5,
"importPath": "back.api.settings",
"description": "back.api.settings",
"peekOfCode": "AUTH_PASSWORD_VALIDATORS = [\n {\n 'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',\n },\n {\n 'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',\n },\n {\n 'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',\n },",
"peekOfCode": "AUTH_PASSWORD_VALIDATORS = [\n {\n \"NAME\": \"django.contrib.auth.password_validation.UserAttributeSimilarityValidator\",\n },\n {\n \"NAME\": \"django.contrib.auth.password_validation.MinimumLengthValidator\",\n },\n {\n \"NAME\": \"django.contrib.auth.password_validation.CommonPasswordValidator\",\n },",
"detail": "back.api.settings",
"documentation": {}
},
@ -1733,7 +1767,7 @@
"kind": 5,
"importPath": "back.api.settings",
"description": "back.api.settings",
"peekOfCode": "LANGUAGE_CODE = 'en-us'\nTIME_ZONE = 'UTC'\nUSE_I18N = True\nUSE_TZ = True\n# Static files (CSS, JavaScript, Images)\n# https://docs.djangoproject.com/en/5.0/howto/static-files/\nSTATIC_URL = 'static/'\n# Default primary key field type\n# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field\nDEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'",
"peekOfCode": "LANGUAGE_CODE = \"en-us\"\nTIME_ZONE = \"UTC\"\nUSE_I18N = True\nUSE_TZ = True\n# Static files (CSS, JavaScript, Images)\n# https://docs.djangoproject.com/en/5.0/howto/static-files/\nSTATIC_URL = \"static/\"\n# Default primary key field type\n# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field\nDEFAULT_AUTO_FIELD = \"django.db.models.BigAutoField\"",
"detail": "back.api.settings",
"documentation": {}
},
@ -1742,7 +1776,7 @@
"kind": 5,
"importPath": "back.api.settings",
"description": "back.api.settings",
"peekOfCode": "TIME_ZONE = 'UTC'\nUSE_I18N = True\nUSE_TZ = True\n# Static files (CSS, JavaScript, Images)\n# https://docs.djangoproject.com/en/5.0/howto/static-files/\nSTATIC_URL = 'static/'\n# Default primary key field type\n# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field\nDEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'",
"peekOfCode": "TIME_ZONE = \"UTC\"\nUSE_I18N = True\nUSE_TZ = True\n# Static files (CSS, JavaScript, Images)\n# https://docs.djangoproject.com/en/5.0/howto/static-files/\nSTATIC_URL = \"static/\"\n# Default primary key field type\n# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field\nDEFAULT_AUTO_FIELD = \"django.db.models.BigAutoField\"",
"detail": "back.api.settings",
"documentation": {}
},
@ -1751,7 +1785,7 @@
"kind": 5,
"importPath": "back.api.settings",
"description": "back.api.settings",
"peekOfCode": "USE_I18N = True\nUSE_TZ = True\n# Static files (CSS, JavaScript, Images)\n# https://docs.djangoproject.com/en/5.0/howto/static-files/\nSTATIC_URL = 'static/'\n# Default primary key field type\n# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field\nDEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'",
"peekOfCode": "USE_I18N = True\nUSE_TZ = True\n# Static files (CSS, JavaScript, Images)\n# https://docs.djangoproject.com/en/5.0/howto/static-files/\nSTATIC_URL = \"static/\"\n# Default primary key field type\n# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field\nDEFAULT_AUTO_FIELD = \"django.db.models.BigAutoField\"",
"detail": "back.api.settings",
"documentation": {}
},
@ -1760,7 +1794,7 @@
"kind": 5,
"importPath": "back.api.settings",
"description": "back.api.settings",
"peekOfCode": "USE_TZ = True\n# Static files (CSS, JavaScript, Images)\n# https://docs.djangoproject.com/en/5.0/howto/static-files/\nSTATIC_URL = 'static/'\n# Default primary key field type\n# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field\nDEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'",
"peekOfCode": "USE_TZ = True\n# Static files (CSS, JavaScript, Images)\n# https://docs.djangoproject.com/en/5.0/howto/static-files/\nSTATIC_URL = \"static/\"\n# Default primary key field type\n# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field\nDEFAULT_AUTO_FIELD = \"django.db.models.BigAutoField\"",
"detail": "back.api.settings",
"documentation": {}
},
@ -1769,7 +1803,7 @@
"kind": 5,
"importPath": "back.api.settings",
"description": "back.api.settings",
"peekOfCode": "STATIC_URL = 'static/'\n# Default primary key field type\n# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field\nDEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'",
"peekOfCode": "STATIC_URL = \"static/\"\n# Default primary key field type\n# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field\nDEFAULT_AUTO_FIELD = \"django.db.models.BigAutoField\"",
"detail": "back.api.settings",
"documentation": {}
},
@ -1778,7 +1812,7 @@
"kind": 5,
"importPath": "back.api.settings",
"description": "back.api.settings",
"peekOfCode": "DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'",
"peekOfCode": "DEFAULT_AUTO_FIELD = \"django.db.models.BigAutoField\"",
"detail": "back.api.settings",
"documentation": {}
},
@ -1809,6 +1843,15 @@
"detail": "back.api.wsgi",
"documentation": {}
},
{
"label": "Migration",
"kind": 6,
"importPath": "back.inventory.migrations.0001_initial",
"description": "back.inventory.migrations.0001_initial",
"peekOfCode": "class Migration(migrations.Migration):\n initial = True\n dependencies = [\n ]\n operations = [\n migrations.CreateModel(\n name='Partner',\n fields=[\n ('id', models.AutoField(primary_key=True, serialize=False)),\n ],",
"detail": "back.inventory.migrations.0001_initial",
"documentation": {}
},
{
"label": "InventoryConfig",
"kind": 6,
@ -1841,7 +1884,16 @@
"kind": 6,
"importPath": "back.inventory.serializers",
"description": "back.inventory.serializers",
"peekOfCode": "class PartnerSerializer(serializers.ModelSerializer):\n class Meta:\n model = Partner\n fields = [\"id\"]",
"peekOfCode": "class PartnerSerializer(serializers.ModelSerializer):\n class Meta:\n model = Partner\n fields = [\"id\"]\nclass ElementSerializer(serializers.ModelSerializer):\n class Meta:\n model = Element\n fields = [\"id\", \"external_id\", \"type\", \"photo\", \"additional_text\", \"partner\"]",
"detail": "back.inventory.serializers",
"documentation": {}
},
{
"label": "ElementSerializer",
"kind": 6,
"importPath": "back.inventory.serializers",
"description": "back.inventory.serializers",
"peekOfCode": "class ElementSerializer(serializers.ModelSerializer):\n class Meta:\n model = Element\n fields = [\"id\", \"external_id\", \"type\", \"photo\", \"additional_text\", \"partner\"]",
"detail": "back.inventory.serializers",
"documentation": {}
},

3
back/.gitignore vendored
View File

@ -88,4 +88,5 @@ local_settings.py
.env
db.sqlite3
.pgpass
.pgpass
/*/migrations/0*

View File

@ -11,7 +11,10 @@ https://docs.djangoproject.com/en/5.0/ref/settings/
"""
from pathlib import Path
import os
import dotenv
dotenv.load_dotenv(os.path.join(os.path.dirname(os.path.dirname(__file__)), '.env'))
# Build paths inside the project like this: BASE_DIR / 'subdir'.
BASE_DIR = Path(__file__).resolve().parent.parent
@ -20,7 +23,7 @@ BASE_DIR = Path(__file__).resolve().parent.parent
# See https://docs.djangoproject.com/en/5.0/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'django-insecure-ruo!wst&sb8(f9)j5u4rda-w!673lj_-c0a%gx_t@)ff*q*2ze'
SECRET_KEY = "django-insecure-ruo!wst&sb8(f9)j5u4rda-w!673lj_-c0a%gx_t@)ff*q*2ze"
# SECURITY WARNING: don't run with debug turned on in production!
DEBUG = True
@ -31,45 +34,45 @@ ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'inventory',
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework',
"inventory",
"django.contrib.admin",
"django.contrib.auth",
"django.contrib.contenttypes",
"django.contrib.sessions",
"django.contrib.messages",
"django.contrib.staticfiles",
"rest_framework",
]
MIDDLEWARE = [
'django.middleware.security.SecurityMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
"django.middleware.security.SecurityMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
"django.middleware.csrf.CsrfViewMiddleware",
"django.contrib.auth.middleware.AuthenticationMiddleware",
"django.contrib.messages.middleware.MessageMiddleware",
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]
ROOT_URLCONF = 'api.urls'
ROOT_URLCONF = "api.urls"
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
"BACKEND": "django.template.backends.django.DjangoTemplates",
"DIRS": [],
"APP_DIRS": True,
"OPTIONS": {
"context_processors": [
"django.template.context_processors.debug",
"django.template.context_processors.request",
"django.contrib.auth.context_processors.auth",
"django.contrib.messages.context_processors.messages",
],
},
},
]
WSGI_APPLICATION = 'api.wsgi.application'
WSGI_APPLICATION = "api.wsgi.application"
# Database
@ -78,11 +81,11 @@ WSGI_APPLICATION = 'api.wsgi.application'
DATABASES = {
"default": {
"ENGINE": "django.db.backends.postgresql",
"OPTIONS": {
# in ~/.pg_service.conf
'service': 'to_inventory_db',
"passfile": ".pgpass",
},
"NAME": os.environ.get("DB_NAME"),
"USER": os.environ.get("DB_USER"),
"PASSWORD": os.environ.get("DB_PASSWORD"),
"HOST": os.environ.get("DB_HOST"),
"PORT": os.environ.get("DB_PORT"),
}
}
@ -92,16 +95,16 @@ DATABASES = {
AUTH_PASSWORD_VALIDATORS = [
{
'NAME': 'django.contrib.auth.password_validation.UserAttributeSimilarityValidator',
"NAME": "django.contrib.auth.password_validation.UserAttributeSimilarityValidator",
},
{
'NAME': 'django.contrib.auth.password_validation.MinimumLengthValidator',
"NAME": "django.contrib.auth.password_validation.MinimumLengthValidator",
},
{
'NAME': 'django.contrib.auth.password_validation.CommonPasswordValidator',
"NAME": "django.contrib.auth.password_validation.CommonPasswordValidator",
},
{
'NAME': 'django.contrib.auth.password_validation.NumericPasswordValidator',
"NAME": "django.contrib.auth.password_validation.NumericPasswordValidator",
},
]
@ -109,9 +112,9 @@ AUTH_PASSWORD_VALIDATORS = [
# Internationalization
# https://docs.djangoproject.com/en/5.0/topics/i18n/
LANGUAGE_CODE = 'en-us'
LANGUAGE_CODE = "en-us"
TIME_ZONE = 'UTC'
TIME_ZONE = "UTC"
USE_I18N = True
@ -121,9 +124,9 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/5.0/howto/static-files/
STATIC_URL = 'static/'
STATIC_URL = "static/"
# Default primary key field type
# https://docs.djangoproject.com/en/5.0/ref/settings/#default-auto-field
DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"

View File

@ -1,8 +1,13 @@
from rest_framework import serializers
from .models import Partner
from .models import Partner, Element
class PartnerSerializer(serializers.ModelSerializer):
class Meta:
model = Partner
fields = ["id"]
class ElementSerializer(serializers.ModelSerializer):
class Meta:
model = Element
fields = ["id", "external_id", "type", "photo", "additional_text", "partner"]

16
poetry.lock generated
View File

@ -238,6 +238,20 @@ files = [
{file = "psycopg2-2.9.9.tar.gz", hash = "sha256:d1454bde93fb1e224166811694d600e746430c006fbb031ea06ecc2ea41bf156"},
]
[[package]]
name = "python-dotenv"
version = "1.0.1"
description = "Read key-value pairs from a .env file and set them as environment variables"
optional = false
python-versions = ">=3.8"
files = [
{file = "python-dotenv-1.0.1.tar.gz", hash = "sha256:e324ee90a023d808f1959c46bcbc04446a10ced277783dc6ee09987c37ec10ca"},
{file = "python_dotenv-1.0.1-py3-none-any.whl", hash = "sha256:f7b63ef50f1b690dddf550d03497b66d609393b40b564ed0d674909a68ebf16a"},
]
[package.extras]
cli = ["click (>=5.0)"]
[[package]]
name = "sqlparse"
version = "0.5.0"
@ -306,4 +320,4 @@ files = [
[metadata]
lock-version = "2.0"
python-versions = "^3.10"
content-hash = "56611ac7f25ac6f0383c0835afb3c695fedd9adf27499fe97ebee3c245c35d06"
content-hash = "c6bf0723d9f799bdbe4174c98f18b7177aae7054fd556c58905dc3b55ef98c99"

View File

@ -14,6 +14,7 @@ psycopg2 = "^2.9.9"
markdown = "^3.6"
django-filter = "^24.2"
pillow = "^10.3.0"
python-dotenv = "^1.0.1"
[tool.poetry.group.dev.dependencies]
taskipy = "^1.12.2"