-
Notifications
You must be signed in to change notification settings - Fork 11
MagiCollection settings in All views
deby edited this page Nov 24, 2021
·
4 revisions
↑ Parent: MagiCollection settings
- All views share the following settings (can be overriden):
Key | Value | Default | Example |
---|---|---|---|
enbabled | Whether the view should be available or not. | True | |
ajax | Is the view available in ajax? (allow to get just the page content without HTML boilerplate and navigation bar) | True | |
ajax_callback | String name of a Javascript function to call when the view loaded. | None | 'loadCards' |
js_files | List of javascript files to include, all files are in static/js except if it starts with bower/
|
[] | ['cards.js, 'bower/marked/lib/marked'] |
shortcut_urls |
|
[] | [('me', 1)] |
multipart | Are Add/Edit forms multipart (ie contain files upload)? Can be specified in collection. | multipart in collection | True |
authentication_required | Permissions: only when the user is authenticated |
|
|
logout_required | Permissions: only when the user is NOT authenticated | False | |
staff_required | Permissions: only when the user is authenticated AND part of the staff team | False | |
owner_only | Permissions: only for ItemView/EditView, only when the authenticated user is the owner of the item |
|
|
disable_on_high_traffic | False | When HIGH_TRAFFIC is set to True in local settings, the view will be disabled and a message will be shown to users. |
- All views provide the following properties (not meant to be overriden):
Key | Value | Example |
---|---|---|
collection | The MagiCollection object associated with this view | CardCollection() |
- All views share the following methods (can be overriden):
Name | Description | Parameters | Return value | Default |
---|---|---|---|---|
get_global_context | Function called to pre-fill the context before the view loads (even before checking for permissions) | request | dictionary |
GET_GLOBAL_CONTEXT specified in settings for the website. |
share_image | Image displayed when sharing this view on social media (Facebook, Twitter, etc). Full URL. Can be specified in collection. | context, item=None | String URL |
share_image in MagiCollection |
extra_context | Allows you to add extra context, typically for your templates. Called after most of the logic for the view has been executed already. Example | context | dictionary | Just returns the context |
get_queryset | Queryset used to retrieve the item(s). Can be specified in collection. | queryset, parameters, request | Django queryset |
get_queryset in MagiCollection |
check_permissions | See Roles and permissions | |||
check_owner_permissions | See Roles and permissions |
- All views provide the following methods (not meant to be overriden):
Name | Description | Parameters | Return value |
---|---|---|---|
has_permissions | See Roles and permissions | ||
get_page_title | Get the title of the page | None | localized string |
ℹ︎ See also: Views
→ Next: List view
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