Re: Autocomplete in Django 1.11: Widget in Forms Library?

2016-10-11 Thread James Pic
On Tue, Oct 11, 2016 at 2:20 PM, Johannes Hoppe 
wrote:
>
> At the current point I don't see how we could add a more generic widget to
> Django outside of the admin. This would require ether a manual registration
> of models as autocomplete light does it, or another approach that doesn't
> rely on Django cache.
>

In DAL v3 there is no need for model registration. Autocomplete widgets do
take a URL as argument though.

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CALC3Kaf8_E6eeHatLn2kn1KO%3Dp3Bwwm%3DO6d5Z0DE_81Qwb8Zww%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Autocomplete in Django 1.11: Widget in Forms Library?

2016-10-11 Thread Johannes Hoppe
Hi there!

Regarding reusing the admin widget:
I would advice highly against it. It made for the admin and requires models 
to be registered there. It would be better to use django-select2, which is 
where the autocomplete_fields are originating from.

At the current point I don't see how we could add a more generic widget to 
Django outside of the admin. This would require ether a manual registration 
of models as autocomplete light does it, or another approach that doesn't 
rely on Django cache.
The only way I see at the moment, is if Widget.render() would be aware of 
the request. This way one could use the session as a persistent storage.
This is a bigger design decision tho.


On Tuesday, September 20, 2016 at 12:51:24 PM UTC+2, guettli wrote:
>
> I am happy that there will be support for autocomplete in the admin in 
> 1.11, if this issue/pull-request gets resolved:
>
> https://code.djangoproject.com/ticket/14370
>
> https://github.com/django/django/pull/6385/
>
> I looked at the changes of the docs of this pull request.
>
> It seems that only the contrib module "admin" gets improved.
>
> Is it planed to add an autocomplete widget in the django forms library?
>
>
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/5ffe26b8-11d0-47c9-afab-3d7512adc3e5%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Autocomplete in Django 1.11: Widget in Forms Library?

2016-09-30 Thread Tim Graham
I was thinking about a similar issue when looking at Curtis's patch for an 
admin HStoreField widget [0]. It doesn't seem so nice to give 
contrib.postgres special treatment in the admin. Rather, I think the admin 
should have a hook to register custom widgets for arbitrary fields. If it 
provided that, I wonder if the autocomplete patch [1] could more easily be 
done as a third-party library.

[0] https://github.com/django/django/pull/6515
[1] https://github.com/django/django/pull/6385

On Friday, September 30, 2016 at 1:20:21 PM UTC-4, Collin Anderson wrote:
>
> Hi,
>
> "it could be possible to provide such a widget in contrib.admin".
>
> The current PR provides a django.contrib.admin.widgets.AutocompleteSelect 
> widget. Does that work?
>
> You could subclass it to use a different URL instead of the built-in 
> admin:autocomplete url if needed. My one worry is that if we end up adding 
> more code to handle use cases different from the admin, we'll just end up 
> re-inventing and maintaining django-select2. But, maybe simply re-using the 
> widget or subclassing the widget is good enough?
>
> Thanks,
> Collin
>
>
> On Wed, Sep 21, 2016 at 6:28 AM, guettli  
> wrote:
>
>>
>>
>> Am Dienstag, 20. September 2016 13:30:33 UTC+2 schrieb Tim Graham:
>>>
>>> I haven't seen that proposal. This type of widget would be new territory 
>>> for django.forms as none of the existing widgets require JavaScript. I lean 
>>> toward keeping things that way, but I'm open to hearing counterarguments. 
>>> Historically, Django avoided "blessing" any particular JavaScript libraries.
>>>
>>
>>
>> OK, I see you don't want widgets which require JS in django core. I can 
>> understand this.
>>
>> But since contrib.admin includes the autocomplete, it could be possible 
>> to provide such a widget in contrib.admin. 
>>
>> My intention: since the admin includes JS for autocomplete, it would be 
>> nice to re-use this in custom apps.
>>
>> I know that I can use third party libraries to get this. But if it is 
>> already in contrib.admin, it would be nice to avoid duplication
>>
>>
>>  
>>
>>> On Tuesday, September 20, 2016 at 6:51:24 AM UTC-4, guettli wrote:

 I am happy that there will be support for autocomplete in the admin in 
 1.11, if this issue/pull-request gets resolved:

 https://code.djangoproject.com/ticket/14370

 https://github.com/django/django/pull/6385/

 I looked at the changes of the docs of this pull request.

 It seems that only the contrib module "admin" gets improved.

 Is it planed to add an autocomplete widget in the django forms library?



 -- 
