[Fixed]-Selecting values to populate the combobox using Modelform

1👍

in your 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 from the docs :

“It’s important to add str() methods to your models, not only for your own convenience when dealing with the interactive prompt, but also because objects’ representations are used throughout Django’s automatically-generated admin.”

Leave a comment