django - Selecting values to populate the combobox using Modelform -


i want country names in list can set it source of dropdown.

my modelform class looks below

class userextform(modelform):     countries = countries.objects.values('countryname').filter(countryname__isnull = false)      class meta:      model = userextras      fields=['phone','aboutme','countries'] 

i trying fill countries object country names, when html form displayed dropdown filled text 'countries object'. please me pointing out here.

thank much

in models.py

from django.db import models  class article(models.model):     countries = models.charfield(max_length=200) //whatever      def __str__(self):              # __unicode__ on python 2         return self.countries 

taken the docs :

"it’s important add str() methods models, not own convenience when dealing interactive prompt, because objects’ representations used throughout django’s automatically-generated admin."


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 -