;)
if len(status_list) > 0 or len(order_list) > 0:
orders = orders.filter(
Q(status__in=status_list)
| Q(id__in=order_list),
Q(payment_details__status__in=[PaymentStatus.PAY_LATER,
PaymentStatus.CONFIRMED])
)
else:
orders = orders.filter(
Q(status=OrderStatus.UNFULFILLED),
Q(payme
Hi,
I have a raw query which takes in 4 ids within a for loop. It therefore
returns 4 query set results.
I put the result of each query set into a dictionary and append it to a
list.
The result looks something like this:
[{'first_name': u'John'}, {'first_name': u
Invalid field name error
On Fri, 23 Aug, 2019, 11:58 AM Sipum, wrote:
> You can use Queryset like -
>
> course_review_report.objects.select_related('courses')
>
> On Fri, 23 Aug, 2019, 11:07 AM Suraj Thapa FC,
> wrote:
>
>> SELECT *
>> FROM course_review_report LEFT JOIN courses ON course_revie
You can use Queryset like -
course_review_report.objects.select_related('courses')
On Fri, 23 Aug, 2019, 11:07 AM Suraj Thapa FC,
wrote:
> SELECT *
> FROM course_review_report LEFT JOIN courses ON course_review_report.cid =
> courses.cid
>
>
> Can anyone pls write the querryset for the above sq
SELECT *
FROM course_review_report LEFT JOIN courses ON course_review_report.cid =
courses.cid
Can anyone pls write the querryset for the above sql query
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To unsubscribe from this group and stop r
What's in the get_digital_client_summary() function?
On Thu, Oct 6, 2016 at 6:18 AM, Thomas Brightwell <
thomas.brightw...@gmail.com> wrote:
> Hi,
>
> I have a raw query returning one row which is then shown 8 times in the
> template. I have debugged and there is onl
Hi,
I have a raw query returning one row which is then shown 8 times in the
template. I have debugged and there is only one line when this is executed
in the shell and I do a simple for loop print output. So it seems to be
something about the template tags?
The raw query which definitely only
Michal,
Actually, your syntax didn't quite work. It threw a couple of warnings and
seemed to match all records in the database. But you got me on the right
track. This syntax does work properly:
select ... where word like concat('%%', %s, '%%')
Thanks for getting me pointed in the right direc
On Friday, July 8, 2016 at 8:34:00 AM UTC-5, Michal Petrucha wrote:
>
> I may be wrong, but it seems to me that you're using wrong quoting in
> that raw query; I think it should be::
>
> select sortkey, book, chapter, verse, hebrew_text
> from bible_bible
>
de that, and take a look at the
actual SQL query generated for that; maybe it will reveal some oddity.
> I tried a raw query in a custom manager:
>
> class BibleManager(models.Manager):
> def contains_hebrew_word(self, word='דֶּשֶׁא'):
> sql = "&qu
Bible.objects.filter(hebrew_text__contains('דֶּשֶׁא') and I get
nothing back.
I tried a raw query in a custom manager:
class BibleManager(models.Manager):
def contains_hebrew_word(self, word='דֶּשֶׁא'):
sql = """select sortkey, book, chapter, verse
Hi Tobias,
Based on your database query, it looks like you are not doing multiple
table inheritance, but your models are set up for multiple table
inheritance.
https://docs.djangoproject.com/en/dev/topics/db/models/#model-inheritance
Why not just have a status field on your Campaign model? Djan
f.to_native(item)foritem inobj]
File".../env/lib/python3.4/site-packages/rest_framework/serializers.py"in
570.self._data =[self.to_native(item)foritem inobj]
File".../env/lib/python3.4/site-packages/django/db/models/query.py"in__iter__
1553.raiseInvalidQuery('Raw query m
Also, it is worth mentioning that the RawQuerySet object looks to have been
refactored in the latest development release. I have not verified this
issue on the development branch.
On Wed, Sep 24, 2014 at 3:53 PM, James Brewer wrote:
> This is going to depend on the version of Django you're using
This is going to depend on the version of Django you're using. Accord to
the docs for 1.7[1], this should work fine.
After playing around in the shell for a bit, I found I was getting an error
complaining about arguments not being converted during string formatting.
It seems the problem occurs whe
Interesting. I don't use raw queries, but I wonder if Django doesn't
support lists as parameters to raw()
--
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
Hello,
I am constructing raw query which looks like the following:
"SELECT * FROM some_table WHERE id IN (1,3,5);"
So inside my view i write:
entities = Entity.objects.raw("""
SELECT * FROM some_table WHERE id IN (%s);
""", [ids_list])
How should i corr
I want to create series of tables using mysql raw query with multiple lines
in django view.
Please help.
--
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
I've created a paginator for RawQuerySets.
https://github.com/seamusmb/django-paginator-rawqueryset
On Tuesday, March 26, 2013 5:51:41 AM UTC-4, chambe...@gmail.com wrote:
>
> I'm trying to implement Django's built in pagination feature with a raw
> query set. I've
On Fri, Mar 7, 2014 at 3:31 PM, bikeridercz wrote:
> Dear colleagues,
>
> I'm trying to do a direct select do database other than the default one. But
> it fails with error.
>
> Note 1: "ASSETS.objects.using('vodb').filter(...)" works fine
> Note 2: the select is little tricky and unfortunately ca
Dear colleagues,
I'm trying to do a direct select do database other than the default one.
But it fails with error.
Note 1: "ASSETS.objects*.using('vodb')*.filter(...)" works fine
Note 2: the select is little tricky and unfortunately cannot be replaced by
a database view, because I have no acces
Hi,
I think I had something similar and followed this thread:
http://stackoverflow.com/questions/4574609/executing-select-where-in-using-mysqldb
I think this is what Dennis has already said so apologies if it isn't
helpful.
Kindest regards
On Saturday, 16 November 2013 12:40:52 UTC, Thorsten
meter differently -- along with the query string.
MySQL, and most other SQL systems, as I recall, expect to see
... needle in (first, second, ..., last)
MySQLdb sanitizes parameters by converting them to a string
representation, escaping any special characters, and wrapping it is
I am using mysql and when I write it like (1) then I get int is not
iterable on the first one, but the raw works, if I do it like (1,) the
first one works, but the raw one gets again the comma at the end, tried
several ways always one of both not working, for me it looks kinda there
is some mag
On Sat, Nov 16, 2013 at 7:40 AM, Thorsten Sanders
wrote:
> realms=[1]
> data = AuctionData.objects.filter(itemid__exact=itemid,realm__in=realms)
> data2 = AuctionData.objects.raw('SELECT * FROM auctiondata_auctiondata WHERE
> itemid_id=%s AND realm_id in %s ',[itemid,realms])
not sure if it's re
Hello,
wondering if I am doing something wrong or it is a bug, using django
1.5.5, but also tried with 1.6 resulting in the same problem.
When I do the following:
realms=[1]
data = AuctionData.objects.filter(itemid__exact=itemid,realm__in=realms)
data2 = AuctionData.objects.raw('SELECT * FROM
7;m trying to implement Django's built in pagination feature with a raw
> query set. I've researched the issue and the answer is I need to cast my
> set as a list. Something like this:
>
> paginator = Paginator(refg, 100) # Show 100 contacts per page
> paginator._count = len
I'm trying to implement Django's built in pagination feature with a raw
query set. I've researched the issue and the answer is I need to cast my
set as a list. Something like this:
paginator = Paginator(refg, 100) # Show 100 contacts per page
paginator._count = len(list(r
Hey all,
I have the following query:
cursor.execute( "select * from MyTable where Foo=%s or Bar in %s",
[some_id, some_array] )
This seems to work fine if len(some_array) > 1 but it blows up if there are
zero or one items in the array (invalid SQL syntax).
Is there a better way to do this? T
I have used this in a raw query. But it depends on the DB backend of Django.
If I'm remembering correctly, it worked with PostgreSQL/psycopg2, but not
with SQLite/whatever_back_end when I was using it.
Bill
On Sun, Dec 25, 2011 at 3:58 AM, ali alizadeh wrote:
> hi.
>
> in psycop
If you're talking about string formatting operations, Django is just
Python, so %(key)s will work.
Cheers,
AT
On Wed, Dec 28, 2011 at 9:01 AM, ali alizadeh wrote:
>
> hi.
>
> in psycopg module, when composing a query, you can use "%(key)s" in your
> query instead of "%s", and pass a dictionary
hi.
in psycopg module, when composing a query, you can use "%(key)s" in your
query instead of "%s", and pass a dictionary instead of a list for actual
parameter.
django docs mention the "%s" syntax for raw queries. i was just wondering
if the other syntax is supported or not, because it can be han
hi.
in psycopg module, when composing a query, you can use "%(key)s" in your
query instead of "%s", and pass a dictionary instead of a list for actual
parameter.
django docs mention the "%s" syntax for raw queries. i was just wondering
if the other syntax is supported or not, because it can be han
The first link I had seen and used. My custom query works, I had just
been having issues with the tags. I had been through the docs and seen
a different one on tags, but apparently passed over the one you posted
in the link. It filled in some of the gaps I was missing, thanks. Very
helpful.
--
Yo
To use custom SQL see this for reference:
http://docs.djangoproject.com/en/dev/topics/db/sql/
To create a templatetag see this for reference:
http://docs.djangoproject.com/en/dev/howto/custom-template-tags/
On Mon, Jun 14, 2010 at 10:08 PM, Cole743 wrote:
> Hello again,
>
> My last question
Hello again,
My last question may have been unclear, so I'm going to be more
specific.
I want to use the results of this:
cursor.execute("SELECT * from sp_getreport(""varchar"" %s)", [usr])
(or something similar) In a custom template tag to display in a
template. The results of the query are:
a
36 matches
Mail list logo