Lowlights 2024-03-11 16:56:15 +06:00
parent d5bc486ebf
commit 2a1563957e
19 changed files with 25 additions and 11 deletions

Binary file not shown.

View File

@ -0,0 +1,18 @@
# Generated by Django 4.2.7 on 2024-03-11 07:54
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('main', '0001_initial'),
]
operations = [
migrations.AddField(
model_name='product',
name='link',
field=models.URLField(blank=True, max_length=1024, null=True),
),
]

View File

@ -20,6 +20,8 @@ class Category(models.Model):
args=[self.slug])
class Product(models.Model):
category = models.ForeignKey(Category,
related_name='products',
on_delete=models.CASCADE)
@ -33,7 +35,7 @@ class Product(models.Model):
available = models.BooleanField(default=True)
created = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
link = models.URLField(max_length=1024, blank=True, null=True)
class Meta:
ordering = ['name']
@ -47,7 +49,4 @@ class Product(models.Model):
return self.name
def get_absolute_url(self):
return reverse('main:product_detail',
args=[self.id, self.slug])
return self.link

View File

@ -89,7 +89,7 @@
{# </a>#}
{# <p class="card-text text-truncate" style="color:wheat">{{ product.description }}</p>#}
{# <div class="d-flex justify-content-between">#}
{# <p><strong>{{ product.price }}₸</strong></p>#}
{#
{# </div>#}
{# </div>#}
{# </div>#}

View File

@ -99,7 +99,6 @@
<p class="price" style="font-size: 35px; font-weight: bold; color: rgba(255,128,0,0.73);">{{ product.price }}₸</p>
<a href="{% url 'product_list' %}" class="btn btn-primary">Вернуться на главную</a>
</div>
</div>
</div>

View File

@ -37,9 +37,7 @@
<p class="card-title">{{ product.name }}</p>
</a>
<p class="card-text text-truncate" style="color: wheat">{{ product.description }}</p>
<div class="d-flex justify-content-between">
<p><strong>{{ product.price }}₸</strong></p>
</div>
</div>
</div>
</div>

View File

@ -40,5 +40,5 @@ def product_detail(request, id, slug):
slug=slug,
available=True)
return render(request,
'main/product/detail.html',
product.link,
{'product': product})