August 2016
Beginner to intermediate
717 pages
15h 24m
English
There are two mechanisms to update data in Django. Indeed, there is a mechanism to update one record and another mechanism to update multiple records.
Updating the existing data is very simple. We have already seen what it takes to be able to do so. The following is an example where it modifies the first task:
from TasksManager.models import Project, Task from django.shortcuts import render def page(request): new_project = Project(title = "Other project", description="Try to update models.", client_name="People") new_project.save() task = Task.objects.get(id = 1) task.description = "New description" task.project = new_project task.save() return render(request, 'en/public/index.html', {'action' ...Read now
Unlock full access