Django — MediaDefiningClass object is not iterable


For me, the cause of this error was sending arguments to the register function in the wrong order.

Check the order of registering a ModelAdmin: it’s the model class first, then the ModelAdmin class.

Example:, ModelAdmin)

I suppose naturally the second one has to be the ModelAdmin since register(MyModel) works as well. That’s one good way to think about it.

17 thoughts on “Django — MediaDefiningClass object is not iterable

  1. I got this error too, but had no idea what was causing it, because nothing looked wrong in my It’s not the problem that drives you insane, it’s finding the resolution for it 🙂

  2. This was at the top of the search for “‘MediaDefiningClass’ object is not iterable” and is the obvious solution! Thanks, it was nice not having to stress over a an Error Page for once!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s