Skip to content
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

Introduce an AbstractPage class to allow base page fields to be customised per-project #836

Open
gasman opened this issue Nov 28, 2014 · 4 comments

Comments

@gasman
Copy link
Collaborator

gasman commented Nov 28, 2014

Proposed here: https://groups.google.com/d/msg/wagtail/4459qj1tNiU/rpaxthnn16MJ

@alexgleason
Copy link
Contributor

I'm still not convinced this is necessary, but I have seen an implementation which could work.

Puput (a Wagtail blog app) has a mechanism which lets you extend the entry page model. It works because the EntryPage model extends an abstract model which can be overridden in settings.

Migrations also have to be accounted for, since by default they would be placed directly into the global Python module directory for wagtail/wagtailcore. Puput asks you to override your MIGRATION_MODULES Django setting to make EntryPage migrations occur in a local project folder. More info on this is in the docs.

@SmileyJames
Copy link

SmileyJames commented Aug 23, 2019

Django Oscar has many models that can be overridden. It may be beneficial to look at their implementation: https://github.com/django-oscar/django-oscar

Any abstract_models.py file is a good place to start looking.

+1 for this feature (regardless of implementation)

@bergran
Copy link

bergran commented Aug 20, 2020

Hello, I was looking for this feature in the documentation before. I was writing a proposal but I don't know why I search again for issues and got lucky! :)

now the proposal and why:

Is your proposal related to a problem?

At this time I'm trying to make special categories for search in elastic search, this could be made by content_type but my categories have some special requirements with extra fields, so... I finally decide to make my category and relate to Page (wagtailcore.Page). It's easy if I do it with M2M but Page class is very close, nobody can write an additional field like a foreign key or another field as global scope for all my pages. In my case, I want to make (1:N) with my category where one page has only one category but one category can be on many pages.

How I said before I will use this for search and group by field this in the project logic

Describe the solution you'd like

My possible solution is not new, Django provides a setting for using your user with the minimum fields that's Django needs for example for auth. You can see more info here

Then if you make it the same way, you can provide an AbstractPage with the same fields and we can modify the model without conflicts.

in this way, Django needs to get this model at the first app contact to generate migrations. and create util for getting the page to centralize the model for all plugins and own new pages. for example get_page_class()

If you read before comments and google group comments, you can see people need to custom his page model, can we discuss again this issue?

Thank you

@sonnybaker
Copy link

Hi @bergran! A very late response I know but I opened an RFC for this last year if you have any comments you'd like to add: wagtail/rfcs#53

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants