For some reason I'm in the state of using peewee and this happened:
I've got a big app already and it works everywhere else, I have some Models like this:
class SomeModel(Model):
day = DateField();
related_entity_id = IntegerNotNullField();
info = CharField();
as you can see some custom fields but they should work, I created the sql like this:
CREATE TABLE IF NOT EXISTS "somemodel" (
"id" INTEGER NOT NULL,
"day" DATETIME,
"related_entity_id" INTEGER NOT NULL,
"info" VARCHAR(255),
PRIMARY KEY("id")
);
and when I try to create an Instance of SomeModel like this
some_model_instance = SomeModel(
<a date from from api put request>
1 # id from the same request
"some text info" # from the same request
);
I get some_model_instance == None
Does somebody know why?
EDIT:
So why ever, my app works with this behavior, and it saves the data but printing the instance still returns None
and I don't know why
You need to use keyword arguments. You cannot use positional arguments when instantiating a model. This should work:
some_model_instance = SomeModel(
day=some_datetime,
related_entity_id=1,
info='some text')