code: def count_in_date(x='date_time', filter_dict=None, model=DEFAULT_MODEL, app=DEFAULT_APP, sort=True, limit=100000):
      
      sort = sort_prefix(sort)
      model = get_model(model, app)
      filter_dict = filter_dict or {}
  
      x = fuzzy.extractOne(str(x), model._meta.get_all_field_names())[0]    
  
      objects = model.objects.filter(**filter_dict)
      objects = objects.extra({'date_bin_for_counting': 'date(%s)' % x})
      objects = objects.values('date_bin_for_counting')
      objects = objects.annotate(count_of_records_per_date_bin=djmodels.Count('pk'))
      
      # FIXME: this duplicates the dict of lists sort below
      if sort is not None:
          objects = objects.order_by(sort + 'date_bin_for_counting')
      objects = objects.all()
      if limit:
          objects = objects[:int(limit)]
      objects = util.sod_transposed(objects)
      if sort is not None:
          objects = sorted_dict_of_lists(objects, field_names=['count_of_records_per_date_bin', 'date_bin_for_counting'], reverse=bool(sort))
      #logger.info(x)
      return objects['date_bin_for_counting'], objects['count_of_records_per_date_bin']
docs: Count the number of records for each discrete (categorical) value of a field and return a dict of two lists, the field values and the counts.
  
      >>> from django.db import transaction
      >>> transaction.rollback()
      >>> x, y = count_in_date(x='date', filter_dict={'model__icontains': 'LC5'}, limit=5, sort=1)
      >>> len(x) == len(y) == 5
      True
      >>> y[1] >= y[0]
      True