Wagtail came in the nick of time as we were working on a new project. We had been working with Django CMS, which is an excellent project, but the Wagtail approach and architecture fits our project's use cases much better. Thank you for open-sourcing this!
I'm looking for a sanity check and advice on extending the wagtail admin a bit.
We have a fairly simple model with a handful of fields... most of them CharFields. The model references an image, however, and I'd ideally like to tie it to Wagtail's managed image repository. In a perfect world, the CMS user would be able to edit instances of this non-page model using the wagtail admin, and select/upload/manage the image foreign key the same way and using the same interface as when editing a page.
The model is defined similar to this:
class Foo(models.Model):
some_text = models.CharField(max_length=256, blank=True)
some_more_text = models.CharField(max_length=256, blank=True)
photo = models.ForeignKey(
'wagtailimages.Image',
null=True,
blank=True,
on_delete=models.SET_NULL,
related_name='+'
)
So far, I've used the "register_admin_urls" and "construct_main_menu" hooks to augment the main menu with an entry point to this model. By shamelessly ripping off the code behind wagtail's User index/editing screens, I've even been able to construct a wagtail-looking index/search page and create/editing page. I'm using the "wagtailadmin/shared/field_as_li.html" template to render fields, and I've noticed it doesn't render the image chooser panels.
How feasible is it for me to get the image chooser panel working in my own view/template? Just looking at the page editing code, it seems like I might need to explore the edit_handlers, but I'm wondering if that will introduce a landslide of dependencies that I need to configure and introduce to the request/response flow (dependencies that either shouldn't be public or that I don't have enough wagtail knowledge to handle), or if there's a fairly straightforward process that I'm just ignoring?
Any signposts, advice on alternate approaches, or advice indicating this is just not a road to go down, are most welcome.
Many thanks,
Jarret