django-ajax-selects==1.4.x is needed for django==1.9.x, but it doesn't seem to work with AutoCompleteSelectMultipleField

Issue #71 duplicate
Boyd Johnson created an issue

I can't seem to get the settings.POSTMAN_AUTO_COMPLETER_APP['field']='AutoCompleteSelectMultipleField' feature to work. You mention in the docs django-ajax-selects==1.3.x but according to their docs only 1.4.x works with django==1.9.x.

An error I'm seeing is in postman.fields in clean with this data:

value   

['1004']

name_user_as    

'pk'

user_model  

<class 'django.contrib.auth.models.User'>

errors  

[]

__class__   

<class 'postman.fields.BasicCommaSeparatedUserField'>

users   

[<User: BoydJohnson23845>]

unknown_names   

{'1004', 1004}

names   

['1004']

self    

<postman.fields.CommaSeparatedUserField object at 0x7f1478a2ce80>

If names was [1004] instead of ['1004'] it would work out, but it doesn't.

I'm not sure, but ajax-selects=1.4.x release notes say that there are no more conversion of values by the widget--Previous releases would try to convert the primary key submitted from the Widget into either an integer or string, depending on what it looked like.

I could be wrong, though.

Comments (3)

  1. Boyd Johnson reporter

    This is a solution to my particular problem. I overwrote def clean on the CommaSeperatedUserField and added this line:

    names = [int(n) for n in names]
    
  2. Patrick Samson repo owner
    • changed status to open

    The problem is not related to the version of django-ajax-selects, but to the usage of POSTMAN_NAME_USER_AS.

  3. Log in to comment