>> 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-develop...@googlegroups.com .
>> To post to this group, send email to django-d...@googlegroups.com 
>> .
>> Visit this group at https://groups.google.com/group/django-developers.
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/django-developers/a4411d55-6db2-4515-b680-0b8dfe03a3bd%40googlegroups.com
>>  
>> 
>> .
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/a578f1c5-3e1f-4cbc-bbc4-b05d4832121b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Autocomplete in Django 1.11: Widget in Forms Library?

2016-09-30 Thread Collin Anderson
Hi,

"it could be possible to provide such a widget in contrib.admin".

The current PR provides a django.contrib.admin.widgets.AutocompleteSelect
widget. Does that work?

You could subclass it to use a different URL instead of the built-in
admin:autocomplete url if needed. My one worry is that if we end up adding
more code to handle use cases different from the admin, we'll just end up
re-inventing and maintaining django-select2. But, maybe simply re-using the
widget or subclassing the widget is good enough?

Thanks,
Collin


On Wed, Sep 21, 2016 at 6:28 AM, guettli  wrote:

>
>
> Am Dienstag, 20. September 2016 13:30:33 UTC+2 schrieb Tim Graham:
>>
>> I haven't seen that proposal. This type of widget would be new territory
>> for django.forms as none of the existing widgets require JavaScript. I lean
>> toward keeping things that way, but I'm open to hearing counterarguments.
>> Historically, Django avoided "blessing" any particular JavaScript libraries.
>>
>
>
> OK, I see you don't want widgets which require JS in django core. I can
> understand this.
>
> But since contrib.admin includes the autocomplete, it could be possible to
> provide such a widget in contrib.admin.
>
> My intention: since the admin includes JS for autocomplete, it would be
> nice to re-use this in custom apps.
>
> I know that I can use third party libraries to get this. But if it is
> already in contrib.admin, it would be nice to avoid duplication
>
>
>
>
>> On Tuesday, September 20, 2016 at 6:51:24 AM UTC-4, guettli wrote:
>>>
>>> I am happy that there will be support for autocomplete in the admin in
>>> 1.11, if this issue/pull-request gets resolved:
>>>
>>> https://code.djangoproject.com/ticket/14370
>>>
>>> https://github.com/django/django/pull/6385/
>>>
>>> I looked at the changes of the docs of this pull request.
>>>
>>> It seems that only the contrib module "admin" gets improved.
>>>
>>> Is it planed to add an autocomplete widget in the django forms library?
>>>
>>>
>>>
>>> --
> 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+unsubscr...@googlegroups.com.
> To post to this group, send email to django-developers@googlegroups.com.
> Visit this group at https://groups.google.com/group/django-developers.
> To view this discussion on the web visit https://groups.google.com/d/
> msgid/django-developers/a4411d55-6db2-4515-b680-
> 0b8dfe03a3bd%40googlegroups.com
> 
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/CAFO84S4V7fwyuOCB-LXfUnfFFfaQkQKyMM4%2B8V0UXQUHg4BesA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Autocomplete in Django 1.11: Widget in Forms Library?

2016-09-21 Thread guettli


Am Dienstag, 20. September 2016 13:30:33 UTC+2 schrieb Tim Graham:
>
> I haven't seen that proposal. This type of widget would be new territory 
> for django.forms as none of the existing widgets require JavaScript. I lean 
> toward keeping things that way, but I'm open to hearing counterarguments. 
> Historically, Django avoided "blessing" any particular JavaScript libraries.
>


OK, I see you don't want widgets which require JS in django core. I can 
understand this.

But since contrib.admin includes the autocomplete, it could be possible to 
provide such a widget in contrib.admin. 

My intention: since the admin includes JS for autocomplete, it would be 
nice to re-use this in custom apps.

I know that I can use third party libraries to get this. But if it is 
already in contrib.admin, it would be nice to avoid duplication


 

