Skip to content

Instantly share code, notes, and snippets.

@nebiyuelias1
Created November 8, 2021 04:49
Show Gist options
  • Save nebiyuelias1/c61b453d4c14b39df2849c141821c96d to your computer and use it in GitHub Desktop.
Save nebiyuelias1/c61b453d4c14b39df2849c141821c96d to your computer and use it in GitHub Desktop.
Trending factor calculation
@MannyIOI
Copy link

MannyIOI commented Nov 8, 2021

how do you import the Epoch field

@nebiyuelias1
Copy link
Author

Oh yes, that's a custom-made query expression.

@nebiyuelias1
Copy link
Author

from django.db.models import Func, IntegerField

class Epoch(Func):
    template = 'EXTRACT(epoch FROM %(expressions)s)::INTEGER'
    output_field = IntegerField()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment