python - Django - Autocomplete_Light's "Add Another" popup declares: "'initial' is an invalid keyword argument for this function" -


i working on getting "add another" popup work django-autocomplete_light.

following along in docs:

http://django-autocomplete-light.readthedocs.org/en/latest/addanother.html

i have set urls:

import autocomplete_light.shortcuts al  almondking.financiallogs import models almondking.financiallogs import forms  urlpatterns = [     url(r'^branches/autocreate/$', al.createview.as_view(         model=models.companybranch, form_class=forms.companybranch),         name='branch_autocreate'), ] 

and autocomplete_light_registry.py

al.register(companybranch,     search_fields=['^branch_name'],     attrs={         'placeholder': 'branch',         'data-autocomplete-minimum-characters': 1,     },     widget_attrs={         'data-widget-maximum-values': 1,         'class': 'modern-style',     },     add_another_url_name='company:branch_autocreate', ) 

however, when click plus sign add new related object, following error:

typeerror @ /company/branches/autocreate/

'initial' invalid keyword argument function

i've been trying find way while , i'm close!

now, hoping can read traceback , me understand went wrong:

environment:   request method: request url: http://localhost:8000/company/branches/autocreate/?_popup=1&winname=id_branch  django version: 1.8.2 python version: 3.4.3 installed applications: ('django.contrib.admin',  'django.contrib.auth',  'django.contrib.contenttypes',  'django.contrib.sessions',  'django.contrib.messages',  'django.contrib.staticfiles',  'almondking.inventorylogs',  'almondking.financiallogs',  'almondking.akgenius',  'autocomplete_light') installed middleware: ('django.contrib.sessions.middleware.sessionmiddleware',  'django.middleware.common.commonmiddleware',  'django.middleware.csrf.csrfviewmiddleware',  'django.contrib.auth.middleware.authenticationmiddleware',  'django.contrib.auth.middleware.sessionauthenticationmiddleware',  'django.contrib.messages.middleware.messagemiddleware',  'django.middleware.clickjacking.xframeoptionsmiddleware',  'django.middleware.security.securitymiddleware',  'almondking.akgenius.middleware.requireloginmiddleware')   traceback: file "c:\users\adam\envs\almondking\lib\site-packages\django\core\handlers\base.py" in get_response   132.                     response = wrapped_callback(request, *callback_args, **callback_kwargs) file "c:\users\adam\envs\almondking\lib\site-packages\django\views\generic\base.py" in view   71.             return self.dispatch(request, *args, **kwargs) file "c:\users\adam\envs\almondking\lib\site-packages\django\views\generic\base.py" in dispatch   89.         return handler(request, *args, **kwargs) file "c:\users\adam\envs\almondking\lib\site-packages\django\views\generic\edit.py" in   245.         return super(basecreateview, self).get(request, *args, **kwargs) file "c:\users\adam\envs\almondking\lib\site-packages\django\views\generic\edit.py" in   205.         form = self.get_form() file "c:\users\adam\envs\almondking\lib\site-packages\django\views\generic\edit.py" in get_form   74.         return form_class(**self.get_form_kwargs()) file "c:\users\adam\envs\almondking\lib\site-packages\django\db\models\base.py" in __init__   480.                 raise typeerror("'%s' invalid keyword argument function" % list(kwargs)[0])  exception type: typeerror @ /company/branches/autocreate/ exception value: 'initial' invalid keyword argument function 

try this:

    add_another_url_name='company:branch_autocreate',      add_another_url_name='branch_autocreate', 

Comments

Popular posts from this blog

html - Outlook 2010 Anchor (url/address/link) -

javascript - Why does running this loop 9 times take 100x longer than running it 8 times? -

Getting gateway time-out Rails app with Nginx + Puma running on Digital Ocean -