Thursday, May 31, 2018

calculate the followers difference/grow by day

 
Hey guys,

I´m using SQLite and trying to calculate the followers difference by day

This is my model:

class Statistics(models.Model):
    followers = models.IntegerField()
    last_update = models.DateTimeField(auto_now_add=True)

This are my database rows:

"6" "50" "2018-05-29 00:25:48.276102"
"1" "100" "2018-05-29 00:26:48.276102"
"3" "200" "2018-05-30 00:27:04.178444"
"5" "250" "2018-05-30 00:30:04.178444"
"4" "300" "2018-05-31 00:27:04.178444"

And the result I´m tryting to achieve is:

followers | last_update
150          2018-05-30
50           2018-05-31

# I´m new to Django and thinking about use a Manager, but don't know if´s doable using a Manager
# Does anyone has a suggestion ?

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/3196a628-a53f-41ac-bcbf-6cc8b8a66016%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment