Re: Cumulative Sum per month

2020-03-05 Thread krnrrr
what do you mean by "cumulative"? if we have aggregate sums like jan = 100 feb = 150 mar = 120 you want to have output as jan = 100 feb = 250 mar = 370 ? -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop

[django-channels] How to close websocket connection from server?

2020-04-06 Thread krnrrr
we have django 2.0.4 and channels 2.1.7 in production. And now users must have only open 1 session allowed. (when a user logs in the second time, the first open websocket connection must be closed). I'm out of ideas on how to do it. AFAIK, `websocket.disconnect` must be sent from the client, and

Re: [django-channels] How to close websocket connection from server?

2020-04-06 Thread krnrrr
or maybe any example of "superuser with groups: he can list all connections and close them if he likes"-type of application. All i found was some types of chats, but none of them included some kind of "chat-admin" with management of the rooms and visitors -- You received this message because y

Re: [django-channels] How to close websocket connection from server?

2020-04-06 Thread krnrrr
well, how I see it: - a user can subscribe to any amount of groups during the lifecycle of his JWT - how can I get a list these groups in the first place? so to be able to "send a message to an appropriate group"? I thought there's a way to decode JWT, get user ID from it and then somehow: cha

Re: [django-channels] How to close websocket connection from server?

2020-04-06 Thread krnrrr
thank you for the help. I need to try it out. i think it's more down the "tell-clients-to-tell-me-to-close" route which i wanted to escape. however, i still don't understand how i can get ALL connections of a user knowing only his token. i mean, when i have an event in the system, i want to not

Re: [django-channels] How to close websocket connection from server?

2020-04-19 Thread krnrrr
i gave it another shot and still don't get it. when I connect the first time i have: - browser A which serves as a source of "connect" command - AsyncJsonWebsocketConsumer which handles group_add, accepting incoming socket and setting the "connection A" when I have a call from the other browser

Re: [django-channels] How to close websocket connection from server?

2020-04-19 Thread krnrrr
another thing I managed to think of is send specific message to a specific room of a user, like: async_to_sync(channel_layer.group_send)("238", {"type": "send_text", "text": "close"}) and check in consumer's handler: async def send_text(self, event): if event == "close":

Re: I have a problem concerning duplicate adminfields

2020-04-20 Thread krnrrr
i bet the problem is that your ProductAdmin and BlogPostAdmin also inherit from PageAdmin and you use list in fieldsets. so what is happeing is that you mutate the same instance of list for all subclasses and thus create duplicates -- You received this message because you are subscribed to the