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 customize and change the QuerySet your model returns. If you wish to use the model manager for this, it could be used to add a field to your model that makes a query to the last followers on that day and calculates the difference (?). You could also use a @property on your Model class for that too.
Hope it helps! *[]'s* *Daniel Germano Travieso* *Engenharia da Computação Turma: 013* *Unicamp* On Thu, May 31, 2018 at 11:14 AM, João Paulo <joaopaulo.mai...@gmail.com> wrote: > > 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+unsubscr...@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 > <https://groups.google.com/d/msgid/django-users/3196a628-a53f-41ac-bcbf-6cc8b8a66016%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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+unsubscr...@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/CABF8kZNYHY8zWYNw3WKTxLMcnsxxDU9hPAep4wpzk9i4c-veRg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.