Re: Using one query set for another query

2023-04-09 Thread Harsh Vyas
Hi, Need a slight justification on your case what exactly is the use case you need to resolve. So far, I understood you need to know details about unpaid bills, Approach 1:- Model bill_payment_history will have data for field date_paid in case of only paid bills, so you can try to query

Using one query set for another query

2023-03-28 Thread lone...@gmail.com
Hello all, I am trying to use the query of: paid_bills = bill_payment_history.objects.filter(date_paid__year='2023', date_paid__month='03') as criteria for another query to only show the unpaid bills. The known_bills model is my control list of known bills that oc

How to write query user between dates no leaves?

2023-02-24 Thread Prashanth Patelc
How to write orm query? User don't have any leave between two dates in django ? leave_data = EmployeeLeaves.objects.filter(~Q(approval_status='Approved'),~Q(approval_status='Cancelled'),~Q(approval_status='Rejected'), from_date__gte=month_firs

Fwd: How to create orm query if data is exist or not ?

2023-02-23 Thread Prashanth Patelc
-- Forwarded message - From: Prashanth Patelc Date: Thu, Feb 23, 2023 at 5:11 PM Subject: How to create orm query if data is exist or not ? To: Hi all, How to create orm query with data exist or not ? How to check if approval_status Pending and Rejected with same user

How to create orm query if data is exist or not ?

2023-02-23 Thread Prashanth Patelc
Hi all, How to create orm query with data exist or not ? How to check if approval_status Pending and Rejected with same user contains from_date approval_status User 2023-01-20 - ApprovedNewUser 2023-01-12 - Rejected NewUser 2023-01

Orm query

2023-02-17 Thread Prashanth Patelc
Hi all, This is my model if model contain previous month dates I need to and store the data If user is new previous data is not available I need to store directly to db . How to write orm query? Attendance.object.filter(user=emp,date=enddate,crea_date=strdate) If dates is not available in

Complex Query

2022-11-20 Thread sebasti...@gmail.com
Hello Guys, you find my question in attachment because tabs in tables are not shown when i send it in gmail. Please help me on my question who make i a complex query. Thanks in advance -- You received this message because you are subscribed to the Google Groups "Django users"

Re: manage.py loaddata: Problem installing fixture... Email matching query does not exist

2022-10-17 Thread Luiz Angelo Daros de Luca
Hello Moritz, I have good news. I managed to migrate from sqlite3 to postgresql. You need to apply this patch and load each mailman app individually because it conflicts with existing objects, truncating the *_profile tables on the way. https://gitlab.com/mailman/hyperkitty/-/merge_requests/469

Re: manage.py loaddata: Problem installing fixture... Email matching query does not exist

2022-09-27 Thread Luiz Angelo Daros de Luca
Hello Moritz, I got the same problem doing the same mailman3 migration (but to a postgres db). Do you have a solution? Regards, -- 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,

DoesNotExist at /admin/blog/blog/add/: blog matching query does not exist

2022-09-13 Thread Jaap van Wingerde
Suddenly I can no longer add blogs to Django. Django says 'blog matching query does not exist'. That seems strange to me because I want to add something to the database and not request a blog. What could be going on here? admin.py: class blogadmin(admin.ModelAdmin): def save_

How to get last child object of a parent model by query

2022-08-05 Thread Sencer Hamarat
Hi, Let's say there are two related models class Parent(models.Model): ... class Child(models.Model): parent = models.ForeingKey(Parent) I need to fetch every last child of specific parent objects by query. Is there a way to do this instead iterating Parent objects to gather

Casting a variable as array in a query

2022-07-26 Thread Sencer Hamarat
I'm having a problem with this query: I believe, Q(bundle__contains=OuterRef("book_id")) part of the query is expecting an array instead of single value. I'm getting this error: ProgrammingError: operator does not exist: jsonb @> bigint LINE 1: ...lisher&qu

Re: Pass or refer parent query value into subquery

2022-07-26 Thread Ross Meredith
Sorry I haven't used the JSONField myself before. On Tue, Jul 26, 2022 at 5:01 PM Sencer Hamarat wrote: > Thanks Ross, > Very appreciated. > That's what I need. > > I'm also having a problem with this query after I implemented the solution: > > I believe, &g

Re: Pass or refer parent query value into subquery

