What are the competition issues:
When multiple users operate on a field at the same time, there is no expected return.
F () function:
When multiple users operate on a field at the same time, there is no expected return.
F () function:
from django.db.models import F
def vote(request, choice_id):
selected_choice = question.choice_set.get(pk=request.POST['choice'])
selected_choice.votes = F('votes') + 1
selected_choice.save()
Read More:
- How to solve the problem of error reporting in the introduction of Python Django no module name ‘Django. Utils. Six’
- Solve the problem of error loading MySQL DB module. Encountered during Django project
- How to Solve apt get update problem: usr/lib/apt/methods/HTTPS could not be found_PUBKEY 7EA0A9C3F273FCD8
- django.db.utils.OperationalError: no such table: django_admin_log
- [math processing error] problem solving (the difference between F5 refresh page and Ctrl / shift + F5 refresh page)
- django.core.exceptions . improveconfigured: error loading MySQL DB module. Django configuring MySQL database
- To solve the problem of failed to load: data in HTML5 game running rmmv locally/ actors.json problem
- Mac — Open keyboard F1 – F12 function key
- Zookeeper connection timeout problem, and refused to connect to solve the problem
- Docker command error during connect: get http://2F2F.2Fpipe2Fdocker_ engine/v1.36/containers/json: open//.
- Practice based on how to tango with Django 1.7 (1)
- Importerror of Django error: no module named**
- Stm32f107 kernel file — stm32f10x. H
- Event resolution of component {b3118b2-1f49-48e5-b6f5-bc21caec56fb}
- Four ways to get Django parameters in request
- numpy.core.umath How to solve the problem of failed to import
- How to solve problems like curl: (7) failed to connect to raw.githubusercontent.com Port 443: problem with connection used
- Solve the syntax error of Python PIP installation sys.stderr.write (f“ERROR: {exc}“)
- django.db.utils .IntegrityError: NOT NULL constraint failed: blog_ blog.author_ ID error resolution
- C language — to solve the problem of program flashback when programming (in VS)