> On Tuesday, September 20, 2016 at 6:51:24 AM UTC-4, guettli wrote:
>>
>> I am happy that there will be support for autocomplete in the admin in 
>> 1.11, if this issue/pull-request gets resolved:
>>
>> https://code.djangoproject.com/ticket/14370
>>
>> https://github.com/django/django/pull/6385/
>>
>> I looked at the changes of the docs of this pull request.
>>
>> It seems that only the contrib module "admin" gets improved.
>>
>> Is it planed to add an autocomplete widget in the django forms library?
>>
>>
>>
>>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/a4411d55-6db2-4515-b680-0b8dfe03a3bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Autocomplete in Django 1.11: Widget in Forms Library?

2016-09-21 Thread Florian Apolloner
Ups sorry I hit send to fast. Datalists also do not work for multiple 
select afaik and worst of all there is no support in Safari etc… Our widget 
has to work everywhere more or less.

On Wednesday, September 21, 2016 at 8:25:53 AM UTC+2, Florian Apolloner 
wrote:
>
>
>
> On Wednesday, September 21, 2016 at 6:21:15 AM UTC+2, Cheng Chi wrote:
>>
>> What about dynamic content datalist 
>>  instead 
>> of complex autocomplete UI by JS libraries? We can use just jQuery or 
>> vanilla JS to make some AJAX requests and change datalist on the go.
>>
>
> Cause it simply does not scale if you have more than a few entries. 
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/e3039eed-95cc-4ab2-8a2e-dc2a9db2421e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Autocomplete in Django 1.11: Widget in Forms Library?

2016-09-21 Thread Florian Apolloner


On Wednesday, September 21, 2016 at 6:21:15 AM UTC+2, Cheng Chi wrote:
>
> What about dynamic content datalist 
>  instead 
> of complex autocomplete UI by JS libraries? We can use just jQuery or 
> vanilla JS to make some AJAX requests and change datalist on the go.
>

Cause it simply does not scale if you have more than a few entries. 

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/ffc67bcd-b6b7-48a3-8e9a-fcf09cbb9d77%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Autocomplete in Django 1.11: Widget in Forms Library?

2016-09-20 Thread Cheng Chi
What about dynamic content datalist 
 instead 
of complex autocomplete UI by JS libraries? We can use just jQuery or 
vanilla JS to make some AJAX requests and change datalist on the go.

On Tuesday, September 20, 2016 at 9:30:33 PM UTC+10, Tim Graham wrote:
>
> I haven't seen that proposal. This type of widget would be new territory 
> for django.forms as none of the existing widgets require JavaScript. I lean 
> toward keeping things that way, but I'm open to hearing counterarguments. 
> Historically, Django avoided "blessing" any particular JavaScript libraries.
>
> On Tuesday, September 20, 2016 at 6:51:24 AM UTC-4, guettli wrote:
>>
>> I am happy that there will be support for autocomplete in the admin in 
>> 1.11, if this issue/pull-request gets resolved:
>>
>> https://code.djangoproject.com/ticket/14370
>>
>> https://github.com/django/django/pull/6385/
>>
>> I looked at the changes of the docs of this pull request.
>>
>> It seems that only the contrib module "admin" gets improved.
>>
>> Is it planed to add an autocomplete widget in the django forms library?
>>
>>
>>
>>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/dd7c84fd-b51c-482a-913a-dd3bd6ccf33c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Autocomplete in Django 1.11: Widget in Forms Library?

2016-09-20 Thread Tim Graham
I haven't seen that proposal. This type of widget would be new territory 
for django.forms as none of the existing widgets require JavaScript. I lean 
toward keeping things that way, but I'm open to hearing counterarguments. 
Historically, Django avoided "blessing" any particular JavaScript libraries.

On Tuesday, September 20, 2016 at 6:51:24 AM UTC-4, guettli wrote:
>
> I am happy that there will be support for autocomplete in the admin in 
> 1.11, if this issue/pull-request gets resolved:
>
> https://code.djangoproject.com/ticket/14370
>
> https://github.com/django/django/pull/6385/
>
> I looked at the changes of the docs of this pull request.
>
> It seems that only the contrib module "admin" gets improved.
>
> Is it planed to add an autocomplete widget in the django forms library?
>
>
>
>

-- 
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+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/6d4ace0b-bfeb-4617-ab9f-78cf314727ab%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.