title: Get count of users registered pey day in django app
body: <p>I need to create a simple chart (using chart.js),so the should chart like this:
  On the Y-axis - the number of registered users,X-axis - date
  Screen below:</p>
  <p><a href="https://i.stack.imgur.com/W2RnX.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/W2RnX.png" alt="Y axis data was generated for illustrative example" /></a></p>
  <p>My model:</p>
  <pre><code>class User(AbstractBaseUser, PermissionsMixin):
  
  uid = models.CharField(max_length=36, unique=True, default=make_uid)
  email = models.EmailField(max_length=255, unique=True)
  name = models.CharField(max_length=255, unique=True)
  is_active = models.BooleanField(default=False)
  is_staff = models.BooleanField(default=False)
  activation_token = models.CharField(null=True, blank=True, max_length=100)
  
  date_joined = models.DateTimeField(default=now, editable=False)
  </code></pre>
  <p>View:</p>
  <pre><code>@staff_member_required()
  @login_required()
  def index(request):
    users = User.objects.all()
    context = {
        &quot;users&quot;: users,
        &quot;users_count&quot;: users.count
         }
    return render(request, &quot;backoffice/backoffice_index.html&quot;, context)
  </code></pre>
  <p>Template part with chart:</p>
  <pre><code>    &lt;script&gt;
      $(document).ready(function () {
          var ctx = document.getElementById(&quot;myChart&quot;).getContext('2d');
          var myChart = new Chart(ctx, {
              type: 'bar',
              data: {
                  labels: [{% for user in users %} '{{ user.date_joined }}', {% endfor %}],
                  datasets: [{
                      label: '# of users registered per day',
                      data: [],
                      backgroundColor: [
                          'rgba(255, 99, 132, 0.2)',
                          'rgba(54, 162, 235, 0.2)',
                          'rgba(255, 206, 86, 0.2)',
                          'rgba(75, 192, 192, 0.2)',
                          'rgba(153, 102, 255, 0.2)',
                          'rgba(255, 159, 64, 0.2)'
                      ],
                      borderColor: [
                          'rgba(255,99,132,1)',
                          'rgba(54, 162, 235, 1)',
                          'rgba(255, 206, 86, 1)',
                          'rgba(75, 192, 192, 1)',
                          'rgba(153, 102, 255, 1)',
                          'rgba(255, 159, 64, 1)'
                      ],
                      borderWidth: 1
                  }]
              },
              options: {
                  scales: {
                      yAxes: [{
                          ticks: {
                              beginAtZero: true
                          }
                      }]
                  }
              }
          });
      });
  &lt;/script&gt;
  
  
  &lt;canvas id=&quot;myChart&quot; width=&quot;400&quot; height=&quot;100&quot;&gt;&lt;/canvas&gt;
  </code></pre>
  <p>If I understand everything correctly, then I need to put the number of new users in an array called &quot;data&quot;,and , obvsiously, it must be integer values !</p>
  <p>How could I do it? Thanks in advance !</p>