﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
27273	Make usage of construct_change_message easier outside of admin	Alexey Rogachev	nobody	"I use [https://github.com/etianen/django-reversion django-reversion] library in one of my projects. In admin it uses `ModelAdmin`'s change message generated by `construct_change_message` method as revision comment. Besides admin I also need to generate same change message on object creation / editing on frontend part of a site.

Using `construct_change_message` outside of admin is now possible like that:

{{{#!python
from django.contrib.admin import AdminSite
from enterprises.admin import EnterpriseAdmin

comment = EnterpriseAdmin(enterprise, AdminSite).construct_change_message(request, form, formsets, create)
}}}

`enterprise` is either created or edited model, `create` - boolean variable (`True` when create and `False` otherwise).

I think it's not clean to refer to admin from frontend like that.

As a suggestion, we can move the method outside of a class. It does not use `self` also.

Another option is to make this method static, but this will just reduce a bit of code, and problem of referring from frontend to admin will still present.
"	Uncategorized	new	contrib.admin	dev	Normal		admin, form		Unreviewed	0	0	0	0	0	0
