1

The results I'm getting is none after it renders the context in the HTML file, but it works fine in the admin panel, any clue why this is happening and how I can solve it

models.py

GENRE_CHOICES = (
    ("1", "Action"),
    ("2", "Adventure"),
    ("3", "Animation"),
    ("4", "Comedy"),
)
class movies(models.Model):
    Genre = MultiSelectField(choices=GENRE_CHOICES)

views.py

def home(request):
    return render(request,
                  template_name='main/home.html',
                  context={"movies": movies.objects.all})

home.html

{% for m in movies %}
    <li>{{m.Genre}}</li>
{% endfor %}

what the result looks like: [1]: https://i.stack.imgur.com/lUVfe.png It should return two valid choices instead of none, none

riderken
  • 99
  • 20
  • it works when I name the keys the same as the choices but I don't know why it's not working with the numbers, any clues why? – riderken May 15 '20 at 23:02

0 Answers0