I'd like to use peewee to create records from a csv. It looks like the syntax requires keyword args:
user = User.create(username='admin', password='test')
If the rows in the csv look like (admin, test)
, it would be convenient to know the field names ('username', 'password')
to form a dict to pass in (it looks like I can't pass in a list of the values for the model to infer what the corresponding fields are).
Is there a property of User
that has a list of the field names in the order that they are defined?
Thanks
Looks like it's User._meta.get_field_names()
I just saw someone else mention it in another question.