django-select2-forms

128 views
Skip to first unread message

shahab emami

unread,
May 2, 2017, 6:16:47 AM5/2/17
to Django users
hello

I want to use django-select2-forms in my project . this package is here:
https://pypi.python.org/pypi/django-select2-forms/2.0.1

I followed the exact instructions but It does not install
here is things I did:

1:  
pip install django-select2-forms


          I can see select2 has been installed in my site package
2:   I added this line to my_installed_packages in settings.py:
 
           'select2',


3:  I added this line to main urls.py:
        
       url(r'^select2/', include('select2.urls')),



after that i put this models in my models.py they are from it's example:



class Author(models.Model):
    name
= models.CharField(max_length=100)

   
def __str__(self):
       
return self.name

class Entry(models.Model):
    author
= select2.fields.ForeignKey(Author,
        overlay
="Choose an author...",
        on_delete
=models.CASCADE)

but when i run :
python manage.py makemigrations

I get this error:
    author = select2.fields.ForeignKey(Author,
NameError: name 'select2' is not defined

I searched for this but i could not find anything.
would you help me please?
thanks

  

Dartos

unread,
May 2, 2017, 9:29:37 AM5/2/17
to Django users
Hi,

Do you have "import select2" in models.py?

Dartos
Reply all
Reply to author
Forward
0 new messages