4.2.1.8. Package apps.managers.team_mgr

The manager to support definition and management of teams.

Teams can be aggregated into ‘groups’. This allows, for example, a group of teams representing individual floors to be aggregated into a group (their residence hall).

4.2.1.8.1. Module apps.managers.team_mgr.models

Defines the model for teams.

class apps.managers.team_mgr.models.Group(*args, **kwargs)[source]

Defines the group that a team belongs to.

Parameters:
  • id (AutoField) – Id
  • name (CharField) – The name of the group.
team_points_leaders(num_results=None, round_name=None)[source]

Returns the top points leaders for the given group.

class apps.managers.team_mgr.models.Post(*args, **kwargs)[source]

Represents a wall post on a user’s wall.

Parameters:
  • id (AutoField) – Id
  • user_id (ForeignKey) – The user who submit the post.
  • team_id (ForeignKey) – The team of the submitter.
  • text (TextField) – The content of the post.
  • style_class (CharField) – The CSS class to apply to this post.
  • created_at (DateTimeField) – The create timestamp
date_string()[source]

Formats the created date into a pretty string.

class apps.managers.team_mgr.models.Team(*args, **kwargs)[source]

Represents the team that a player belongs to.

Parameters:
  • id (AutoField) – Id
  • group_id (ForeignKey) – The group this team belongs to.
  • name (CharField) – The team name
  • size (IntegerField) – The size of the team. It is the total number of residents in the team. Non-zero value will be used to normalize the team total score and participation rate.
  • logo (ImageField) – The logo of the team.
current_round_points()[source]

Returns the number of points for the current round.

current_round_rank()[source]

Gets the ranking of this team during the current round.

points(round_name=None)[source]

Returns the total number of points for the team. Optional parameter for a round.

points_leaders(num_results=None, round_name=None)[source]

Gets the individual points leaders for the team.

rank(round_name=None)[source]

Returns the rank of the team across all groups.

save(*args, **kwargs)[source]

Custom save method.

4.2.1.8.2. Module apps.managers.team_mgr.admin

Administrator interface to teams.

class apps.managers.team_mgr.admin.GroupAdmin(model, admin_site)[source]

Group Admin

class apps.managers.team_mgr.admin.PostAdmin(model, admin_site)[source]

Post administrator for teams, overrides delete_selected

delete_selected(request, queryset)[source]

delete selected override

class apps.managers.team_mgr.admin.TeamAdmin(model, admin_site)[source]

Team Admin