Skip to content

Collections

deby edited this page Feb 26, 2018 · 6 revisions

↑ 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.

Example of collections

Collections are generally composed of:

  • The database: a class that inherits from MagiModel that corresponds to django model, with some extra helpers.
  • The MagiCollection: a class that inherits from MagiCollection that will contain all the configuration of the views, and more.
  • (Optional) The form: one or more classes that inherit from MagiForm that correspond to django forms, with some extra checks. Used to add/edit.
  • (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.
  • (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.

→ Next: MagiModel

I. Introduction

II. Tutorials

  1. Collections
    1. MagiModel
    2. MagiCollection
    3. MagiForm
    4. MagiFiltersForm
    5. MagiFields
  2. Single pages
  3. Configuring the navbar

III. References

IV. Utils

V. Advanced tutorials

VI. More

Clone this wiki locally