coleifer / peewee

a small, expressive orm -- supports postgresql, mysql, sqlite and cockroachdb
http://docs.peewee-orm.com/
MIT License
11.08k stars 1.37k forks source link

Fields are missing in model #2870

Closed BulatTim1 closed 5 months ago

BulatTim1 commented 5 months ago

I made a model like in quickstart, but for some reason I can't get the fields from the model... I tried different versions of Python, different databases, and tried installing the version from Github. But I keep getting this error.

Model (models.py):

class User(Model):
    firstName: CharField()
    lastName: CharField()
    email: CharField(unique=True) 
    password: CharField()
    id: AutoField()
    class Meta:
        database = db

Line where I getting error (auth.py):

user = User.get(User.email == model.email)

In databases only one field - id:

  1. sqlite: image
  2. postgresql: image
  3. in code: image

This is my first time using peewee, what’s wrong? Or do I need manually create all tables, because peewee can’t do that? Win11 23H2, Python 3.11.1 and 3.9.9.

coleifer commented 5 months ago

You are using colon when you should use equals for the fields.

BulatTim1 commented 5 months ago

Thank you! Sorry to bother you with such a stupid mistake... Have a nice day ☺️