-
Notifications
You must be signed in to change notification settings - Fork 11
Collections
↑ Parent: Tutorials
MagiCircles' most powerful feature is the collections, or "MagiCollections".
In programming terms, MagiCollections are the equivalent of CRUD views (Create, Read, Update, Delete).
Pretty much everything in MagiCircles is represented using a collection.
Collections are the link between a database table and its views. It also handles some logic like routing and permissions.
Collections should be used to represent game elements such as cards, characters, songs, levels, pokémons, etc, or website elements such as users, activities, reports, etc.
It's super easy to create a collection, and they will automatically provide pages to view, list, add and edit items. Views are also available in Ajax to allow loading in a modal.
Collections are generally composed of:
- The database: a class that inherits from
MagiModel
that corresponds to django model, with some extra helpers.- See ⎡MagiModel⎦
- The MagiCollection: a class that inherits from
MagiCollection
that will contain all the configuration of the views, and more.- See ⎡MagiCollection⎦
- (Optional) The form: one or more classes that inherit from
MagiForm
that correspond to django forms, with some extra checks. Used to add/edit.- See ⎡MagiForm⎦
- (Optional) The filters: class that inherits from
MagiFilter
that correspond to a django form and is used to search / filter results in the list page.- See ⎡MagiFiltersForm⎦
- (Optional) Fields views: a class that lets you configure how each field in an item looks like when displayed using the default item view, list table view or list ordering.
- See ⎡MagiFields⎦
→ Next: MagiModel
I. Introduction
II. Tutorials
III. References
- Files tree
- Default collections
- Default pages
- Website settings
- MagiCollection settings
- Abstract models
- Abstract collections
- MagiForm settings
- MagiFiltersForm settings
- Single pages settings
IV. Utils
-
MagiModel utils
- MagiModel images and files
- DateTime fields
- BaseAccount model
- Save choices values as integer rather than strings
- Store comma separated values
- Store dictionaries
- Store Markdown texts
- Translate fields values in multiple languages
- Store JSON
- More model field types
- Transform images before saving them
- Check choices at form level instead of model level
- Use an internal cache for foreign keys in models
- Customize views with MagiModel properties
- Events
- Form utils
- Python utils
- Templates utils
- Javascript utils
- Enable and disable existing collections and pages
- Translations
- Page titles and descriptions
- Characters
- Seasons
- Roles and permissions
- Allow your staff team to change configurations
- Custom users preferences and settings
- Background illustrations
- Activities tabs
- Corner popups
VI. More