El 14/04/2014 22:53, "Iasmini - Gmail" <[email protected]> va
escriure:
>
> Hi,
>
> How do I filter between 2 dates in a wizard?
>
> For greater then this works fine:
>
> if self.start.opening_date_start:
> parameters.append(('create_date', '>=',
DateTime(self.start.opening_date_start.year,
> self.start.opening_date_start.month,
> self.start.opening_date_start.day,
> hour=0, minute=0, second=0, microsecond=0))),
It seems the last comma ia not needed
> I tried this, but it says too many values to unpacking:
>
> if self.start.opening_date_start:
> parameters.append(('create_date', '>=',
DateTime(self.start.opening_date_start.year,
> self.start.opening_date_start.month,
> self.start.opening_date_start.day,
> hour=0, minute=0, second=0, microsecond=0),
> 'create_date', '<=',
DateTime(self.start.opening_date_end.year,
> self.start.opening_date_end.month,
> self.start.opening_date_end.day,
> hour=0, minute=0, second=0, microsecond=0))),
Here you are appending a tuple of 6 elements. Provably you want to append
two ruoles of three elements.
The last comma, out of brackets, is not needed again.
Anyway, what are you trying? Why not use the opening_date_end directly.
If you need to convert from "date" to "datetime" you can use the
datetime.combine() method, but I think that to set 00:00:00 time it isn't
needed.
El 14/04/2014 22:53, "Iasmini - Gmail" <[email protected]> va
escriure:
> Hi,
>
> How do I filter between 2 dates in a wizard?
>
> For greater then this works fine:
>
> if self.start.opening_date_start:
> parameters.append(('create_date', '>=',
> DateTime(self.start.opening_date_start.year,
> self.start.opening_date_start.month,
> self.start.opening_date_start.day,
> hour=0, minute=0, second=0, microsecond=0))),
>
> I tried this, but it says too many values to unpacking:
>
> if self.start.opening_date_start:
> parameters.append(('create_date', '>=',
> DateTime(self.start.opening_date_start.year,
> self.start.opening_date_start.month,
> self.start.opening_date_start.day,
> hour=0, minute=0, second=0, microsecond=0),
> 'create_date', '<=',
> DateTime(self.start.opening_date_end.year,
> self.start.opening_date_end.month,
> self.start.opening_date_end.day,
> hour=0, minute=0, second=0, microsecond=0))),
> --
>
> Iasmini Gomes
> Sílex Sistemas
> www.silexsistemas.com.br
>
> ---
> Este email está limpo de vírus e malwares porque a proteção do avast!
> Antivírus está ativa.
> http://www.avast.com
>
>