-
Notifications
You must be signed in to change notification settings - Fork 11
Alt views
deby edited this page Dec 1, 2022
·
7 revisions
↑ Parent: MagiCollection
← Previous: CuteForm
List views can have alternative views. For example, you may want to provide a condensed table of data to show stats.
Your alt view must provide:
verbose_name
You can provide (which will override the value provided in MagiCollection settings in List view):
template
display_style
display_style_table_fields
per_line
icon
image
page_size
show_items_names
show_collect_button
show_relevant_fields_on_ordering
show_item_buttons
show_item_buttons_as_icons
item_padding
full_width
col_break
-
show_view_title
(will show/hide the title of the view in h1 element) navbar_link_title
show_title
show_small_title
Other settings:
hide_in_navbar
hide_in_filter
filter_queryset
class CardCollection(MagiCollection):
...
class ListView(MagiCollection.ListView):
...
alt_views = MagiCollection.ListView.alt_views + [
('statistics', {
'verbose_name': _('Statistics'),
'template': 'default_item_table_view',
'display_style': 'table',
'display_style_table_fields': [
'image', 'image_trained',
'smile_min', 'smile_max', 'smile_trained_max',
'pure_min', 'pure_max', 'pure_trained_max',
'cool_min', 'cool_max', 'cool_trained_max',
],
}),
]
→ Next: Item Types
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