Привет, ребята, пожалуйста, я хочу получить тариф, условия и название шаблона для каждой подарочной открытки по моему шаблону [закрыто]
#МОДЕЛЬ ПОДАРОЧНОЙ КАРТЫ
class Giftcard(models.Model):
name = models.CharField(max_length=100, blank=False)
card_image = models.ImageField(upload_to='Giftcard', blank=False)
date = models.DateTimeField(auto_now_add=True)
publish = models.BooleanField(default=False)
#КАРТОЧНАЯ МОДЕЛЬ КАТИГОРИИ
class CardCategory(models.Model):
title = models.CharField(max_length=150, blank=False)
rate = models.IntegerField(blank=True)
term = models.TextField(blank=False)
cardName = models.ForeignKey(Giftcard, on_delete=models.CASCADE)
#GIFTCARD VIEW. @login_required(login_url='/Authentication/login') def giftcard(request, cardName): giftcards = Giftcard.objects.all().filter(publish=True) card_category = CardCategory.objects.filter(cardName=cardName) print(card_category)
context = {
'giftcards': giftcards,
'card_category': card_category,
}
return render(request, 'dashboard/giftcard.html', context)
# ВОТ МОЙ ШАБЛОН
<div class="container-fluid bg-light gift__card-modal shadow-lg">
<div class="pop p-5">
<div class="row d-flex align-items-center justify-content-between">
<div class="col-lg-5 col-12 p-0 m-0">
<img class="img-fluid" src="{{ giftcard.card_image.url }}">
<p class="text-muted">Select the card category and the amount.</p>
</div>
<div class="col-lg-6 col-sm-12 card-details">
<form class="card-form">
<div class="form-group py-2">
<label for="card-category">Card category</label>
<input list="category" class="form-control" name="category"
id="card_category"
placeholder="Select card category">
<datalist id="category">
{% for card_category in card_category %}
<option value="{{ card_category.title }}">{{ card_category.title }}
</option>
{% endfor %}
</datalist>
</div>
<div class="form-group py-2">
<label for="Amount">Amount</label>
<div class="d-flex align-items-center amount">
<input type="text" class="form-control" id="amount"
placeholder="Please enter amount">
<span class="">#100,000</span>
</div>
</div>
<div class="form-group py-3">
<label for="rate">Current rate - 250</label>
</div>
<div class="border-none pt-2 pl-3 d-flex justify-content-end">
<button type="button" class="btn process-card-btn">Proceed</button>
</div>
</form>
</div>
</div>
</div>
</div>