fairdm.views.generic#
Generic portal views.
Module Contents#
Classes#
Portal home page, a landing page for visitors and a dashboard for users. |
API#
- class FairDMHomeView(**kwargs)#
Bases:
mvp.views.MVPHomeViewPortal home page, a landing page for visitors and a dashboard for users.
Each landing page section reads its data from one
get_*method, and every one returns only what somebody who has not signed in may see. Subclass the view and override a method or a limit to change what a section shows.Attributes: hero_defaults: The hero’s content where
HOME_PAGE_CONFIGleaves a key out. latest_limit: How many datasets and how many projects the page shows. record_type_limit: How many sample types and how many measurement types are listed. people_limit: How many people’s faces are shown. organization_limit: How many organizations are named.Initialization
Constructor. Called in the URLconf; can contain helpful extra keyword arguments, and other things.
- page_subtitle#
‘Welcome’
- page_title#
‘Getting started’
- dashboard_template_name#
‘fairdm/dashboard.html’
- landing_template_name#
‘fairdm/landing.html’
- hero_defaults#
None
- latest_limit#
3
- record_type_limit#
5
- people_limit#
8
- organization_limit#
6
- get_landing_context(context)#
Add what the landing page’s sections read.
- get_portal_name()#
Return the portal’s name.
Returns: The name saved in the portal identity, or
SITE_NAMEwhen none has been saved.
- get_hero()#
Return the hero’s words and picture from
HOME_PAGE_CONFIG, over the defaults.Returns: A dict with
eyebrow,titleandlead({site_name}filled in, empty where the setting isFalse),image(an address, or empty) andlogo.
- get_about()#
Return what the portal says about itself, and who runs it.
Returns: A dict with the portal’s
name,description(the saved one, orPORTAL_DESCRIPTION),keywords,authorityandauthority_url.
- get_counts()#
Return the headline figures, leaving out anything the portal has none of.
Returns: A list of dicts, each with a
title, aniconname and avalue.
- get_latest_datasets()#
Return the public datasets changed most recently.
Returns: At most
latest_limitdatasets, loaded for their cards.
- get_latest_projects()#
Return the public projects added most recently.
Returns: At most
latest_limitprojects, loaded for their cards.
- get_record_types(base, models)#
Return the registered types of sample or measurement holding the most public records.
Args: base:
SampleorMeasurement. models: The registered subclasses ofbase.Returns: A dict with
shown, at mostrecord_type_limittypes each with aname,description,countandurl, andmore, how many were left out.
- get_people()#
Return people for the row of faces, those credited on the most records first.
Returns: At most
people_limitpeople.
- get_organizations()#
Return organizations to name, those credited on the most records first.
Returns: At most
organization_limitorganizations.
- get_page_subtitle()#
Greet a signed-in user by first name, falling back to the username.
- get_page_title()#
Title a signed-in user’s page as their dashboard.