T
T
TheTrace2019-05-30 21:04:52
Django
TheTrace, 2019-05-30 21:04:52

How to add this to Django?

Increase item by pressing +/-
5cf01b40eee76203518466.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
F
FulTupFul, 2019-05-30
@TheTrace

Create a quantity field in the order model:

class Order(models.Model):
    count = models.PositiveIntegerField(validators=[MinValueValidator(1)], default=1)

In html, pull up jquery and beautifully increment the order when you click on the plus.
There are plenty of templates on google for this.
https://www.jqueryscript.net/form/Number-Input-Spi...
Send it all in a POST request to the server and process the order.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question