-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve consistency of how views in ModelAdmin are initialised #12
Labels
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
In modeladmin, there's a bit of inconsistency in how the views are initialised. There's a distinction between 'Instance specific' views (those that sub-class
wagtail.contrib.modeladmin.views.InstanceSpecificView
) and the other views.Really, there's no need for the
__init__()
method of InstanceSpecificView to be any different to that ofWMABaseView
(the only important thing for modeladmin views at initialisation is the linking to a ModelAdmin instance). Theinstance_pk
should be provided todispatch()
instead, and dealt with appropriately there. This would give us:action_view()
methods on theModelAdmin
class (as currently being proposed in Simplify adding new views to ModelAdmin #10) without having to add special treatment for certain actions.HttpRequest
object, so we could reuseModelAdmin.get_queryset()
to get a base queryset from which to search for an instance, rather than just using the default manager'sget_queryset()
method.The only thing I'm not sure about is backwards compatibility / deprecation, since we're currently telling people in the docs to copy from current examples to implement custom views... so that's potentially a big issue.
Any input / thoughts from others would be much appreciated.
The text was updated successfully, but these errors were encountered: