You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello, thanks for the good library, is it possible to allow optional fields in Model when using Model.objects.create() (just don't pass fields to INSERT INTO)? Can work on this feature.
My use case is this: I have a table that automatically updates/sets some fields (ex. dt_created, dt_changed) and I would like to not pass datetime.now every time I need to insert a new row. Table SQL is below (PostgreSQL):
CREATETABLEtokens (
id bigserialNOT NULL,
user_id textNOT NULLCHECK(trim(user_id) !=''),
scope textNOT NULL,
access textNOT NULLCHECK(trim(access) !=''),
refresh textNOT NULLCHECK(trim(refresh) !=''),
expires_at bigintNOT NULL,
dt_created timestamp with time zoneNOT NULL DEFAULT NOW(),
dt_changed timestamp with time zoneNOT NULL DEFAULT NOW(),
dt_deleted timestamp with time zoneNULL,
PRIMARY KEY (id)
);
Right now I don't even add dt_* fields to model, but I would like to have access to them without the need to specify dt_created/dt_changed when calling Model.objects.create()
I saw that read_only flag was used in #64 (right now you can't provide it directly into DateTime like DateTime(read_only=True) on that branch), but maybe if it will be possible - problem will be solved.
Hello, thanks for the good library, is it possible to allow optional fields in
Model
when usingModel.objects.create()
(just don't pass fields toINSERT INTO
)? Can work on this feature.My use case is this: I have a table that automatically updates/sets some fields (ex.
dt_created
,dt_changed
) and I would like to not passdatetime.now
every time I need to insert a new row. Table SQL is below (PostgreSQL):Right now I don't even add
dt_*
fields to model, but I would like to have access to them without the need to specifydt_created
/dt_changed
when callingModel.objects.create()
Model right now:
Model I would like to use:
The text was updated successfully, but these errors were encountered: