-
Notifications
You must be signed in to change notification settings - Fork 11
MagiCollection settings in Add view
deby edited this page Jul 26, 2022
·
7 revisions
↑ Parent: MagiCollection settings
← Previous: MagiCollection settings in Item view
- Add views contain the following settings (can be overridden):
Key | Value | Default | Example |
---|---|---|---|
after_template | Name of a template to include after the form | None | "include/afterAddCard" |
alert_duplicate | Should we display a warning that asks users to check if it doesn't already exist before adding it? | True | |
allow_next | Will ignore redirect_after_add and will redirect to what's specified in 'next' if speficied | True | |
back_to_list_button | Should we display a button to go back to the list view at the end of the form? | True | |
filter_cuteform | See ⎡CuteForm⎦. Can be specified in collection. | ||
form_class | Form class to add an item. Can be a method (see below). Can be specified in collection. | AutoForm | IdolForm |
max_per_user | By default, users can add as many as they'd like. You can restrict to a max number of added per user to avoid spam. |
None | 3000 |
max_per_user_per_day | Will limit how many a user can add within 24 hours. |
None | 24 |
max_per_user_per_hour | Will limit how many a user can add within an hour. |
None | 3 |
max_per_user_per_minute | Will limit how many a user can add within a minute. |
None | 1 |
multipart | Should the HTML form allow multipart (uploaded files)? Can be specified in collection. | False | |
otherbuttons_template | Template path (without .html ) for extra buttons at the end of the form |
None | "include/cardsExtraButtons" |
savem2m | Should we call save_m2m to save the manytomany items after saving this model? | Will automatically check for presence of manytomany fields | |
unique_per_owner | Will specify that only one of this item can be added. Will redirect to edit page when trying to add again. | False |
See also: MagiCollection settings in All views.
- Add views contain the following methods (can be overridden):
Name | Description | Parameters | Return value | Default |
---|---|---|---|---|
get_page_title | See Page titles and descriptions | type=None | Translated string | unicode of item |
get_h1_title | See Page titles and descriptions | request, context, type=None | list of dict, dict | See Page titles and descriptions |
check_type_permissions | Check if the current user has permissions to add this specific type of item (See Item types). Should raise PermissionDenied if needed. |
request, context, type=None | None | None |
after_save | Function called after the form is saved. Not recommended, override save in your form instead. Can be specified per collection. |
request, instance, type=None | instance | Just returns the instance |
before_save | Function called before the form is saved. Not recommended, override save in your form instead. Can be specified per collection. |
request, instance, type=None | instance | Just returns the instance |
form_class | Form class to add an item. Doesn't have to be a method (see above). Can be specified in collection. | request, context | A form class | AutoForm |
quick_add_to_collection | (Collectibles only) Will automatically load javascript utility "directAddCollectible" to add to your collection in one click. Will load the form and attempt to submit it in the background, so will only work if all the fields in the form are optional or have a default selected/entered value when the form is loaded. Combined with “unique_per_owner”, will allow users to easily add or delete with one click. | request, parent_item | True or False | False |
redirect_after_add | Where should the user be redirected after the item has been added successfully? | request, item, ajax | URL to redirect to | Redirect to the item view of the item that has been created if the item view is enabled, otherwise to the list view |
See also: MagiCollection methods in All views.
- Add views provide the following methods (not meant to be overridden):
Name | Description | Parameters | Return value |
---|---|---|---|
has_type_permissions | Calls check_type_permissions , catches exceptions and returns True or False |
request, context | True or False |
See also: MagiCollection methods in All views.
ℹ︎ See also: Views
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