I think you can do something like this
stats = Statistics.objects.all().order_by('-last_update')
latest_stat = 0
for stat in stats:
print(abs(latest_stat - stat.followers))
latest_stat = stat.followers
On Mon, Jun 4, 2018 at 11:24 AM, Daniel Germano Travieso <
danielgtravi...@gmail.com> wrote:
>
Hello!
I don't quite understand what you mean by the followers difference by day,
but as that difference by day is not a property of each model tuple, but a
property of a specific day, you can write a view to handle that processing.
Custom model Managers are used to either add manager methods or to
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.2761
3 matches
Mail list logo