Is there a specific reason Djangos QuerySet does not implement
__contains__? It doesn't seem very complicated to me, but maybe I'm missing
something.
When checking if an object is in e queryset I always use code lite this:
if queryset.filter(pk=obj.pk).exists():
The pythonic way would be:
if ob
Hello Johan,
You explained the upside. There's one downside to be aware of. If you already
fetched the queryset, `if obj in queryset` will make a new database query,
which will be slower than walking through the already fetched data (unless the
queryset is really large and the database really c
>
> If you already fetched the queryset, `if obj in queryset` will make a new
> database query
I don't see why we couldn't implement __contains__ to do a walk through
_result_cache if it has been fetched?
On Tue, 2 Jun 2020 at 10:13, Aymeric Augustin <
aymeric.augus...@polytechnique.org> wrote:
Hi all.
Calendar Week 22 -- ending 31 May.
Preparation for 2.2.13 and 3.0.7 releases.
Triaged:
https://code.djangoproject.com/ticket/31635 -- SameSite cookie except on a
URL (wontfix)
Reviewed:
https://github.com/django/django/pull/12978 -- Refs #31040, Refs #31224 --
Prevented cycl
On Tuesday, June 2, 2020 at 11:28:34 AM UTC+2, Adam Johnson wrote:
>
> If you already fetched the queryset, `if obj in queryset` will make a new
>> database query
>
>
> I don't see why we couldn't implement __contains__ to do a walk through
> _result_cache if it has been fetched?
>
we are doing
> On 2 Jun 2020, at 13:30, Florian Apolloner wrote:
>
> On Tuesday, June 2, 2020 at 11:28:34 AM UTC+2, Adam Johnson wrote:
> If you already fetched the queryset, `if obj in queryset` will make a new
> database query
>
> I don't see why we couldn't implement __contains__ to do a walk through
>
It may help to know that QuerySet.__contains__() was implemented until
Django 1.6 when chunked reads were removed from QuerySet iteration:
https://github.com/django/django/commit/70679243d1786e03557c28929f9762a119e3ac14
On Tuesday, June 2, 2020 at 7:43:25 AM UTC-4, Aymeric Augustin wrote:
>
> O
Hi,
Here are some performance numbers against a local SQLite in case any
one is interested. GL has about 40,000 records for reference.324 was
just a random number chosen, of different 'in's
>>> sys.version'3.7.2rc1 (default, Dec 12 2018, 06:25:49) \n[GCC
8.2.0]'>>> django.__version__'3.0.6'>>> im
And here's some past discussion:
https://code.djangoproject.com/ticket/24141 - contains() method for
QuerySets (closed as needsinfo due to no mailing list discussion to find a
consensus)
https://github.com/django/django/pull/3906 - Efficient
QuerySet.__contains__ (closed as wontfix due to the be
My 2 cents, I think @johan's suggestion makes sense.
if obj in queryset:
It's very pythonic. it should do what __len__ does and cache it, if you
want the single quick db query you can always use exists().
ps @roger
>>> timeit.timeit('m.GL.objects.filter(pk=x.pk)', setup='import
myapp.models
Hi folks,
I recently ran into an issue around the SESSION_COOKIE_DOMAIN and
CSRF_COOKIE_DOMAIN settings that seems like it could be fixable by adding
some extensibility.
Before submitting a patch/PR, I wanted to get the community's opinion on
whether this is worth addressing in the framework,
> On 2 Jun 2020, at 19:42, Tim Graham wrote:
>
> And here's some past discussion:
> https://code.djangoproject.com/ticket/24141 - contains() method for QuerySets
> (closed as needsinfo due to no mailing list discussion to find a consensus)
> https://github.com/django/django/pull/3906 - Efficient
Week ending May 31, 2020.
*Triaged:*
https://code.djangoproject.com/ticket/31617 - Improve overall admin
accessibility. (Someday/Maybe)
https://code.djangoproject.com/ticket/31622 - Support CREATE CONSTRAINT
TRIGGER constraints in postgres. (wontfix)
https://code.djangoproject.com/ticket/31620 -
On Tue, 2020-06-02 at 11:31 -0700, Javier Buzzi wrote:
> ps @roger
>
> >>> timeit.timeit('m.GL.objects.filter(pk=x.pk)', setup='import
> myapp.models as m;x = m.GL.objects.all()[324]', number=100)
> 0.05818330496549606
>
> is not doing anything, add a `.exists()` or `len(..)` or something to
> ev
You can already achieve what you're aiming to do in an outer middleware by
mutating the cookie in response.cookies. The cookie object can have its
domain changed before it is sent to the client:
>>> from django.http import HttpResponse
>>> resp = HttpResponse()
>>> resp.set_cookie('foo', 'bar', do
hello for everyone
?how can i use from vuejs in django
--
You received this message because you are subscribed to the Google Groups
"Django developers (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-developers+u
Hello!
The answer is "yes", but this question was asked on a wrong mailing list.
Consider writing to Django users mailing lists.
Regards,
Kacper
śr., 3 cze 2020 o 00:06 P.E.A.K.A. napisał(a):
> hello for everyone
> ?how can i use from vuejs in django
>
> --
> You received this message because
Uh, sorry, I haven't noticed that the question was "how", dummy me. There
are several ways to do this, as I wrote consider asking on proper mailing
list, this one is focused on developing Django framework itself.
Regards,
Kacper
śr., 3 cze 2020 o 00:20 Kacper Szmigiel
napisał(a):
> Hello!
>
> T
Hi!
I think you've found the wrong mailing list for this post. This mailing
list is for discussing the development of Django itself, not for support
using Django. This means the discussions of bugs and features in Django
itself, rather than in your code using it. People on this list are unlikely
t
19 matches
Mail list logo