fairdm.views.generic#

Generic portal views.

Module Contents#

Classes#

FairDMHomeView

Portal home page, a landing page for visitors and a dashboard for users.

API#

class FairDMHomeView(**kwargs)#

Bases: mvp.views.MVPHomeView

Portal 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_CONFIG leaves 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_NAME when 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, title and lead ({site_name} filled in, empty where the setting is False), image (an address, or empty) and logo.

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, or PORTAL_DESCRIPTION), keywords, authority and authority_url.

get_counts()#

Return the headline figures, leaving out anything the portal has none of.

Returns: A list of dicts, each with a title, an icon name and a value.

get_latest_datasets()#

Return the public datasets changed most recently.

Returns: At most latest_limit datasets, loaded for their cards.

get_latest_projects()#

Return the public projects added most recently.

Returns: At most latest_limit projects, loaded for their cards.

get_record_types(base, models)#

Return the registered types of sample or measurement holding the most public records.

Args: base: Sample or Measurement. models: The registered subclasses of base.

Returns: A dict with shown, at most record_type_limit types each with a name, description, count and url, and more, 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_limit people.

get_organizations()#

Return organizations to name, those credited on the most records first.

Returns: At most organization_limit organizations.

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.