On Saturday, November 15, 2014 4:47:12 PM UTC+5:30, Sachin Tiwari wrote: > > Hi All, > > I am using below daterange filter package but it did not work if > from_date and to_date field are same, > > > https://github.com/DXist/django-daterange-filter/blob/master/daterange_filter/filter.py > > Please suggest the solution > > I was trying by converting to_date + timedelta(days=1) but it gives below > error > > > time data '<django.forms.fields.DateField object at 0x7f80e9200190>' does not > match format '%Y-%m-%d' > > > Edited Code of above link > > import datetime > > to_date = self.form.fields.get('measureddate__lte') > #toDate = datetime.datetime.strptime('2014-11-15', "%Y-%m-%d").date() > toDate = datetime.datetime.strptime(to_date.__str__(), "%Y-%m-%d").date() > //Error > toTotom = toDate + datetime.timedelta(days=1) > self.replace_value_with_definition('measureddate__lte', toTotom.__str__()) > > > > > def replace_value_with_definition(self,key_to_find, definition): > for key in self.form.cleaned_data.keys(): > if key == key_to_find: > self.form.cleaned_data[key] = definition > return self.form.cleaned_data > > > > > > PFA
-- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at http://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/da08bad2-0312-4539-be1e-66511d080215%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.