Get ordered field names from peewee Model

I would like to use peewee to create records from csv. The syntax seems to require the args keywords:

user = User.create(username='admin', password='test') 

If the lines in csv look like (admin, test) , it would be convenient to know the field names ('username', 'password') in order to form a dict for transmission (it seems that I cannot pass a list of values ​​for the model to determine what are the corresponding fields).

Is there a User property that has a list of field names in the order in which they are defined?

thanks

+7
source share
1 answer

Looks like User._meta.get_field_names()

I just noticed that someone else mentioned this in another question .

+11
source

All Articles