Websocket connection failed: Error during WebSocket handshake: Unexpected response code: 200

2018-06-24 Thread flora . xiaoyun . huang
Hi I am deploying a website with a live discussion feature. But people cannot send nor receive messages on this discussion page. In the console it shows: "WebSocket connection to 'ws:///room1/' failed: Error during WebSocket handshake: Unexpected response code: 200" I don't know where t

Re: Channels 2.0, How can I configure the channels 2.0 to use with the default django's views

2018-06-24 Thread Andrew Godwin
I'm not quite sure what you mean - Channels will still serve Django views as well unless you override HTTP serving as well as WebSocket, and even then, you can follow the URLRouter docs to keep it working fine: http://channels.readthedocs.io/en/latest/topics/routing.html#urlrouter Andrew On Thu,

Re: post_save signal is not dispatched

2018-06-24 Thread Melvyn Sopacua
On zondag 24 juni 2018 15:45:47 CEST Dejan Spasić wrote: > def post_save_user(**kwargs: Dict[str, Any]) -> None: > if kwargs['created']: > return None So for new users, you bail out and do nothing. Your code works exactly as you wrote it. -- Melvyn Sopacua -

Re: Channels 2.0 close code and http response status

2018-06-24 Thread Andrew Godwin
I'm not quite sure - WebSockets do have browser differences. You could also try adding a delay between the accept and the close to see if that changes how they handle it. Andrew On Sun, 24 Jun 2018, 06:02 Kirill Tyushchakov, wrote: > Hi, Andrew! Thanks a lot for your response. > I've changed my

Re: post_save signal is not dispatched

2018-06-24 Thread Dan Tagg
Hi, Weirdly, I've just been doing this. What do you have in your settings INSTALLED_APPS? One of them should be something like 'employer.apps.EmployerConfig' alternatively in your employer module's __init__.py file you need to say default_app_config = 'employer.apps.EmployerConfig' Dan On 24 Ju

post_save signal is not dispatched

2018-06-24 Thread Dejan Spasić
I don't wont to bother you with a long text and will first show you the code. I think this should be self explanatory. If not, let me know :) # from typing import Any, Dict from django.apps import AppConfig from django.db.models.signals import post_save from django.contrib.

how to add radiobuttons to my ModelForm

2018-06-24 Thread Saloni Kalra
I wish to add radio buttons fill in each parameter of my model and also to convert it to integer on the backend. But somehow its not changing. Kindly help. Thanks and regards, Saloni *Forms.py* class PostForm(forms.ModelForm): class Meta: fields = ("teacher","subject","param1","para

Re: ValueError at /feedback/by/feedback/new Cannot assign "": "Feedback.user" must be a "User" instance.

2018-06-24 Thread Saloni Kalra
Alright! Thanks much! On Sun, 24 Jun 2018, 6:56 pm Melvyn Sopacua, wrote: > On zaterdag 23 juni 2018 21:10:27 CEST Saloni Kalra wrote: > > Thank you for your reply. I removes all the migrations and dropped the > > database. Now when I try to make migrations i get the following error in > my > >

Re: ValueError at /feedback/by/feedback/new Cannot assign "": "Feedback.user" must be a "User" instance.

2018-06-24 Thread Melvyn Sopacua
On zaterdag 23 juni 2018 21:10:27 CEST Saloni Kalra wrote: > Thank you for your reply. I removes all the migrations and dropped the > database. Now when I try to make migrations i get the following error in my > terminal. > Thanks and regards, > Saloni > > *Error:* > accounts.User.user_ptr: (field

Re: Channels 2.0 close code and http response status

2018-06-24 Thread Kirill Tyushchakov
Hi, Andrew! Thanks a lot for your response. I've changed my consumer's connect method like this: def connect(self): user = self.scope.get('user') super(NotificationsConsumer, self).connect() if user.is_anonymous: self.close(code=4003) I've tested it in Chrome, Firefox, Safar

Re: how to pass the current user in reverse_lazy()

2018-06-24 Thread Saloni Kalra
Thanks much! On Sun, 24 Jun 2018, 5:50 pm Daniel Ale, wrote: > Great. > > On Sun, Jun 24, 2018, 13:18 Saloni Kalra > wrote: > >> Yes it did! Thanks much! >> >> On Sunday, 24 June 2018 17:14:31 UTC+5, Daniel Ale wrote: >>> >>> Override the get_success_url(self) instead... That will work >>> >>>

Re: how to pass the current user in reverse_lazy()

2018-06-24 Thread Daniel Ale
Great. On Sun, Jun 24, 2018, 13:18 Saloni Kalra wrote: > Yes it did! Thanks much! > > On Sunday, 24 June 2018 17:14:31 UTC+5, Daniel Ale wrote: >> >> Override the get_success_url(self) instead... That will work >> >> On Sun, Jun 24, 2018, 07:13 Saloni Kalra wrote: >> >>> *DeleteView:* >>> >>> c

Re: how to pass the current user in reverse_lazy()

2018-06-24 Thread Saloni Kalra
Yes it did! Thanks much! On Sunday, 24 June 2018 17:14:31 UTC+5, Daniel Ale wrote: > > Override the get_success_url(self) instead... That will work > > On Sun, Jun 24, 2018, 07:13 Saloni Kalra > wrote: > >> *DeleteView:* >> >> class DeletePost(LoginRequiredMixin, SelectRelatedMixin, >> generic.

Re: how to pass the current user in reverse_lazy()

2018-06-24 Thread Daniel Ale
Override the get_success_url(self) instead... That will work On Sun, Jun 24, 2018, 07:13 Saloni Kalra wrote: > *DeleteView:* > > class DeletePost(LoginRequiredMixin, SelectRelatedMixin, > generic.DeleteView): > username = self.object.user.username > model = models.Post > select_relat

Re: prevent AppConfig.ready() from running twice

2018-06-24 Thread Mike Dewhirst
On 23/06/2018 6:17 PM, Melvyn Sopacua wrote: On zaterdag 23 juni 2018 02:01:06 CEST Mike Dewhirst wrote: Is there a python singleton pattern which might work? No, cause the startup is done in 2 different processes which do not share state. So both processes will have a "new singleton". This is