How to fill dropdown on Django from database?

I am trying to fill up a dropdown on a form and the data is from database

// ERROR: unsupported operand type(s) for +=: 'ModelChoiceIterator' and 'tuple'

    for x in MyModel.objects.values_list(
        self.fields['mymodel'].widget.choices += ((, '%s - %s' % (,,)

// I've tried, but it doesnt work

    for x in MyModel.objects.all():
        self.fields['mymodel'].widget.choices += ((, '%s - %s' % (,,)

What am I doing wrong?

Thank you

I am getting the date from database, the problem is, it retrieves an error when append to choices


simple_list = []    
for item in MyModel.objects.all():
    simple_list.append([, f"{} - {}"])

self.fields['mymodel'].widget.choices = simple_list
Back to Top