title: django queryset with mongodb
body: <p>I'm working on a Django app using the <a href="http://django-tastypie.readthedocs.org/en/latest/index.html" rel="nofollow">tastypie API</a>, I basically want to create objects and then filter them by date so that I know which objects are new ('give me all the objects from that date to today' kind of).
  I don't know if that matters (I think it does) but I'm using mongoDB.</p>
  
  <p>Where I struggle is when I try to do  <code>?&amp;published__gte=2013-02-01</code>
  Simply, what is the most logical way to filter by date?
  I hope I make any sense, if not don't hesitate to ask me precisions.</p>
  
  <p>Here is my model:</p>
  
  <pre><code>class Object(models.Model):
  
      name = models.CharField(max_length=200)
      published = models.DateTimeField('date published')
  </code></pre>
  
  <p>Here is my resource:</p>
  
  <pre><code>class ObjectResource(ModelResource):
  
      class Meta:
          queryset = Object.objects.all()
          resource_name = 'object'
          filtering = {
              "published": ['gte', 'lte', 'exact'],
              }
  
      def build_filters(self, filters=None):
          if filters is None:
              filters = {}
          orm_filters = super(Object, self).build_filters(filters)
  
          if('published' in filters):
              published = filters['published']
              # need to do some modifications on the date format here i guess
              qset = (Q(published=published))
              orm_filters.update({'from': qset})
  
              return orm_filters
  
      def apply_filters(self, request, applicable_filters):
          if 'from' in applicable_filters:
              from_ = applicable_filters.pop('from')
          else:
              from_ = None
  
          semi_filtered = super(ObjectResource, self).apply_filters(request, applicable_filters)
  
          return semi_filtered.filter(from_) if from_ else semi_filtered
  </code></pre>
  
  <p><strong>UPDATE</strong></p>
  
  <p>I modified build_filter to this:</p>
  
  <pre><code>if('published' in filters):
      published = filters['published']
      qset = (Q(published=published) | 
              Q(published__lte=published) |
              Q(published__gte=published))
      orm_filters.update({'from': qset})
      return orm_filters
  </code></pre>
  
  <p>I get the following error: <code>argument of type 'NoneType' is not iterable</code></p>
  
  <p>So I guess that when filtering, there's no result. 
  Is there a difference between date formats maybe? </p>