Admin action drop-down 'required' preventing saving updates

Skip to first unread message


Feb 18, 2021, 1:01:01 AMFeb 18
to Mezzanine Users

Hi all,

This is possibly a Django-2.2.18 related problem, but I thought I'd see if anyone else has experienced this and had a workaround.

I recently updated my website to Mezzanine 5.0.0a1 and Django 2.2.18, and after some reasonably thorough local testing, deployed it to the live website.

One of my fellow admins discovered something odd, which I've now confirmed on both local and deployed sites.

At the top of an Admin change list page, there's the standard action drop down (usually containing 'Delete selected <Model name>'). This is useful when you want to select some objects and delete them, but otherwise I've not customised it for any of the standard Mezzanine/Cartridge models I use.

What's now odd is that if you hit the 'Save' button at the bottom of the object list, a generic prompt pops up saying 'Please select an item in the list' pointing to this action drop down.

After some research, I discovered the following:

a) this pop up message is generic from HTML5, for a <select> form element that has the 'required' attribute:

b) this 'required' attribute is being added to the <select> element when the page is rendered, but only when DEBUG=False. That is, on my local development with DEBUG=True, the select element is not required (and Save works fine), but if I modify my local settings and set DEBUG=False, then required is forced on this element, and I get the same pop up as seen on the deployed server.

I've tried digging into the Django code to try and find out what's happening to render this field, but it seems to be fairly benign:

grapelli-safe template that renders the action drop down:

django code that is the action form:

I'm not sure where the ChoiceField is being forced to required=True when DEBUG=False, nor how I can override this.

Any one got any ideas? Have you noticed this on your own deployments using Mezzanine 5.0.0a1?

Thanks for any help,

Seeya. Danny.

Daniel Montecillo

Feb 18, 2021, 10:05:07 AMFeb 18
to Mezzanine Users

Have you tried checking one of the forms used in the templates?
You can check there if required is explicitly declared.


    selection = forms.CharField(
        widget=forms.ChoiceField(attrs={"class": "form-control", "type": "text", }),
You received this message because you are subscribed to the Google Groups "Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
To view this discussion on the web visit
publickey - - 5be7637f.asc


Feb 18, 2021, 9:55:19 PMFeb 18
to Mezzanine Users
Hi again everyone,

I think I finally got to the bottom of my problem.

The Select widget  used for this admin dropdown *does* have the 'required' attribute by default, but there's Mezzanine javascript that removes this from this specific location in admin pages:

In my case, the problem was that my website was hitting a Javascript error earlier on and thus this line wasn't executing properly or being skipped entirely. Part of this was that I had an old set of javascript files etc in 'static' on my webserver leftover from using Mezzanine 4.3.

Among other things,  I was missing the new jQuery version used by Mezzanine 5.0.0a1 and when I checked the developer console in my browser I could see a bunch of JS errors.

I manually ran python collectstatic, restarted the server, and now things appear to be working as expected.

So a word of advice for anyone else hitting similar upgrade issues: check the developer console in your browser for javascript errors, and make sure you have run collectstatic when you deploy!

Seeya. Danny.
Reply all
Reply to author
0 new messages