RE: Exported filtered by date data in django

2021-11-21 Thread ngallen4
Sunday, November 21, 2021 10:45 AM To: django-users@googlegroups.com Subject: Re: Exported filtered by date data in django hy I want to declare global variable that used in many functions in python can you show me On Sat, Nov 20, 2021 at 9:49 AM Eugene TUYIZERE mailto:eugenetuyiz...@gma

Re: Exported filtered by date data in django

2021-11-20 Thread Twizerimana Emmanuel
hy I want to declare global variable that used in many functions in python can you show me On Sat, Nov 20, 2021 at 9:49 AM Eugene TUYIZERE wrote: > Dear Ramadhan, > > Still it does not work > > On Sat, 20 Nov 2021 at 09:18, ramadhan ngallen wrote: > >> Depends on your query filter_val2 should

Re: Exported filtered by date data in django

2021-11-20 Thread Lalit Suthar
`filter_val1` and `filter_val2` are coming from POST request so they are in `string` format. But the `created_at` field of the `EXPENSES` table is in `datetime` format. This is why the result of the filter() is coming as empty. The query will run fine when the 2 values compared are in the same

Re: Exported filtered by date data in django

2021-11-19 Thread ramadhan ngallen
Debug by printing val1 and val2 before filtering if those vslues are dates(class) if true print expenses after filtering. Otherwise your date ranges does not contain s data as required On 20 Nov 2021, 10:49 +0300, Eugene TUYIZERE , wrote: > Dear Ramadhan, > Still it does not work > On Sat, 20

Re: Exported filtered by date data in django

2021-11-19 Thread Eugene TUYIZERE
Dear Ramadhan, Still it does not work On Sat, 20 Nov 2021 at 09:18, ramadhan ngallen wrote: > Depends on your query filter_val2 should lower than filter_val1 as the > range start from val2 to val1. > Otherwise change your parameter from val1 to val2 >

Re: Exported filtered by date data in django

2021-11-19 Thread ramadhan ngallen
Depends on your query filter_val2 should lower than filter_val1 as the range start from val2 to val1. Otherwise change your parameter from val1 to val2 EXPENSES.objects.filter(Q(created_at__range=[filter_val2,filter_val1])) On 20 Nov 2021, 10:04 +0300, Eugene TUYIZERE , wrote: > Dear Team, > > I

Exported filtered by date data in django

2021-11-19 Thread Eugene TUYIZERE
Dear Team, I am trying to export filtered data from a django model, but I get an empty file. But when I remove the filter and add all, it works. Kindly assist to know how to export filtered data. Below is my code def exportexpenes(request): filter_val1=request.POST.get("filter1")