django - How to include "None" in lte/gte comparisons? -
i've got complex filtering mechanism... d = copy(request.get) d.setdefault('sort_by', 'created') d.setdefault('sort_dir', 'desc') form = filtershipmentform(d) filter = { 'status': shipmentstatuses.active } exclude = {} if not request.user.is_staff: filter['user__is_staff'] = false if request.user.is_authenticated(): exclude['user__blocked_by__blocked'] = request.user if form.is_valid(): d = form.cleaned_data if d.get('pickup_city'): filter['pickup_address__city__icontains'] = d['pickup_city'] if d.get('dropoff_city'): filter['dropoff_address__city__icontains'] = d['dropoff_city'] if d.get('pickup_province'): filter['pickup_address__province__exact'] = d['pickup_province'] if d.get('dropoff_province'): filter['dropoff_address__province__exact'] = d['dropoff_province'] if d.get('pickup_c...