Posts

Showing posts from April 18, 2019

Saving multiple column values using a for loop in Django

Image
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box; } 1 In my database (SQLite), I would like to update every column in a given row by using a for loop through a dictionary. I've searched both SO and Django documentation, but have been unable to find any information regarding updating multiple columns via a for loop. I suspect that there's an easy solution to my problem, but I've run out of keywords to google. Here's a very simple example that boils the problem down to its core: models.py from django.db import models class author_ratings(models.Model): name = models.TextField() book_one = models.IntegerField() book_two = models.IntegerField() ...