def get_description_natural(self): """A description in HTML of this role in sentence form, e.g. the delegate for the District of Columbia's at-large district.""" from website.templatetags.govtrack_utils import ordinalhtml (statename, statename_article) = (self.state_name_article(), "") if statename.startswith("the "): (statename, statename_article) = (statename[4:], "the ") statename = '%s<a href="/congress/members/%s">%s</a>' % (statename_article, self.state, statename) if self.role_type in (RoleType.president, RoleType.vicepresident): return self.get_title_name(False) if self.role_type == RoleType.senator: js = "a " if self.current and self.senator_rank: js = "the " + self.get_senator_rank_display().lower() + " " return js + "senator from " + statename if self.role_type == RoleType.representative: if stateapportionment.get(self.state) in ("T", None): # current territories and former state-things, all of which send/sent delegates return "the %s from %s" % ( self.get_title_name(False).lower(), statename ) else: if self.district == -1: return "the representative for " + statename elif self.district == 0: return "the representative for " + statename + "\u2019s at-large district" else: return "the representative for " + statename + "\u2019s " + ordinalhtml(self.district) + " congressional district"
def get_description(self): """A description of this role, e.g. Delegate for District of Columbia At Large.""" from django.contrib.humanize.templatetags.humanize import ordinal if self.role_type in (RoleType.president, RoleType.vicepresident): return self.get_title_name(False) if self.role_type == RoleType.senator: js = "" if self.current and self.senator_rank: js = self.get_senator_rank_display() + " " return js + self.get_title_name(False) + " for " + statenames[ self.state] if self.role_type == RoleType.representative: if self.district == -1 or stateapportionment.get(self.state) in ( "T", None ): # unknown district / current territories and former state-things, all of which send/sent delegates return self.get_title_name( False) + " for " + self.state_name_article() elif self.district == 0: return self.get_title_name(False) + " for " + statenames[ self.state] + " At Large" else: return self.get_title_name(False) + " for " + statenames[ self.state] + "'s " + ordinal( self.district) + " congressional district"
def get_description_natural(self): """A description of this role in sentence form, e.g. the delegate for the District of Columbia's at-large district.""" from website.templatetags.govtrack_utils import ordinalhtml if self.role_type in (RoleType.president, RoleType.vicepresident): return self.get_title_name(False) if self.role_type == RoleType.senator: js = "a " if self.current and self.senator_rank: js = "the " + self.get_senator_rank_display().lower() + " " return js + "senator from " + statenames[self.state] if self.role_type == RoleType.representative: if stateapportionment.get(self.state) == "T": return "the %s from %s" % (self.get_title_name(False).lower(), self.state_name_article()) else: if self.district == -1: return "the representative for " + statenames[self.state] elif self.district == 0: return "the representative for " + statenames[ self.state] + "'s at-large district" else: return "the representative for " + statenames[ self.state] + "'s " + ordinalhtml( self.district) + " congressional district"
def get_description(self): """A description of this role, e.g. Delegate for District of Columbia At Large.""" from django.contrib.humanize.templatetags.humanize import ordinal if self.role_type in (RoleType.president, RoleType.vicepresident): return self.get_title_name(False) if self.role_type == RoleType.senator: js = "" if self.current and self.senator_rank: js = self.get_senator_rank_display() + " " return js + self.get_title_name(False) + " from " + statenames[self.state] if self.role_type == RoleType.representative: if self.district == -1 or stateapportionment.get(self.state) in ("T", None): # unknown district / current territories and former state-things, all of which send/sent delegates return self.get_title_name(False) + " for " + self.state_name_article() elif self.district == 0: return self.get_title_name(False) + " for " + statenames[self.state] + " At Large" else: return self.get_title_name(False) + " for " + statenames[self.state] + "'s " + ordinal(self.district) + " congressional district"
def get_description_natural(self): """A description of this role in sentence form, e.g. the delegate for the District of Columbia's at-large district.""" from website.templatetags.govtrack_utils import ordinalhtml if self.role_type in (RoleType.president, RoleType.vicepresident): return self.get_title_name(False) if self.role_type == RoleType.senator: js = "a " if self.current and self.senator_rank: js = "the " + self.get_senator_rank_display().lower() + " " return js + "senator from " + statenames[self.state] if self.role_type == RoleType.representative: if stateapportionment.get(self.state) == "T": return "the %s from %s" % ( self.get_title_name(False).lower(), self.state_name_article() ) else: if self.district == -1: return "the representative for " + statenames[self.state] elif self.district == 0: return "the representative for " + statenames[self.state] + "'s at-large district" else: return "the representative for " + statenames[self.state] + "'s " + ordinalhtml(self.district) + " congressional district"
def is_historical_territory(self): # a historical territory # note: self.state is "" for presidents/vps return self.state and stateapportionment.get(self.state) is None
def is_territory(self): # a current territory return stateapportionment.get(self.state) == "T"