-- 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
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
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
thanks that worked
On Monday, March 30, 2020 at 7:49:07 PM UTC+5:30, Suraj Thapa FC wrote:
>
> Sorry its like this...
> posts.objects.values('id', 'details', 'user__name' )
>
> On Mon, 30 Mar 2020, 7:46 pm Suraj Thapa FC, > wrote:
>
>> posts.model.values('id', 'details', 'user__name' )
>>
>> On
Sorry its like this...
posts.objects.values('id', 'details', 'user__name' )
On Mon, 30 Mar 2020, 7:46 pm Suraj Thapa FC, wrote:
> posts.model.values('id', 'details', 'user__name' )
>
> On Mon, 30 Mar 2020, 5:26 pm Anoop Thiparala,
> wrote:
>
>> I need help with a django query...I have two
posts.model.values('id', 'details', 'user__name' )
On Mon, 30 Mar 2020, 5:26 pm Anoop Thiparala, wrote:
> I need help with a django query...I have two models
>
> 1)* POSTS*
> ==>id
> ==>details
> ==>user(foreign key to user table)
>
> 2) *USER*
> ==>id
> ==>email
> ==>name
>
> *SQL VERSION:*
I need help with a django query...I have two models
1)* POSTS*
==>id
==>details
==>user(foreign key to user table)
2) *USER*
==>id
==>email
==>name
*SQL VERSION:* SELECT POSTS.ID, POSTS.DETAILS, USER.NAME FROM POSTS, USER
WHERE POSTS.USER == USER.ID;
I require these details in the same
Thanks for the recommendation. The raw SQL method worked for me. Would be good
to know how to accomplish this using the Django ORM query set.
Basically I have a list of games, the user may choose to update the name for
example and instead of the object being updated a new object is created
I think you could consider using raw sql,
https://docs.djangoproject.com/en/2.2/topics/db/sql/#executing-custom-sql-directly
On Fri, Oct 25, 2019 at 7:56 PM Cheda me wrote:
> Hey guys,
>
> I have worked out the SQL query I would like to implement but am currently
> struggling to create the
Please post the code of Model and explain what do you want as Queryset?
On Fri, 25 Oct 2019 at 17:26, Cheda me wrote:
> Hey guys,
>
> I have worked out the SQL query I would like to implement but am currently
> struggling to create the Django query. I have been attempting to use the
>
Hey guys,
I have worked out the SQL query I would like to implement but am currently
struggling to create the Django query. I have been attempting to use the
.aggregate() & Max() methods but cant seem to get the right result. Any
help is much appropriated.
SELECT temp.*
FROM item_detail temp
Hi,
On this question only I took some step deep and able to find out one part
and need your help on the second half.
This requires a good understanding of Django annotation and subquery
features
If you have this thank for reading and helping me in advance
I am facing problem to filter calls on
Account /Lead Model
account_name
contact m2m realtion
contact Model
name
phone No
calls Model
caller no # person phone no who is calling
agent no # person who is picking the call (CRM user)
status
timestamp
duration
calls model is populated with
Right now its an open ended question.
If you post code for your models here, someone can help you.
On Thu, Jun 6, 2019, 4:38 PM Devender Kumar wrote:
> Hi,
> I am working on CRM project and stuck with REPORTING part.
>
> I have Accounts , Lead , contact, Calls ,Concern modules
> account/Lead
Hi,
I am working on CRM project and stuck with REPORTING part.
I have Accounts , Lead , contact, Calls ,Concern modules
account/Lead can have multiple contacts
contacts have multiple calls and concerns
calls have different status like Incoming outgoing missed call etc
Question
I need to
You'll probably need to post some code snippets; what do these functions'
signatures look like and how do they get called?
On Tuesday, 7 August 2018 03:43:01 UTC+2, Gerald Brown wrote:
>
> I have a Django/Python function that creates a Reportab PDF file based on
> the current date. Works GOOD.
I have a Django/Python function that creates a Reportab PDF file based on
the current date. Works GOOD. Now I want to pass any date to that function
and have it create a PDF based on the new date.
I tried creating another function that generates the date (yesterday) but
I am not able to pass
https://stackoverflow.com/questions/45145257/how-write-advance-django-orm-query
--
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-user
Hi,
I have the following models defined:
from django.db import models
class IssuedCard(models.Model):
plan_type = models.CharField(max_length=255)# This is actually
a ForeignKey
apn = models.CharField(max_length=255) # This is actually
a Choice
#
I am unable to generate ORM query for given SQL query. I have posted this
question on
stackoverflow at
http://stackoverflow.com/questions/34745199/django-orm-for-given-group-by-sql-query-with-aggregation-method-sum-and-count
Please help me on that.
Thanks in advance.
--
You received
t;>>> event pages, each event page can be tagged (using taggit), and I want to
>>>>> produce a list of distinct tags used in the events that belong to that
>>>>> event index on the index itself. I'm using the Django CMS Wagtail, but I
>>>>> guess this i
;> In my models I have an event index page type, which can have child
>>>> event pages, each event page can be tagged (using taggit), and I want to
>>>> produce a list of distinct tags used in the events that belong to that
>>>> event index on the index itse
> pages, each event page can be tagged (using taggit), and I want to produce
>>> a list of distinct tags used in the events that belong to that event index
>>> on the index itself. I'm using the Django CMS Wagtail, but I guess this is
>>> really a Django ORM query
jango CMS Wagtail, but I guess this is
>> really a Django ORM query question. I''ve got some code as part of my model
>> which is working but I don't think it's the most efficient way of doing
>> this. Still trying unlearn doing things with SQL and learn how the same
>&g
want to produce
> a list of distinct tags used in the events that belong to that event index
> on the index itself. I'm using the Django CMS Wagtail, but I guess this is
> really a Django ORM query question. I''ve got some code as part of my model
> which is working but I don't think
this is
really a Django ORM query question. I''ve got some code as part of my model
which is working but I don't think it's the most efficient way of doing
this. Still trying unlearn doing things with SQL and learn how the same
thing should be done in Django.
My code as part of the event index
On Thursday, 12 April 2012 at 10:47 PM, Andre Terra wrote:
> On Thu, Apr 12, 2012 at 10:01 AM, David (mailto:cthl...@gmail.com)> wrote:
> > Log.objects.distinct('thing__id').order_by('thing__id',
> > '-modified_on').select_related().filter(thing__deleted=0)[:20]
> >
> >
On Thu, Apr 12, 2012 at 10:01 AM, David wrote:
> Log.objects.distinct('thing__id').order_by('thing__id',
> '-modified_on').select_related().filter(thing__deleted=0)[:20]
>
> By avoiding the use of values() I was able to then use the result as an
> object and access everything
On Apr 12, 4:01 pm, David wrote:
> The above ORM statement however does not look as elegant to read as I have
> come to expect from Django though. The resulting SQL doesn't seem too
> shabby however.
.distinct(fields) + .order_by() is pretty low level stuff - that is
why it
Thank you akaariai
That put me on the right track.
Log.objects.distinct('thing__id').order_by('thing__id',
'-modified_on').select_related().filter(thing__deleted=0)[:20]
By avoiding the use of values() I was able to then use the result as an
object and access everything I needed.
The above
12.4.2012 11:51, David kirjoitti:
Hi Jani
That was very helpful. Is there a way to include select_related into
that query? or do I have to list every single field I would like to
return using values()?
last_deleted = ModificationLog.objects.values('thing__id', ' thing
__prefix', ' thing
On Apr 12, 11:52 am, David wrote:
> > Hi Jani
>
> > That was very helpful. Is there a way to include select_related into that
> > query? or do I have to list every single field I would like to return using
> > values()?
>
> > last_deleted =
>
> Hi Jani
>
> That was very helpful. Is there a way to include select_related into that
> query? or do I have to list every single field I would like to return using
> values()?
>
> last_deleted = ModificationLog.objects.values('thing__id', '
> thing__prefix', ' thing __first_name', '
Hi Jani
That was very helpful. Is there a way to include select_related into that
query? or do I have to list every single field I would like to return using
values()?
last_deleted = ModificationLog.objects.values('thing__id', '
thing __prefix', ' thing __first_name', ' thing__last_name', '
11.4.2012 23:47, David kirjoitti:
Thanks for your reply. I am grateful for your help. If you remember this
question when you feel less sleepy I'd be very interested to see the inner join
alternative :)
Thanks again
Well, after good night sleep I've some idea.
Something like should do the
Thanks for your reply. I am grateful for your help. If you remember this
question when you feel less sleepy I'd be very interested to see the inner join
alternative :)
Thanks again
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this
Hi,
You're not doing anything wrong. The catch is that since "Thing" can exist
without Log you will get outer join.
If you want to get along with inner join, you should turn query around and
start querying from Log model. I'm just too tired to think how it should be
done right now... =)
On
class Log(models.Model):
thing = models.ForeignKey(Thing)
context = models.CharField(max_length=255)
action = models.CharField(max_length=255)
modifier = models.ForeignKey(User, limit_choices_to={'groups__in':
[2]})
modified_on = models.DateTimeField(auto_now=True)
class
Hi Jirka,
Am 01.03.2011 21:44, schrieb Jirka Vejrazka:
this does not seem to me like something you would be able to do
using SQL (or Django ORM) only. I would guess that you'll have to
write a bit of Python code that will walk through the entries and
detect those that are different from
Hi Carsten,
this does not seem to me like something you would be able to do
using SQL (or Django ORM) only. I would guess that you'll have to
write a bit of Python code that will walk through the entries and
detect those that are different from "previous"
Cheers
Jirka
--
You received
Dear Django list,
after a very good start with Django and it's excellent documentation,
I've come now across a problem that neither my SQL nor my Django
knowledge is sufficient to solve, so I'd like to ask for your kind help.
The (simplified) Django model is
class Erfasst(models.Model):
Or, using range:
MyModel.objects.filter( Q(a__range=(1,5)) | Q(b__range=(20,70)) )
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to django-us...@googlegroups.com.
To unsubscribe from this group, send email
http://docs.djangoproject.com/en/dev/topics/db/queries/#complex-lookups-with-q-objects
MyModel.objects.filter( ( Q(a__gt=1) & Q(a__lt=5) ) | ( Q(b__gt=20) &
Q(b__lt=70) ) )
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group,
On 13 April 2010 01:09, zweb wrote:
> how do i do this kind of condition in django orm filter:
>
> ( 1 < a < 5) or ( 20 < b < 70)
>
> select * from table where (a between 1 and 5) or (b between 20 and 70)
>
> --
> You received this message because you are subscribed to
how do i do this kind of condition in django orm filter:
( 1 < a < 5) or ( 20 < b < 70)
select * from table where (a between 1 and 5) or (b between 20 and 70)
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email
On Wed, 2009-03-25 at 16:01 -0700, Kedare wrote:
> Hello,
> I'm here because i need to know if the following feature will be
> included in the futures releases of django (if yes, what release ?) or
> why are they missing ?
> -- REAL Query cache (like in ruby on rails), very useful if you have
>
>> To my knowledge most of the core
>> developers feel that a full identity mapper isn't appropriate for Django.
Why ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group,
On Wed, Mar 25, 2009 at 7:01 PM, Kedare wrote:
>
> Hello,
> I'm here because i need to know if the following feature will be
> included in the futures releases of django (if yes, what release ?) or
> why are they missing ?
> -- REAL Query cache (like in ruby on rails), very
Hello,
I'm here because i need to know if the following feature will be
included in the futures releases of django (if yes, what release ?) or
why are they missing ?
-- REAL Query cache (like in ruby on rails), very useful if you have
redundant SQL request (like multiple recursive requests by
Sorry for the self-followup, but I got the right bits of extra. My actual
case was a bit more complicated than my example below (it involved a
fourth model), but it's working now - and much quicker than w/ the IN
directive. Thanks.
On Fri, 6 Mar 2009, Jeff Gentry wrote:
> On Fri, 6 Mar 2009,
W dniu 06.03.2009 20:06, Jeff Gentry pisze:
> On Fri, 6 Mar 2009, Malcolm Tredinnick wrote:
>
>>> Bob.objects.filter(foo=myFoo).filter(blah__in=myBlahs)
>>>
>> Seems like the best (and obvious) way to me.
>>
>
> Gotcha.
>
>
>> Yes it does. As written, your models have no
On Fri, 6 Mar 2009, Malcolm Tredinnick wrote:
> > Bob.objects.filter(foo=myFoo).filter(blah__in=myBlahs)
> Seems like the best (and obvious) way to me.
Gotcha.
> Yes it does. As written, your models have no ordering requirements. That
> complete lack of constraint is preserved perfectly. :-)
W dniu 06.03.2009 01:24, Malcolm Tredinnick pisze:
> On Thu, 2009-03-05 at 18:48 -0500, Jeff Gentry wrote:
>
>> Suppose I have three models (in pseudocode):
>>
>> class Foo:
>> asdf = models.CharField()
>>
>> class Blah:
>> qwerty = models.CharField()
>>
>> class Bob:
>> foo =
On Thu, 2009-03-05 at 18:48 -0500, Jeff Gentry wrote:
> Suppose I have three models (in pseudocode):
>
> class Foo:
>asdf = models.CharField()
>
> class Blah:
>qwerty = models.CharField()
>
> class Bob:
>foo = models.ForeignKey(Foo)
>blah = models.ForeignKey(Blah)
>
> Given a
Suppose I have three models (in pseudocode):
class Foo:
asdf = models.CharField()
class Blah:
qwerty = models.CharField()
class Bob:
foo = models.ForeignKey(Foo)
blah = models.ForeignKey(Blah)
Given a Foo and a list of Blahs (where the length of the list might be
very small (0-10)
55 matches
Mail list logo