master
parent
d5bc486ebf
commit
2a1563957e
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
db.sqlite3
BIN
db.sqlite3
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -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),
|
||||
),
|
||||
]
|
Binary file not shown.
Binary file not shown.
|
@ -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
|
|
@ -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>#}
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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})
|
Loading…
Reference in New Issue