2022-07-26 Thread Sencer Hamarat
Thanks Ross, Very appreciated. That's what I need. I'm also having a problem with this query after I implemented the solution: I believe, Q(bundle__contains=OuterRef("book_id")) part of the query is expecting an array instead of direct value. I'm getting this error: P

Re: Pass or refer parent query value into subquery

2022-07-26 Thread Ross Meredith
https://docs.djangoproject.com/en/4.0/ref/models/expressions/#django.db.models.OuterRef On Tue, Jul 26, 2022 at 4:27 PM Sencer Hamarat wrote: > Hi, > > I need to pass the parent query book_id value into the subquery. > Here is the model and the current state of the query I reache

Pass or refer parent query value into subquery

2022-07-26 Thread Sencer Hamarat
Hi, I need to pass the parent query book_id value into the subquery. Here is the model and the current state of the query I reached. class Publisher(models.Model): book = models.ForeignKey(Book) bundle = models.JSONField() current_sales_count_query = Publisher.objects.filter

Re: Help to implement join query in django orm

2022-07-25 Thread 'Amitesh Sahay' via Django users
10. How to perform join operations in django ORM? — Django ORM Cookbook 2.0 documentation (agiliq.com) Try this On Monday, 25 July, 2022 at 01:18:44 pm IST, Mihir Patel wrote: is anyone having login issue? , i am unable to authenticate a user in my website On Sun, Jul 24, 2022 at

Re: Help to implement join query in django orm

2022-07-25 Thread Mihir Patel
is anyone having login issue? , i am unable to authenticate a user in my website On Sun, Jul 24, 2022 at 10:37 PM Jitendra kumar Patra < jitendrapatra...@gmail.com> wrote: > Ping me 7008080545 > > On Fri, 22 Jul, 2022, 12:16 Avi shah, wrote: > >> I have two tables >> Tbl 1 >> & >> Tbl 2 >> >> I

Re: Help to implement join query in django orm

2022-07-24 Thread Jitendra kumar Patra
Ping me 7008080545 On Fri, 22 Jul, 2022, 12:16 Avi shah, wrote: > I have two tables > Tbl 1 > & > Tbl 2 > > I need to connect the two tables using a join > > > Thanks and regards, > Avi shah > > -- > You received this message because you are subscribed to the Google Groups > "Django users" group

Re: Help to implement join query in django orm

2022-07-24 Thread Abhishek Gupta
Hey, you have to write custom raw query for join tables which are not connected with foreign key relationship in django. On Sun, Jul 24, 2022, 11:17 Lalit Suthar wrote: > this can be helpful > > https://betterprogramming.pub/django-select-related-and-prefetch-related-f23043fd635d >

Re: Help to implement join query in django orm

2022-07-23 Thread Lalit Suthar
ave a model > associated with it. You can then use Django's ForeignKey support to query > the tables. > > > [1] https://docs.djangoproject.com/en/4.0/howto/legacy-databases/ > > > -- > You received this message because you are subscribed to the Google Groups > &q

Re: Help to implement join query in django orm

2022-07-23 Thread Ryan Nowakowski
cy database support to auto generate the models[1]. After that, each table will have a model associated with it. You can then use Django's ForeignKey support to query the tables. [1] https://docs.djangoproject.com/en/4.0/howto/legacy-databases/ -- You received this message because you are

Help to implement join query in django orm

2022-07-21 Thread Avi shah
I have two tables Tbl 1 & Tbl 2 I need to connect the two tables using a join Thanks and regards, Avi shah -- 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 dja

manage.py loaddata: Problem installing fixture... Email matching query does not exist

