Skip to content

NotImplementedError: Don't know how to literal-quote value datetime #209

Answered by collerek
NikitaAleshnikov asked this question in Q&A
Discussion options

You must be logged in to vote

Best to convert to str, something like:
Contest.objects.filter(Contest.chat.id == channel.id, Contest.date_end >= date_now.strftime("%Y-%m-%d %H:%M:%S")).all()

Note also that if you declare your field like this it's gonna set a constant value for all instances:

date_start: datetime = ormar.DateTime(default=datetime.utcnow()) # <= constant - executed once on start-up
date_start: datetime = ormar.DateTime(default=datetime.utcnow) # <= pointer to callable (no parenthesis) - called on each initialization

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@NikitaAleshnikov
Comment options

Answer selected by NikitaAleshnikov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants