torchbox/wagtail — pull request #886 by kaedroho (2014-12-23 12:23:41+00:00)
Title: get_image_form now takes model parameter

I've recently been working on a project that uses multiple image models.

Implementing this was surprisingly easier than I thought. I created a custom image model and copied the wagtailimages views folder into a new app (searching and replacing ``get_image_model()`` with my new model name). The chooser and ``{% image %}`` tag works as expected with both image models.

There was a little annoyance where the ``get_image_form`` function calls ``get_image_model`` internally requiring me to duplicate the forms.py module to fix this. Everywhere this function is called, the image model is already known so it's simply a case of passing that model through as a parameter.

This PR doesn't add support for multiple image models into Wagtail, just makes it slightly easier. Even though this isn't useful for most people, I think this gives a minor code-quality improvement for Wagtail.