Re: Django queryset filtering

2020-10-11 Thread Dvs Khamele
Hi do you hire contract based python/django freelancer? We can help you in this and related tasks at fair prices. Reply or send email to divy...@pythonmate.com Best Regards, Divyesh Khamele, Pythonmate On Thu, 25 Jun 2020, 3:55 am mtp...@gmail.com, wrote: > I have a queryset that returns all th

Re: Django queryset filtering

2020-10-06 Thread mtp...@gmail.com
Thanks guys this was very useful On Friday, June 26, 2020 at 6:27:23 PM UTC+3 Dan Madere wrote: > I'd make two queries. One to see which businesses currently have active > licenses, then a second to get the expired licenses, excluding the > businesses from the first query. Here's some example

Re: Django queryset filtering

2020-06-26 Thread Dan Madere
I'd make two queries. One to see which businesses currently have active licenses, then a second to get the expired licenses, excluding the businesses from the first query. Here's some example code, assuming the LicenseIssue model has a "business" foreign key field: *active_business_ids = Licen

Re: Django queryset filtering

2020-06-25 Thread Oleg Kishenkov
Hello, use a filtering chain, a refined queryset is itself a queryset so you can filter it further. Also, Django has extensive lookup support in its filtering methods. Let's assume LicenseIssue is related to Business as many to one (it is probably the case): class Business(models.Model): name

Django queryset filtering

2020-06-24 Thread mtp...@gmail.com
I have a queryset that returns all the expired licenses objects as shown below. *qs = LicenseIssue.objects.filter(expiry_date__lte=TODAY).order_by('-expiry_date')* Here is my situation: There exists multiple issued licenses of different businesses for year 2020 and their previous issued