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

WIP make content models swappable, closes #1160 #1935

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Commits on Aug 3, 2019

  1. WIP make content models swappable, closes stephenmcd#1160

    (It's marked as WIP because tests are far from passing, and we can
    always discuss the coding style and naming.)
    
    Any of the following models can now be swapped by your own version:
    
    * Page
    * RichTextPage
    * Link
    * BlogPost
    * BlogCategory
    * Form
    * FormEntry
    * Field
    * FieldEntry
    * Gallery
    * GalleryImage
    
    So you can keep the same features and API but add fields, methods, inherit from
    other classes (geo models for geo fields, third-party models...), etc.
    without having to resort to model inheritance.
    
    Just make sure you inherit from each respective abstract base class.
    
    Contrary to my first submission, I kept the BaseXXX classes for a
    smoother transition path.
    
    I didn't change imports or references in the admin modules, I followed
    UserAdmin conventions here. You'll have to explicitly register, e.g.  PageAdmin
    to your swapped Page model.
    
    No docs update yet, let's first agree on code and naming conventions, what will
    become the public API for users. This includes whether we provide
    default values in the template project settings or in the code.
    
    I also guess this deprecates the field injection feature, before removing it in
    a future major version.
    
    Besides that, it must be 100% compatible, no test changes apart from imports.
    Hervé Cauwelier committed Aug 3, 2019
    Configuration menu
    Copy the full SHA
    e7c8a7a View commit details
    Browse the repository at this point in the history