add: cors header and ssl proxy for swagger
This commit is contained in:
@@ -128,3 +128,17 @@ LANGUAGES = (
|
|||||||
('ru', 'Russian'),
|
('ru', 'Russian'),
|
||||||
)
|
)
|
||||||
MODELTRANSLATION_LANGUAGES = ('uz', 'en', 'ru')
|
MODELTRANSLATION_LANGUAGES = ('uz', 'en', 'ru')
|
||||||
|
|
||||||
|
SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', env.str("SWAGGER_PROTOCOL", 'https'))
|
||||||
|
|
||||||
|
CORS_ALLOWED_ORIGINS = [
|
||||||
|
"http://localhost:3000",
|
||||||
|
"http://127.0.0.1:3000",
|
||||||
|
'https://uyqur.vercel.app'
|
||||||
|
]
|
||||||
|
|
||||||
|
CSRF_TRUSTED_ORIGINS = [
|
||||||
|
"https://avtocargo.felixits.uz",
|
||||||
|
'http://localhost:8002',
|
||||||
|
'http://127.0.0.1:8002',
|
||||||
|
]
|
||||||
@@ -1,9 +1,10 @@
|
|||||||
from django.contrib import admin
|
from django.contrib import admin
|
||||||
|
from modeltranslation.admin import TranslationAdmin
|
||||||
|
|
||||||
from core.apps.orders import models
|
from core.apps.orders import models
|
||||||
|
|
||||||
|
|
||||||
@admin.register(models.Order)
|
@admin.register(models.Order)
|
||||||
class OrderAdmin(admin.ModelAdmin):
|
class OrderAdmin(TranslationAdmin):
|
||||||
list_display = ['name', 'user', 'total_price', 'status', 'is_paid']
|
list_display = ['name', 'user', 'total_price', 'status', 'is_paid']
|
||||||
list_filter = ['is_paid', 'user', 'status']
|
list_filter = ['is_paid', 'user', 'status']
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
# Generated by Django 5.2 on 2025-08-26 14:40
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('orders', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='order',
|
||||||
|
name='location_en',
|
||||||
|
field=models.CharField(max_length=200, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='order',
|
||||||
|
name='location_ru',
|
||||||
|
field=models.CharField(max_length=200, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='order',
|
||||||
|
name='location_uz',
|
||||||
|
field=models.CharField(max_length=200, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='order',
|
||||||
|
name='name_en',
|
||||||
|
field=models.CharField(max_length=200, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='order',
|
||||||
|
name='name_ru',
|
||||||
|
field=models.CharField(max_length=200, null=True),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='order',
|
||||||
|
name='name_uz',
|
||||||
|
field=models.CharField(max_length=200, null=True),
|
||||||
|
),
|
||||||
|
]
|
||||||
10
core/apps/orders/translation.py
Normal file
10
core/apps/orders/translation.py
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
from modeltranslation import translator
|
||||||
|
|
||||||
|
from core.apps.orders.models import Order
|
||||||
|
|
||||||
|
|
||||||
|
@translator.register(Order)
|
||||||
|
class OrderTranslation(translator.TranslationOptions):
|
||||||
|
fields = [
|
||||||
|
'name', 'location'
|
||||||
|
]
|
||||||
@@ -8,6 +8,7 @@ click-plugins==1.1.1.2
|
|||||||
click-repl==0.3.0
|
click-repl==0.3.0
|
||||||
Django==5.2
|
Django==5.2
|
||||||
django-cacheops==7.2
|
django-cacheops==7.2
|
||||||
|
django-cors-headers==4.7.0
|
||||||
django-environ==0.12.0
|
django-environ==0.12.0
|
||||||
django-jazzmin==3.0.1
|
django-jazzmin==3.0.1
|
||||||
django-modeltranslation==0.19.16
|
django-modeltranslation==0.19.16
|
||||||
@@ -21,6 +22,7 @@ h11==0.16.0
|
|||||||
inflection==0.5.1
|
inflection==0.5.1
|
||||||
kombu==5.5.4
|
kombu==5.5.4
|
||||||
packaging==25.0
|
packaging==25.0
|
||||||
|
pillow==11.3.0
|
||||||
prompt_toolkit==3.0.51
|
prompt_toolkit==3.0.51
|
||||||
psycopg2-binary==2.9.10
|
psycopg2-binary==2.9.10
|
||||||
PyJWT==2.10.1
|
PyJWT==2.10.1
|
||||||
@@ -35,4 +37,3 @@ uritemplate==4.2.0
|
|||||||
uvicorn==0.35.0
|
uvicorn==0.35.0
|
||||||
vine==5.1.0
|
vine==5.1.0
|
||||||
wcwidth==0.2.13
|
wcwidth==0.2.13
|
||||||
pillow
|
|
||||||
Reference in New Issue
Block a user