-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
☂️ Adopt generic class based views across all areas of admin (epic) #8365
Comments
Created three new issues, these would be very helpful to streamline the efforts on UX Unification (GSoC) but not critical |
Thanks for this @lb-!! I feel like we should drop the styleguide from this, since that view just needs to render a template and I don't think any of our generic views will help with this. Also, simple translation doesn't contain any index/create/edit/delete views so it might not make much sense to make this one generic either. Modeladmin might be tricky since the way it implements search, filtering and customising the listing is very different to how the generic views currently/will work. If we need to change modeladmin's API in order to make it fit generic views better, I don't think this would be worth it. W plan to make model viewsets easier to use so developers could switch to that if they want this API. |
PR for reports index that relates to this. Thanks @laymonage ! |
@kaedroho I have descoped (no longer has checkboxes) the ModelAdmin and styleguide ones and re-grouped these into a low priority section. Keeping them listed for completeness - hope that is ok. Let me know if you are aware of any other views in Wagtail that should adopt the shared classes approach. |
* Use Wagtail generic views in contrib.settings * Relates to wagtail#8365
Note - there is now an RFC for further enhancements to the viewsets system. Update. This RFC has been closed. |
Can I clarify what this means? I'm not sure what is meant here. |
@Temidayo32 at the time of creation of this issue, viewsets were still new-ish and didn't support a full range of views. The viewsets system is now quite capable of probably covering all these use cases. It's also a public facing API. See https://docs.wagtail.org/en/stable/reference/viewsets.html |
@lb- Thanks for the response.
I intend to work on this above. So if I understand you, |
@Temidayo32 yep. I think that's what we would want to do now. |
@lb- Alright. Thanks for the clarification |
Hi @thibaudcolas @laymonage , I intend working on this issue |
@Chidera6 incidentally, I'm trying to get started on the one for redirects |
That would be very nice @Chiemezuo but I think @Temidayo32 is working on that issue you selected. |
@Temidayo32 @Chidera6 @Chiemezuo just a heads’up we consider this all to be relatively advanced as far as Wagtail contributions go. If you don’t have pre-existing experience with Django and with class-based views, I would recommend you focus on other possible contributions. If you do have this expertise… go for it! As you approach this please take ample time reviewing other pull requests done in this space, so you get to see how the contributions that we accepted were made. |
Thank you @lb- |
@Chidera6 Are you still working on |
I am interested @lb- |
Yes, I am still working on it @Temidayo32 |
@Temidayo32 - I think @tony-nyagah else has already started (image url generator views) so it's best to avoid conflicting PRs for now. |
Hi @lb- I know Django and would like to contribute to this issue. Can you let me know what is available to avoid any conflicts with the current allocated tasks? |
@lb- can you please clarify what is meant by ad-hoc class based views. Perhaps a link to one would be helpful. Thanks. |
@Temidayo32 - please note that this issue was created well before the Outreachy program was scoped and before a lot of the recent (last six months) refactoring of Snippets and model viewsets was done. However, generally, my initial specification for this issue was based on our introduction of more useful view classes that were used throughout Wagtail. This includes the Wagtail admin mixins, the model generic views and the viewsets system. Some earlier class based views may have been ad-hoc, as in they did not use the shared generic views within Wagtail's code. Instead they would have been built upon Django's classed based views. Migration needs to be assessed on a case by case basis though. Sometimes we do not need more than the Django base classes go do what's needed. But once we start dealing with models/objects - the Wagtail ones will replace a lot of the boilerplate needed for a consistent UI. I hope that helps add some context, I do expect that once the Outreachy program starts that this issue will be closed / revised. Along with a new, clearer migration schedule based on a review of what's used throughout the admin currently. The main goals here are to:
|
Hello @lb- , May i work on this? |
@rohitsrma - go for it. I don't think @Temidayo32 made progress on the Image url generator views and this is still up for grabs. |
- Relates to wagtail#8365 (class based views migration)
- Relates to #8365 (class based views migration)
Reviewing this today, I see the following three items would still need refactoring:
@laymonage I believe you might be working on refactoring all three areas as part of Universal listings continued – how do you think those CBV refactorings fit with those UX improvements? I imagine they go hand in hand? |
Redirects has a PR up #11035 |
@lb- , I'm working on refactoring |
@lb- it looks like the last remaining bit on this is the simple translation view ( Thank you for putting it together and guiding folks. And to everyone that contributed so far ⭐ 🌟 |
Thanks all! #11762 only covers the index view so there are still some other views in the redirects contrib module to be refactored. Same with the search promotions in #11661 (there is #11731). Not sure about the exact scope of this issue but there are still some views that are function-based and could use some refactoring, although they are not as prominent so we might only consider them as nice-to-haves. Although, it would be cool to at least make them extend
Not included, mostly straightforward/intermediary views
I think that's it but I might've missed a few. If anyone is keen to continue the work: if you're not familiar with the recent adoption of generic views (with breadcrumbs etc.), I highly recommend starting off with one view first. Iterate on a PR until you get a sense of how the generic views and templates work and how they're used throughout the admin. Once you get a PR in, and have a good sense of the views and templates, refactoring multiple related views in the same PR is fine. Recent examples:
Also, some of the views that have been migrated to use class-based views may not already:
So there are still work to be done for such views. To add, some of the views already extend the generic ones but haven't been wrapped in a viewset. These include:
A recent example of wrapping such views in a viewset can be seen in: |
It> ☂️ This is an epic / umbrella issue
Description
Implementation (core) - high priority
Implementation (contrib) - medium priority
wagtail/contrib/forms/views.py
SafePaginateListView
into a shared mixinwagtail/contrib/settings/views.py
wagtail/contrib/search_promotions/views.py
viewset
wagtail/contrib/redirects/views.py
viewset
wagtail/contrib/simple_translation/views.py
Implementation (contrib) - low priority
These areas may not be needed but adding here for completeness without checkboxes. We will likely either not do these ever or split these out to future issues.
wagtail/contrib/modeladmin/views.py
wagtail/contrib/styleguide/views.py
Additional context
The text was updated successfully, but these errors were encountered: