Note that there are some explanatory texts on larger screens.

plurals
  1. PODaily compound aggregation of Django's ``User`` models' ``date_joined`` field (for graphing with Highcharts)
    text
    copied!<p>I would like to take my <code>User</code> model and break it down by day, using the <code>date_joined</code> field. Django's <a href="https://docs.djangoproject.com/en/dev/topics/db/aggregation/" rel="nofollow">aggregation</a> seems to be a good fit, but im not sure how to use this with a DateField object. I believe I also want the values to compound.</p> <p>My goal is to get a whole number for each day since the very first signup to the most present (and continuing). I <em>think</em> I want this in compound form, so for example, if the first day i have 100 signups and the day after is 80, I want the second days total to be 180. This way I can see the userbase grow/drop over time and not just see signup spikes and then flatline on days that there are no signups.</p> <p>Pretty set on using Highcharts for the graphing. Here is a live example of the graph I wish to implement, only using Apple stock data but it's more or less what I want, only with daily amounts of user signup. <a href="http://www.highcharts.com/stock/demo/basic-line" rel="nofollow">http://www.highcharts.com/stock/demo/basic-line</a></p> <p>I can build a QuerySet of a single instance with the following example. This isn't a very realistic approach going forward though. I'd like to dynamically calculate these figures, not manually assign them.</p> <p><code> y2007m09d01=(user_list.filter(date_joined__year="2007").filter(date_joined__month="9").filter(date_joined__day="1").count())<br> y2007m09d02=(user_list.filter(date_joined__year="2007").filter(date_joined__month="9").filter(date_joined__day="1").count() + y2007m09d01) </code></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload