How to load a database column into a list using Django? I have a column "name" of various names in my database, and I want to be able to load all these names (sorted by id) into a list. So that I can iterate over this list and print the names, for example:
for name in name_list: print name
I searched this quite carefully and I canβt find anything. It should be that simple, it's just the equivalent of SQL "SELECT column FROM table"
class chat_messages(models.Model): name = models.CharField(max_length=32)
python566
source share