-
Notifications
You must be signed in to change notification settings - Fork 32
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
RFC 44: Make "Custom models" the default #44
base: main
Are you sure you want to change the base?
Conversation
text/044-image-models.md
Outdated
|
||
### Remove the “Custom image model” advanced topics doc | ||
|
||
We could replace this with a reference document that describes the methods that developers can override to tweak its behaviour. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Something similar would need to be done for the Custom document model documentation page.
Hey, finally got the chance to read this and 100% agree that this would be helpful and enable a lot of future improvements over time. I have also put up an issue on the main repo to add some fields to the image/document models that would be really useful wagtail/wagtail#5658. Finally, I did some analysis of about 78 different document/image models I found on Github projects. This will give a bit of an indicator of the kinds of changes made by developers. https://docs.google.com/spreadsheets/d/1JgrDb5s_ugAnL04r3GOBqh5DodZodqqp3rqrN1sTKpE/edit?usp=sharing The top ten fields added in custom models are:
|
We discussed this as a croe team meeting so I think this is at least stage 2 |
Co-Authored-By: Andy Chosak <[email protected]>
Co-Authored-By: Andy Chosak <[email protected]>
Co-Authored-By: Andy Chosak <[email protected]>
Co-Authored-By: Andy Chosak <[email protected]>
Co-Authored-By: Andy Chosak <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ref wagtail/wagtail#5789 – I’d love to see this happen. There are a few things here I’d like to see changed but they feel pretty minor. In particular more consideration on the app name, whether a rename of the existing models is worthwhile, and consideration to include a custom User
model as well.
custom image model from the start. This change will add a small amount | ||
of extra code to the project template, which I know we would want to | ||
avoid, but I think preventing a potentially arduous migration later | ||
outweighs the overhead of having one extra app in the project. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes!
avoid, but I think preventing a potentially arduous migration later | ||
outweighs the overhead of having one extra app in the project. | ||
|
||
This change also applies to image rendition and document models as well. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this would warrant reflecting in the RFC title.
|
||
### Update the project template to use custom image, rendition, and document models | ||
|
||
We will add a new app called `assets` into the base project template. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to see alternative proposals for what this app should be called, ideally backed with data on what app name real-world projects put those models in.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we used media
(and added custom wagtailmedia classes there as well)
### Remove the "Custom image model" advanced topics doc | ||
|
||
We could replace this with a reference document that describes the | ||
methods that developers can override to tweak its behaviour. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and below – I’m not sure I follow. I’d still call it a custom image model as it’s custom to each project. And the docs would still be useful for the thousands of project that have been existing before the changes suggested here. And the projects that get created without wagtail start
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My proposal here was to remove the option of not having a custom user model as much as possible, so everyone going forward would create one. This is one of the many things new users need to know about when building their first Wagtail project and I wanted to remove this as an option to reduce decision fatigue.
For existing users, we could provide a how-to-guide for "upgrading" to the new favoured approach (while making it clear the old way won't be removed) rather than an "advanced topics" document that implies it's an optional "advanced" feature.
I missed out projects that get created without wagtail start
in this doc, perhaps we should add these models to the "adding to an existing django project" doc as well.
We will add the `assets` app as described in the previous section and | ||
update the fixtures and foreign keys to use this new app. | ||
|
||
### Rename the built-in models to fix naming conflict and discourage their use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I’m not clear on whether the effort suggested here is justified? This feels like a lot of potential busywork.
|
||
To implement this RFC, we will make the following changes: | ||
|
||
### Update the project template to use custom image, rendition, and document models |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we also add a custom User
model, based on the same rationale?
Any chance of a custom Page model :) |
@rgs258 😄 can you say more? |
@thibaudcolas I can elavorate. It would be amazing to have a Swappable Page model, like the user model, so we can add custom fields and other stuff to the base page. Right now we have to fork wagtail and add changes to the base page there. So to have the a custom page model by default, that can inherit from a "AbstractBasePage" would be amazing. Wagtail could work with the AbstractBasePage and people could add whatever they need to their Page Model. |
We briefly discussed this RFC again during the core team meeting today. This RFC needs answers to the remaining comments by Thibaud and we can move this to @kaedroho would you be okay with me taking over this RFC? Or would you rather implement it yourself. |
Rendered