Beispiel #1
0
 def last_alias_num(self):
   """
   FIXME: we should be tracking alias number, not the V* alias which then
   makes things a lot harder
   """
   if not self.use_voter_aliases:
     return None
   
   return heliosutils.one_val_raw_sql("select max(cast(substring(alias, 2) as integer)) from " + Voter._meta.db_table + " where election_id = %s", [self.id]) or 0
Beispiel #2
0
 def last_alias_num(self):
   """
   FIXME: we should be tracking alias number, not the V* alias which then
   makes things a lot harder
   """
   if not self.use_voter_aliases:
     return None
   
   return heliosutils.one_val_raw_sql("select max(cast(substring(alias, 2) as integer)) from " + Voter._meta.db_table + " where election_id = %s", [self.id]) or 0
Beispiel #3
0
  def last_alias_num(self):
    """
    FIXME: we should be tracking alias number, not the V* alias which then
    makes things a lot harder
    """
    if not self.use_voter_aliases:
      return None

    # FIXME: https://docs.djangoproject.com/en/dev/topics/db/multi-db/#database-routers
    # use database routes api to find proper database for the Voter model.
    # This will still work if someone deploys helios using only the default
    # database.
    SUBSTR_FUNCNAME = "substring"
    if 'sqlite' in settings.DATABASES['default']['ENGINE']:
        SUBSTR_FUNCNAME = "substr"

    return heliosutils.one_val_raw_sql("select max(cast(substr(alias, 2) as integer)) from " + Voter._meta.db_table + " where election_id = %s", [self.id]) or 0