multiple language
This commit is contained in:
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -10,7 +10,7 @@ class ProductFeatureInline(admin.TabularInline):
|
|||||||
# ========== PRODUCT ADMIN ==========
|
# ========== PRODUCT ADMIN ==========
|
||||||
@admin.register(Product)
|
@admin.register(Product)
|
||||||
class ProductAdmin(admin.ModelAdmin):
|
class ProductAdmin(admin.ModelAdmin):
|
||||||
list_display = ('name',)
|
list_display = ('name_uz', 'name_ru', 'image')
|
||||||
inlines = [ProductFeatureInline]
|
inlines = [ProductFeatureInline]
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,52 @@
|
|||||||
|
# Generated by Django 5.2.8 on 2025-12-05 07:01
|
||||||
|
|
||||||
|
from django.db import migrations, models
|
||||||
|
|
||||||
|
|
||||||
|
class Migration(migrations.Migration):
|
||||||
|
|
||||||
|
dependencies = [
|
||||||
|
('content', '0001_initial'),
|
||||||
|
]
|
||||||
|
|
||||||
|
operations = [
|
||||||
|
migrations.RenameField(
|
||||||
|
model_name='product',
|
||||||
|
old_name='name',
|
||||||
|
new_name='name_ru',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='productfeature',
|
||||||
|
name='key',
|
||||||
|
),
|
||||||
|
migrations.RemoveField(
|
||||||
|
model_name='productfeature',
|
||||||
|
name='value',
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='product',
|
||||||
|
name='name_uz',
|
||||||
|
field=models.CharField(default='Nomalum', max_length=255),
|
||||||
|
preserve_default=False,
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='productfeature',
|
||||||
|
name='key_ru',
|
||||||
|
field=models.CharField(default='salom', max_length=255),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='productfeature',
|
||||||
|
name='key_uz',
|
||||||
|
field=models.CharField(default='salom', max_length=255),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='productfeature',
|
||||||
|
name='value_ru',
|
||||||
|
field=models.CharField(default='salom', max_length=255),
|
||||||
|
),
|
||||||
|
migrations.AddField(
|
||||||
|
model_name='productfeature',
|
||||||
|
name='value_uz',
|
||||||
|
field=models.CharField(default='salom', max_length=255),
|
||||||
|
),
|
||||||
|
]
|
||||||
Binary file not shown.
@@ -2,21 +2,26 @@ from django.db import models
|
|||||||
|
|
||||||
# ======== PRODUCT MODEL ========
|
# ======== PRODUCT MODEL ========
|
||||||
class Product(models.Model):
|
class Product(models.Model):
|
||||||
name = models.CharField(max_length=255)
|
name_uz = models.CharField(max_length=255)
|
||||||
|
name_ru = models.CharField(max_length=255)
|
||||||
image = models.ImageField(upload_to='products/')
|
image = models.ImageField(upload_to='products/')
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return self.name
|
return self.name_uz
|
||||||
|
|
||||||
|
|
||||||
# ======== PRODUCT FEATURES (KEY-VALUE) ========
|
# ======== PRODUCT FEATURES (KEY-VALUE) ========
|
||||||
class ProductFeature(models.Model):
|
class ProductFeature(models.Model):
|
||||||
product = models.ForeignKey(Product, related_name='features', on_delete=models.CASCADE)
|
product = models.ForeignKey(Product, related_name='features', on_delete=models.CASCADE)
|
||||||
key = models.CharField(max_length=255)
|
|
||||||
value = models.CharField(max_length=255)
|
key_uz = models.CharField(max_length=255,default='salom')
|
||||||
|
key_ru = models.CharField(max_length=255 , default='salom')
|
||||||
|
|
||||||
|
value_uz = models.CharField(max_length=255, default='salom')
|
||||||
|
value_ru = models.CharField(max_length=255, default='salom')
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f"{self.product.name} - {self.key}"
|
return f"{self.product.name_uz} - {self.key_uz}"
|
||||||
|
|
||||||
|
|
||||||
# ======== CONTACT FORM DATA ========
|
# ======== CONTACT FORM DATA ========
|
||||||
|
|||||||
BIN
db.sqlite3
BIN
db.sqlite3
Binary file not shown.
Binary file not shown.
@@ -1,5 +1,7 @@
|
|||||||
from django.urls import path, include
|
from django.urls import path, include
|
||||||
|
from django.contrib import admin
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
path('admin/', admin.site.urls),
|
||||||
path('api/', include('content.urls')),
|
path('api/', include('content.urls')),
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user