Re: Use an aggregation function's filter with aggregate of a value from an annotation with a subquery

2018-12-16 Thread Daniel Gilge
!! Daniel > Am 06.12.2018 um 16:31 schrieb Daniel Gilge : > > Hi everyone, > > @Matthew and @Simon Thanks for your answers! > >> I assume you are trying to work >> around the cross join of multiple table annotations? > > This is correct. > >> There&

Re: Use an aggregation function's filter with aggregate of a value from an annotation with a subquery

2018-12-06 Thread Daniel Gilge
r=votes_filter), > ).filter( > votes_count__gte=4 > ).count() > > That should result in > > SELECT COUNT(*) FROM ( > SELECT 1 > FROM comment > LEFT OUTER JOIN vote ON (vote.comment_id = comment.id > <http://comment.id/>) > GROUP

Use an aggregation function's filter with aggregate of a value from an annotation with a subquery

2018-12-05 Thread Daniel Gilge
Hi, I think I've found a bug. But I'm not sure and I never opened a ticket for Django before. So, I first wanted to ask here. I'm using Django 2.0 and this doesn't work: subquery = Subquery( Vote.objects .filter(comment=OuterRef('pk')) .values('value')[:1] ) Comment.objects.annotat

Re: Use SQLite file database for tests (and not in-memory)

2018-03-10 Thread Daniel Gilge
E': 'test_database', }, }, } Thanks! Am Samstag, 10. März 2018 22:05:27 UTC+1 schrieb Daniel Gilge: > > Hi, > > *Introduction:* > > Django uses an in-memory database for testing > <https://docs.djangoproject.com/en/2.0/topics/

Use SQLite file database for tests (and not in-memory)

2018-03-10 Thread Daniel Gilge
Hi, *Introduction:* Django uses an in-memory database for testing when it finds a SQLite database in the settings. However, the ChannelsLiveServerTestcase (of Channels 2.0) cannot be used with an in-memory dat

Handle changing users (e.g. a logout) in a scope/WebSockets

2018-02-18 Thread Daniel Gilge
Packages: Channels 2.0, Django 2.0 Hi, When I understand it correctly a scope’s user object isn’t updated when a user changes (e.g. logs in or out in another window) for the whole lifetime of the scope. (Please correct me if I am wrong.) Now this can be a serious issue as you can imagine. Wha

Re: Channels 2.0 WebSocket demultiplexing

2018-02-07 Thread Daniel Gilge
https://github.com/django/channels/issues/825> > > Andrew > > On Wed, Feb 7, 2018 at 1:53 AM, Daniel Gilge <mailto:d.gi...@gmail.com>> wrote: > Hi, > > how do you demultiplex in Channels 2.0 using WebSockets? > > I want to use a single WebSocket co

Re: Testing Channels database data missing in Consumer

2018-02-07 Thread Daniel Gilge
m Mittwoch, 7. Februar 2018 04:31:14 UTC+1 schrieb Andrew Godwin: > > I'm not quite sure either. Does the test setup work if you are not in > async mode? > > Andrew > > On Tue, Feb 6, 2018 at 9:45 AM, Daniel Gilge > wrote: > >> Hi, >> >> this quest

Channels 2.0 WebSocket demultiplexing

2018-02-07 Thread Daniel Gilge
Hi, how do you demultiplex in Channels 2.0 using WebSockets? I want to use a single WebSocket connection and be able to address different models according to the path. Daniel -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe fro

Testing Channels database data missing in Consumer

2018-02-06 Thread Daniel Gilge
Hi, this question is related to Channels 2.0, Django 2.0, pytest 3.4, pytest-django 3.1 and pytest-asyncio 0.8. I created a pytest: @pytest.fixture def db_with_obj(db): factories.MyModelFactory() @pytest.mark.asyncio async def test_something(db_with_obj): print(models.MyModelFactory.ob