fixes
This commit is contained in:
parent
f2dc359c8e
commit
8b29bbab64
@ -83,7 +83,7 @@ class Cart(models.Model):
|
||||
|
||||
class CartProduct(models.Model):
|
||||
product = models.ForeignKey(Product, on_delete=models.RESTRICT)
|
||||
cart = models.ForeignKey('Cart', on_delete=models.RESTRICT)
|
||||
cart = models.ForeignKey('Cart', on_delete=models.CASCADE)
|
||||
class Meta:
|
||||
unique_together = ('product', 'cart')
|
||||
quantity = models.IntegerField()
|
||||
|
@ -427,11 +427,13 @@ def cart_buy(request):
|
||||
result = parse_qs(result.text)
|
||||
|
||||
if result['code'][0] != '0':
|
||||
racer.delete()
|
||||
for ip in InvoiceProduct.objects.filter(invoice=invoice):
|
||||
ip.delete()
|
||||
invoice.delete()
|
||||
return HttpResponse('{"reason":"Chyba na straně platební brány: ' + result['message'][0] + ', zkuste prosím nákup později."}', status=400, content_type='application/json')
|
||||
|
||||
invoice.trans_id = result['transId'][0]
|
||||
cart.delete()
|
||||
invoice.save()
|
||||
|
||||
return HttpResponse('{"success":"", "redirect":"' + result['redirect'][0] + '"}', content_type='application/json')
|
||||
|
@ -338,7 +338,7 @@ class Main extends Component {
|
||||
<td>Celkem</td>
|
||||
<td></td>
|
||||
<td>{this.calculateTotalPrice()} Kč</td>
|
||||
<td><form action='/api/cart/buy' onSubmit={(e) => this.onSubmit(e)}><button type="submit">Koupit</button></form></td>
|
||||
<td><form id="form" action='/api/cart/buy' onSubmit={(e) => this.onSubmit(e)}><button class="btn btn-primary" type="submit">Koupit</button></form></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
Loading…
x
Reference in New Issue
Block a user