[Answer]-Django: show external data in model based form

1๐Ÿ‘

โœ…

  1. Yes, this is appropriate way.

  2. You need to set value for select/choices field in the dict similar to approach 1.

For example:

COUNTRY_CHOICES = (
    ('IN', 'India'),
    ('US', 'USA'),
    )
    ....
    #model field 
    country = models.CharField(choices=COUNTRY_CHOICES)

# then set it in dict as
u = {}
u['country'] = 'IN'
u['profile_email'] = 'monkey'
u['company_name'] = 'tiger'
u['coc_number'] = 'some number'
u['gender'] = 'M'
...
๐Ÿ‘คRohan

Leave a comment