I am running Django 3.0 and using Chrome Version 80.0.3987.132 (Official
Build) (64-bit) and Firefox version 74 (64-bit). I have a select box on an
admin change page for a model, and the correct value from the database is
shown this way on the html source page generated by django:

<option value="228">Frank</option>
<option value="8" selected>Sam</option>
<option value="19">Henry</option>

However, the page is displayed in both browsers, Chrome and Firefox, with
the default value "Pick one of the people", as if nothing has been
selected. If I select another value from the drop down list, it is
correctly inserted into the database, but the html on the admin change page
still does not have selected="selected" in the correct option, but just the
word 'selected' as shown above.

I was looking online at the correct way to select an option in an option
list, and it seems the correct (X)HTML way is to use selected="selected" in
the option tag. Why is Django generating the old HTML way with just the
word 'selected' in the option tag? Is there a way to fix this, or is this a
bug in django or my browsers?

I am not using any javascript or css on this select box. Just plain vanilla
django 3.0 reading a value from the database for the admin change page. Not
my page template, but plain vanilla django admin templates.

Thanks!

Mark

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAEqej2PS14cq%3DD%2BwD7SeKyyi0Zg5%3D9s3cX%2BmNThCZyzvN89i2Q%40mail.gmail.com.

Reply via email to