Re: Autocomplete in Django

2017-09-17 Thread Andréas Kühne
That really depends on how you want it to work? I would probably add an item on the dropdown that shows the current items in the database, with "Add city". If the user presses that you can have an AJAX call that adds the item to the database. Regards, Andréas 2017-09-17 6:23 GMT+02:00 Mreno ser

Re: Autocomplete in Django

2017-09-17 Thread Jani Tiainen
Hi. Besides the way Andréas described, there exist autocomplete fields that can accept arbitrary input you can send to backend without having to create special add phase. Adding such functionality of course requires a custom field that can add nonexisting values to database. 17.9.2017 7.40 "Mre

Re: django autocomplete light

2017-09-17 Thread Roman Akopov
Hi, you probably need to filter results based on the value of other fields in the form http://django-autocomplete-light.readthedocs.io/en/master/tutorial.html#filtering-results-based-on-the-value-of-other-fields-in-the-form On Saturday, September 16, 2017 at 3:24:48 PM UTC+4, Ahmet Muazim Tunç

Re: Autocomplete in Django

2017-09-17 Thread Melvyn Sopacua
In particular, you need to override the ModelChoiceField that a ModelForm creates automatically and replace it with a field that is not based on ChoiceField at all or skips it's validation method (like https://github.com/yourlabs/django-autocomplete-light/blob/master/src/dal_select2/fields.py#L34)

Channels architecture for chat application and subscriptions

2017-09-17 Thread Robin Lery
I would like to make a chat application using django and channels. I have two models to achieve a chat like application. 1. Thread - A thread can have list of users. So, it can be used for chat between two users, or groups of user. If it's a group thread, it can have a subject for the

Re: Channels architecture for chat application and subscriptions

2017-09-17 Thread Andrew Godwin
Hi Robin, The most efficient way to do this is to have one WebSocket connection that all the messages are sent down. Have a Group per group-chat and per single-user chat (I would model those as a special case of the group-chat if I were you for simplicity), and when a user connects, add them to th

Re: Autocomplete in Django

2017-09-17 Thread Mreno sert
Thanks for the help...but I do not know ajax. Is there anything simpler like I heard about "create-field" option. Tried it , but not getting it done correctly. On Sunday, September 17, 2017 at 3:00:14 PM UTC+5:30, Andréas Kühne wrote: > > That really depends on how you want it to work? > > I wou

Re: Channels architecture for chat application and subscriptions

2017-09-17 Thread Robin Lery
Thank you, Andrew. Also, after reading more about channels in SO and channel's GitHub and also here in Django-users group