2022-07-07 Thread Moritz Both
/python3.8/site-packages/django/db/models/fields/related_descriptors.py", line 154, in get_object return qs.get(self.field.get_reverse_related_filter(instance)) File "*/home/daneben/*.local/lib/python3.8/site-packages/django/db/models/query.py", line 435, in get raise sel

Lost connection to MySQL server during query

2022-06-17 Thread Larry Martell
erver during query'. My DB wait_timeout is set to 8 hours and if the function returns in less than 8 hours I don't get the error, so I thought I understood what was going on. But then I read about CONN_MAX_AGE which we do not set. If that is not set it should default to 0, which should mean

Re: Negated filtering by lookup expression sent via url query

2022-05-31 Thread Lalit Suthar
: > > Hi, > > Is there any way to negate filtering with the django-filter package which > lookup expression sent via url query, such as: > > http://example.com/?name__not_contains=john > > > The request above has to be passed through the django filterset class and >

Negated filtering by lookup expression sent via url query

2022-05-31 Thread Sencer Hamarat
Hi, Is there any way to negate filtering with the django-filter package which lookup expression sent via url query, such as: http://example.com/?name__not_contains=john The request above has to be passed through the django filterset class and the class has to be returned with the queryset

Can I use session.userid in models FK restriction query?

2022-02-11 Thread lone...@gmail.com
Hello all, I am curious if I can use the session.userid in a model FK restriction query. Thank you. -- 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

Re: Employee matching query does not exist

2022-01-05 Thread Gwanghyeon Gim
Two possible scenarios. 1. self.request.POST doesn't have any key named 'employee_id', so self.request.POST.get('employee_id') returns None 2. self.request.POST.get('employee_id') has value like 'Sam', but Employee model doesn't have any object whose name equals to self.request.POST.get('employ

Re: Employee matching query does not exist

2022-01-05 Thread Julio Cojom
by the way that you are handling the query set. And I believe with the poor information that you give us, that the 'employee_id' isn't the right keyword to get the value desired. Usually you can use the name in your models to refer to the field that you want the data. If you want th

Re: Employee matching query does not exist

2022-01-05 Thread Rey Ondiyo
Django don't saw a employe who have this ID so you can use filter if there's not matching in your database he return [ ]. obj.employee= Employee.objects.filter(name=self.request.POST.get('employee_id')) Le mardi 4 janvier 2022 à 15:44:55 UTC+1, jitendra...@gmail.com a écrit : > name column r

Re: Employee matching query does not exist

2022-01-04 Thread Jitendra kumar Patra
name column row's data not matching from database Show that you are getting error . So we use the Expection then you can easily handle the error .. On Tue, 4 Jan 2022, 8:05 pm yassin kamanyile, wrote: > please team ..i got an error from that line below > > obj.employee = Employee.objects.get

Employee matching query does not exist

2022-01-04 Thread yassin kamanyile
please team ..i got an error from that line below obj.employee = Employee.objects.get(name=self.request.POST.get('employee_id' )) -- 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,

Re: User matching query does not exist.

2021-10-18 Thread Nicholas Bartlett
tattr(self.get_queryset(), name)(*args, **kwargs) File "/Users/nicholasbartlett/Documents/Dashboard/djangodash/djenv/lib/python3.8/site-packages/django/db/models/query.py", line 435, in get raise self.model.DoesNotExist( django.contrib.auth.models.Group.DoesNotExist: Group mat

Re: SQL query to django

2021-10-10 Thread Eugene TUYIZERE
Thank y'all On Sun, 10 Oct 2021 at 11:49, Sebastian Jung wrote: > Hello Eugene, > > You can also take a raw query... > > https://docs.djangoproject.com/en/3.2/topics/db/sql/ > > Regards > > Eugene TUYIZERE schrieb am Sa., 9. Okt. 2021, > 10:52: > >>

Re: SQL query to django

2021-10-10 Thread Sebastian Jung
Hello Eugene, You can also take a raw query... https://docs.djangoproject.com/en/3.2/topics/db/sql/ Regards Eugene TUYIZERE schrieb am Sa., 9. Okt. 2021, 10:52: > Dear all, > > I have a table let call it *YY*. Some fields in this table are status, > time_frame, etc. > time fr

Re: SQL query to django

2021-10-09 Thread carlos
ess and > completed in each year. > And at the end to display this on bar chart. but What I most want is the > query. > > I want to transform this SQL query in Django: > > SELECT status from YY group by time_frame; > > please assist > > -- > *TUYIZERE Eugene* >

SQL query to django

2021-10-09 Thread Eugene TUYIZERE
this on bar chart. but What I most want is the query. I want to transform this SQL query in Django: SELECT status from YY group by time_frame; please assist -- *TUYIZERE Eugene* -- You received this message because you are subscribed to the Google Groups "Django users" group. To u

Re: Django Query

2021-10-05 Thread Adeyemi Deji
You can read up the documentation regarding MPTT, sure to be useful. https://django-mptt.readthedocs.io/en/latest On Tuesday, October 5, 2021 at 10:05:42 AM UTC+2 eugenet...@gmail.com wrote: > Is there any one with a typical example or tutorial (of Django mptt) that > tolks on the similar issu

Re: Django Query

2021-10-05 Thread Eugene TUYIZERE
Is there any one with a typical example or tutorial (of Django mptt) that tolks on the similar issue as mine and share with me? regards, On Tue, 5 Oct 2021 at 01:00, Sebastian Jung wrote: > Hello Eugene, > > I think that django mptt can Store and display such a tree. > > Regards > > Eugene TU

Re: Django Query

2021-10-04 Thread Sebastian Jung
Hello Eugene, I think that django mptt can Store and display such a tree. Regards Eugene TUYIZERE schrieb am Mo., 4. Okt. 2021, 20:29: > Team, > > Assume you have 3 tables PROVINCES, DISTRICTS, and SECTORS and you have > Province, District and Sector field names respectively in each table. > >

Django Query

2021-10-04 Thread Eugene TUYIZERE
Team, Assume you have 3 tables PROVINCES, DISTRICTS, and SECTORS and you have Province, District and Sector field names respectively in each table. How can you display in the Django template the following table? Province District Sectors A A1 A11 A12 A2 A21 A22 A3 A31 A32 Any assistance will be

Re: Query help

2021-09-21 Thread J.T.
columns Value1, Value2, Value3, Value4, Value5 are either Y >> or N. >> >> I'm trying to query by ID to count the number of Y values for each member. >> >> For example one row would be: 5, Y, N, Y, N, N >> >> I would like to return: 2 (since that i

Re: Query help

2021-09-20 Thread Lalit Suthar
On Tue, 21 Sept 2021 at 04:11, J.T. wrote: > I have a model called member that has 6 columns: ID, Value1, Value2, > Value3, Value4, Value5 > > The values in columns Value1, Value2, Value3, Value4, Value5 are either Y > or N. > > I'm trying to query by ID to count th

Re: Query help

2021-09-20 Thread Sean Collins
ID, Value1, Value2, > Value3, Value4, Value5 > > The values in columns Value1, Value2, Value3, Value4, Value5 are either Y > or N. > > I'm trying to query by ID to count the number of Y values for each member. > > For example one row would be: 5, Y, N, Y, N, N > >

Query help

2021-09-20 Thread J.T.
I have a model called member that has 6 columns: ID, Value1, Value2, Value3, Value4, Value5 The values in columns Value1, Value2, Value3, Value4, Value5 are either Y or N. I'm trying to query by ID to count the number of Y values for each member. For example one row would be: 5, Y, N,

Re: iterate over query set

2021-07-26 Thread DJANGO DEVELOPER
because you have provided the get_department with index 0. so it will only give you the info about first department. On Tue, Jul 27, 2021 at 3:17 AM sum abiut wrote: > I am trying to get the values of the userid by iterating through the > queryset. However not all the values are displayed. I am

iterate over query set

2021-07-26 Thread sum abiut
I am trying to get the values of the userid by iterating through the queryset. However not all the values are displayed. I am not sure why I am not getting all the values when I iterate through it. users - Users.objects.filter(depid=get_department[0].depid) print(users) #when i test it here it pri

Re: use of annotate in django query

2021-07-26 Thread V. J
>>>> >>>>>>>> >>>>>>>> On Thu, 3 Jun 2021 at 13:27, lalit suthar >>>>>>>> wrote: >>>>>>>> >>>>>>>>> Hi there! >>>>>>>>> make these

Re: complex math calculation from query set # SOLVED

2021-07-24 Thread Franck Tchouanga
s is the solution that worked for me based on Derek's lead >> >> ## METHOD 1 ## >> >> # view >> >> def position_view(request): >> >> packet_data = >> TncData.objects.exclude(lat=0).order_by('-dt_heard')[:100]

Re: complex math calculation from query set # SOLVED

2021-07-24 Thread esteem learning center
lution that worked for me based on Derek's lead > > ## METHOD 1 ## > > # view > > def position_view(request): > > packet_data = > TncData.objects.exclude(lat=0).order_by('-dt_heard')[:100] > > # loop through query set and add new di

Re: complex math calculation from query set # SOLVED

2021-07-24 Thread mab.mo...@gmail.com
# loop through query set and add new dictionary key-value pair for row in packet_data: row.distance = row.lat*row.lon # example only of calculation only not real return render(request, 'main/position.html', {'packet_data':packet_data,}) # h

Query Optimization and profiling for celery tasks

2021-07-24 Thread Hamidreza Mahmoodian
Hello everyone Django-debug-toolbar and Django-silk are two famous tools for profiling HTTP requests. Is it possible to analyze a celery task or any other function inside the code? for instance, I have a celery task like this: def main_task(): while _condition: logic() s

Re: complex math calculation from query set

2021-07-21 Thread mab.mo...@gmail.com
{{field.callsign}} > {{field.lat|floatformat:2}} N > {{field.lon|floatformat:2}} W > > *{{field.distance}}* > > > HTH! > > On Tuesday, 20 July 2021 at 22:25:04 UTC+2 mab.mo...@gmail.com wrote: > >> Hello, >> >> I am trying to perform

Re: complex math calculation from query set

2021-07-21 Thread Derek
; maybe "record"?* > {% for field in packet_data %} > > {{field.callsign}} > {{field.lat|floatformat:2}} N > {{field.lon|floatformat:2}} W > > *{{field.distance}}* > > > HTH! > > On Tuesday, 20 July 2021 at 22:25:04 UTC+2 mab.mo...@gmail.com wrote: >

Re: complex math calculation from query set

2021-07-21 Thread Derek
;field" => maybe "record"?* {% for field in packet_data %} {{field.callsign}} {{field.lat|floatformat:2}} N {{field.lon|floatformat:2}} W *{{field.distance}}* HTH! On Tuesday, 20 July 2021 at 22:25:04 UTC+2 mab.mo...@gmail.com wrote: > Hello, > > I am

complex math calculation from query set

2021-07-20 Thread mab.mo...@gmail.com
Hello, I am trying to perform a complex math calculation from a django query set. How can I pass the results to the template for display? Annotations won't work since the math is not a simple sum, diff or average. MODEL class TncData(models.Model): callsign = models.TextField(max_l

Re: Django Query vs SQL query

2021-06-15 Thread Nikeet NA
use the related name on the staff model for project field with __ lookup as in class Staff(models.Model): . . project = foreignkey relationship (related_name='staffs') SO the query would be Projects.objects.filter(staffs__project_id=F('pk')) On Tues

Django Query vs SQL query

2021-06-15 Thread Eugene TUYIZERE
Team, I am a little bit confused: I have a table callect Projects and another called Staffs. I want a particular staff member to view only the project he/she has a role in. In the Staffs table I have a project foreign key project_id. But I am confused about how to construct the query. I think of

Re: User matching query does not exist.

2021-06-12 Thread sachinbg sachin
t, *callback_args, >> **callback_kwargs) >> File "D:\DjangoDemos\CartApp\views.py", line 15, in addToCart >> user = User.objects.get(id=uid) >> File >> "D:\DjangoDemos\venv\lib\site-packages\django\db\models\manager.py", line >> 85, i

Re: User matching query does not exist.

2021-06-12 Thread Nikeet NA
t;, line 15, in addToCart > user = User.objects.get(id=uid) > File > "D:\DjangoDemos\venv\lib\site-packages\django\db\models\manager.py", line > 85, in manager_method > return getattr(self.get_queryset(), name)(*args, **kwargs) > File "D:\Dja

User matching query does not exist.

2021-06-12 Thread Shilpa Agrawal
r.py", line 85, in manager_method return getattr(self.get_queryset(), name)(*args, **kwargs) File "D:\DjangoDemos\venv\lib\site-packages\django\db\models\query.py", line 435, in get raise self.model.DoesNotExist( Exception Type: DoesNotExist at /addToCart/1 Exception V

Re: use of annotate in django query

2021-06-05 Thread Lalit Suthar
! >>>>>>>> make these couple of changes >>>>>>>> >>>>>>>> 1) from django.core.serializers.json import DjangoJSONEncoder >>>>>>>> 2) dump3 = json.dumps(chart3, cls=DjangoJSONEncoder) >>>>>

Re: use of annotate in django query

2021-06-04 Thread Eugene TUYIZERE
at 16:18:15 UTC+5:30 eugenet...@gmail.com >>>>>>> wrote: >>>>>>> >>>>>>>> Dear Suthar, >>>>>>>> >>>>>>>> Your idea works well , but I want now to display the result on >>

Re: use of annotate in django query

2021-06-03 Thread Lalit Suthar
art. Below is the code I am trying to use: >>>>>>> but Am getting the error message: >>>>>>> >>>>>>> Exception Value: >>>>>>> >>>>>>> Object of type date is not JSON ser

Re: use of annotate in django query

2021-06-03 Thread Eugene TUYIZERE
ot JSON serializable >>>>>> >>>>>> >>>>>> def reqChart(request): >>>>>> aa = Customer_Requests.objects.values("arrival_date").annotate( >>>>>> num_req=Count("request_name")).order_by('-arrival_date&#

Re: use of annotate in django query

2021-06-03 Thread Lalit Suthar
-1] >>>>> print(aa) >>>>> datesb = list() >>>>> sumdata = list() >>>>> for dd in aa: >>>>> datesb.append(dd['arrival_date']) >>>>> sumdata.append(dd['num_req']) >>>>> arriva_d

Re: use of annotate in django query

2021-06-03 Thread Eugene TUYIZERE
chart3 = { >>>> 'chart': {'type': 'column'}, >>>> 'title': {'text': 'Previous statistics'}, >>>> 'xAxis': {'datesb': datesb}, >>>> '

Re: use of annotate in django query

2021-06-03 Thread Lalit Suthar
cs'}, >>> 'xAxis': {'datesb': datesb}, >>> 'series': [arriva_days] >>> } >>> dump3 = json.dumps(chart3) >>> return render(request,'summarizedchart.html',{'chart3': dump3}) >>> >>

Re: use of annotate in django query

2021-06-03 Thread Eugene TUYIZERE
gt;> >> regards, >> >> >> >> On Thu, 3 Jun 2021 at 09:00, lalit suthar wrote: >> >>> this will do >>> >>> Customer_Requests.objects.values("arrival_date").annotate(num_req=Count("request_name")).order_by("-id&quo

Re: use of annotate in django query

2021-06-03 Thread lalit suthar
>> >>> to display last 30 records you can write your code like this: >>> Customer_Requests.objects.all()[-30] >>> >>> On Thu, Jun 3, 2021 at 10:51 AM Eugene TUYIZERE >>> wrote: >>> >>>> Dear Latit, >>>> >>&

Re: use of annotate in django query

2021-06-03 Thread Eugene TUYIZERE
3, 2021 at 10:51 AM Eugene TUYIZERE >> wrote: >> >>> Dear Latit, >>> >>> Thank you very much. Now how can I display 30 last records? Regardless >>> of how many records I may have ! Just the last 30 records! >>> >>> Thank you &

Re: use of annotate in django query

2021-06-02 Thread lalit suthar
! >> >> Thank you >> >> On Thu, 3 Jun 2021 at 06:51, Lalit Suthar wrote: >> >>> > in brief, I want to transform this query in django query >>> this will be equivalent to this query in django >>> >>> Customer_Requests.objects.val

Re: use of annotate in django query

2021-06-02 Thread DJANGO DEVELOPER
the last 30 records! > > Thank you > > On Thu, 3 Jun 2021 at 06:51, Lalit Suthar > wrote: > >> > in brief, I want to transform this query in django query >> this will be equivalent to this query in django >> >> Customer_Requests.objects.values("arri

Re: use of annotate in django query

2021-06-02 Thread Eugene TUYIZERE
Dear Latit, Thank you very much. Now how can I display 30 last records? Regardless of how many records I may have ! Just the last 30 records! Thank you On Thu, 3 Jun 2021 at 06:51, Lalit Suthar wrote: > > in brief, I want to transform this query in django query > this will be equi

Re: use of annotate in django query

2021-06-02 Thread Lalit Suthar
> in brief, I want to transform this query in django query this will be equivalent to this query in django Customer_Requests.objects.values("arrival_date").annotate(num_req=Count("request_name")) On Thu, 3 Jun 2021 at 02:02, Eugene TUYIZERE wrote: > in brief, I want

Re: use of annotate in django query

2021-06-02 Thread Eugene TUYIZERE
in brief, I want to transform this query in django query [image: image.png] On Wed, 2 Jun 2021 at 21:56, Eugene TUYIZERE wrote: > Dear Sebatian, > > This is what I get: > > SELECT `crms_customer_requests`.`arrival_date`, > COUNT(`crms_customer_requests`.`request_name

Re: use of annotate in django query

2021-06-02 Thread Eugene TUYIZERE
Dear Sebatian, This is what I get: SELECT `crms_customer_requests`.`arrival_date`, COUNT(`crms_customer_requests`.`request_name`) AS `count` FROM `crms_customer_requests` WHERE `crms_customer_requests`.`arrival_date` >= 2021-05-03 GROUP BY `crms_customer_requests`.`arrival_date` ORDER BY NULL SEL

Re: use of annotate in django query

2021-06-02 Thread Sebastian Jung
Hi Eugene, Please make Print(report.query) then you get SQL querys and Most of time i get an Idea what's wrong Regards Eugene TUYIZERE schrieb am Mi., 2. Juni 2021, 21:41: > Dear Team, > > I need help. I am working on a project where one of the tables is about > requests. I want to have a repo

use of annotate in django query

2021-06-02 Thread Eugene TUYIZERE
Dear Team, I need help. I am working on a project where one of the tables is about requests. I want to have a report of the number of requests on each day in the last 30 days, something like this: [image: image.png]I I used the code below just before displaying on the chart but the code gives me w

Re: Help with a huge database query.

2021-05-31 Thread 'odrzen' via Django users
x27;).filter(state='fresh').only( 'field1', 'field2', 'field3' ) temp_json = serializers.serialize('json', temp) return HttpResponse(temp_json, content_type='application/json') it returns me all the fields! Not only the 'field2&

Re: Help with a huge database query.

2021-05-27 Thread David Nugent
gt; this. > So, I try to find a right way to execute this difficult and "*heavy*" > query/request with a efficient way. > This is what I have achieved so far: > > ``` > #from django.http import HttpResponse, HttpResponseRedirect, JsonResponse > #from django.co

Help with a huge database query.

2021-05-27 Thread 'odrzen' via Django users
Hello Django community o/ I want to create a API call in order to get all data from a specific model ( table ) - but I want to exclude-remove only specific fields from this. So, I try to find a right way to execute this difficult and "heavy" query/request with a efficient way. This

Re: how to use reverse query data from a child model to do arithmetic's in parent model?

2021-03-28 Thread Ryan Nowakowski
On March 28, 2021 1:42:50 AM CDT, Vansh Jagyasi -IIITK wrote: >I have created a model location, and a model transaction which has a >many >to one relation with location which has the information of a >transaction >done at a particular location, say 3 dollars spent at macdonalds, now I > >wan

how to use reverse query data from a child model to do arithmetic's in parent model?

2021-03-28 Thread Vansh Jagyasi -IIITK
I have created a model location, and a model transaction which has a many to one relation with location which has the information of a transaction done at a particular location, say 3 dollars spent at macdonalds, now I want to find all the transactions related to a particular location and add t

Re: View / Query Set not showing with filter

2021-03-19 Thread Héctor Alonso Lozada Echezuría
> W: www.manuelburi.com <http://manuelburi.com/?utm_source=gmail> > > > On Fri, 19 Mar 2021 at 23:22, Héctor Alonso Lozada Echezuría < > ima...@gmail.com> wrote: > >> Can you share your "Booking" model and the view (function or class) that >>

Re: View / Query Set not showing with filter

2021-03-19 Thread Arisophy
Manuel Buri > T: +41 79 933 01 11 > M: manuel.b...@gmail.com > W: www.manuelburi.com <http://manuelburi.com/?utm_source=gmail> > > > On Fri, 19 Mar 2021 at 23:22, Héctor Alonso Lozada Echezuría < > ima...@gmail.com> wrote: > >> Can you share your "Booking

Re: View / Query Set not showing with filter

2021-03-19 Thread Manuel Buri
a las 16:17, Manuel Buri () > escribió: > >> @anornymou...@gmail.com and ima...@gmail.com >> your suggestion is unfortunately not working too >> >> @All: >> So as said my queryset is not empty, meaning that the query works. >> However, t

Re: View / Query Set not showing with filter

2021-03-19 Thread Héctor Alonso Lozada Echezuría
ur suggestion is unfortunately not working too > > @All: > So as said my queryset is not empty, meaning that the query works. > However, the results is not in the rendered HTML file. > This would imply that with my template is something wrong, don't you think? > > {% for office in

Re: View / Query Set not showing with filter

2021-03-19 Thread Manuel Buri
@anornymou...@gmail.com and ima...@gmail.com your suggestion is unfortunately not working too @All: So as said my queryset is not empty, meaning that the query works. However, the results is not in the rendered HTML file. This would imply that with my template is something wrong, don't you

Re: View / Query Set not showing with filter

2021-03-19 Thread Thomas Lockhart
Why use Q? afaict simple filter syntax should get you what you want. Booking.objects.filter(organization_id=request.user.organization_id, booking_time__range= (start_date, end_date)) Not sure if this will get you closer to the query you expect. You might also find it useful to use "./mana

Re: View / Query Set not showing with filter

2021-03-19 Thread Anornymous u
Yes, I this can work On Sat, Mar 20, 2021, 00:17 Héctor Alonso Lozada Echezuría wrote: > I think you should reconsider the query > > context['bookings']=Booking.objects.filter(Q(organization_id=request.user.organization_id), > Q(booking_time__date__gte=start_date), >

Re: View / Query Set not showing with filter

2021-03-19 Thread Héctor Alonso Lozada Echezuría
I think you should reconsider the query context['bookings']=Booking.objects.filter(Q(organization_id=request.user.organization_id), Q(booking_time__date__gte=start_date), Q(booking_time__date__lte=end_date))) El vie, 19 mar 2021 a las 15:14, Héctor Alonso Lozada Echezuría (< ima

Re: View / Query Set not showing with filter

2021-03-19 Thread Héctor Alonso Lozada Echezuría
at 22:07, Anornymous u wrote: > >> I mean what you want to fetch and the conditions >> >> On Fri, Mar 19, 2021, 16:01 Manuel Buri wrote: >> >>> Hi, >>> >>> I am having this query set in my view: >>> context['bookings']=Booking.obje

Re: View / Query Set not showing with filter

2021-03-19 Thread Manuel Buri
_source=gmail> On Fri, 19 Mar 2021 at 22:07, Anornymous u wrote: > I mean what you want to fetch and the conditions > > On Fri, Mar 19, 2021, 16:01 Manuel Buri wrote: > >> Hi, >> >> I am having this query set in my view: >> context[

Re: View / Query Set not showing with filter

2021-03-19 Thread Anornymous u
I mean what you want to fetch and the conditions On Fri, Mar 19, 2021, 16:01 Manuel Buri wrote: > Hi, > > I am having this query set in my view: > context['bookings']=Booking.objects.filter( > Q(organization_id=request.user.organization_id), *Q(booking_time__range

Re: View / Query Set not showing with filter

2021-03-19 Thread Anornymous u
Tell us exactly what you are looking for from your query On Fri, Mar 19, 2021, 16:01 Manuel Buri wrote: > Hi, > > I am having this query set in my view: > context['bookings']=Booking.objects.filter( > Q(organization_id=request.user.organization_id), *Q(booking_t

Re: View / Query Set not showing with filter

2021-03-19 Thread Manuel Buri
01 Manuel Buri wrote: > >> Hi, >> >> I am having this query set in my view: >> context['bookings']=Booking.objects.filter( >> Q(organization_id=request.user.organization_id), *Q(booking_time__range= >> (start_date, end_date))*) >> >> It pro

Re: View / Query Set not showing with filter

2021-03-19 Thread Anornymous u
What is the name of the field, this part that reads range On Fri, Mar 19, 2021, 16:01 Manuel Buri wrote: > Hi, > > I am having this query set in my view: > context['bookings']=Booking.objects.filter( > Q(organization_id=request.user.organization_id), *Q(booking_t

Re: View / Query Set not showing with filter

2021-03-19 Thread Manuel Buri
': 'H'}, {'id': 10, 'account_id': 4, 'organization_id': 11, 'office_id': 1, 'booking_time': datetime.datetime(2021, 3, 21, 0, 0, tzinfo=), 'location': 'H'}]> I am really clueless why this is happening. Do

  1   2   3   4   5   6   7   8   9   10   >