Skip to content
Discussion options

You must be logged in to vote

Your variables to filter on need to be in datetime format, and then you can filter on time__lte and time__gte.

Here's a quick example (filtered between 1/1/2020-present):

from datetime import datetime, timezone
from extras.models import ObjectChange

startDateTime = datetime(2020,1,1,0,0,0,tzinfo=datetime.utcnow().astimezone().tzinfo)
endDateTime = datetime.now(timezone.utc).astimezone()

Records = ObjectChange.objects.filter(time__gte=startDateTime,time__lte=endDateTime)

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ziggekatten
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants