I'm a noob django user, and I'm having some trouble with the Model.objects.all method. I've got a user model: (I know keeping passwords in plaintext is bad practice, but this is just supposed to be a toy example)
class UsersModel(models.Model):
password = models.CharField(max_length=MAX_PASSWORD_LENGTH)
user = models.CharField(max_length=MAX_USERNAME_LENGTH, primary_key=True)
count = models.IntegerField()
And I've got a test method that's supposed to drop all the entries in the user table:
def function(self):
UsersModel.objects.all().delete()
For some reason, calling UsersModel.objects.all() raises the error
DatabaseError: column "cs169proj1_usersmodel.user" must appear in the GROUP BY clause or
be used in an aggregate function
LINE 1: SELECT "cs169proj1_usersmodel"."user", "cs169proj1_usersmode...
From Googling, I've found that this particular error in SQL only comes up on Postgresql (which I'm using). Anyone know how to get around/fix this?