Exemple #1
0
 def save(self, *args, **kwargs):
     # Even if this data came from another source we still need a unique we_vote_id
     if self.we_vote_id:
         self.we_vote_id = self.we_vote_id.strip()
     if self.we_vote_id == "" or self.we_vote_id is None:  # If there isn't a value...
         # ...generate a new id
         site_unique_id_prefix = fetch_site_unique_id_prefix()
         next_local_integer = fetch_next_we_vote_id_last_contest_measure_integer()
         # "wv" = We Vote
         # site_unique_id_prefix = a generated (or assigned) unique id for one server running We Vote
         # "meas" = tells us this is a unique id for a ContestMeasure
         # next_integer = a unique, sequential integer for this server - not necessarily tied to database id
         self.we_vote_id = "wv{site_unique_id_prefix}meas{next_integer}".format(
             site_unique_id_prefix=site_unique_id_prefix, next_integer=next_local_integer
         )
     super(ContestMeasure, self).save(*args, **kwargs)
Exemple #2
0
 def save(self, *args, **kwargs):
     # Even if this organization came from another source we still need a unique we_vote_id
     if self.we_vote_id:
         self.we_vote_id = self.we_vote_id.strip()
     if self.we_vote_id == "" or self.we_vote_id is None:  # If there isn't a value...
         # ...generate a new id
         site_unique_id_prefix = fetch_site_unique_id_prefix()
         next_local_integer = fetch_next_we_vote_id_last_quick_info_master_integer()
         # "wv" = We Vote
         # site_unique_id_prefix = a generated (or assigned) unique id for one server running We Vote
         # "infom" = tells us this is a unique id for a quick_info_master entry
         # next_integer = a unique, sequential integer for this server - not necessarily tied to database id
         self.we_vote_id = "wv{site_unique_id_prefix}infom{next_integer}".format(
             site_unique_id_prefix=site_unique_id_prefix,
             next_integer=next_local_integer,
         )
     super(QuickInfoMaster, self).save(*args, **kwargs)
Exemple #3
0
 def save(self, *args, **kwargs):
     # Even if this organization came from another source we still need a unique id_we_vote
     if self.id_we_vote:
         self.id_we_vote = self.id_we_vote.strip()
     if self.id_we_vote == "" or self.id_we_vote is None:  # If there isn't a value...
         # ...generate a new id
         site_unique_id_prefix = fetch_site_unique_id_prefix()
         next_local_integer = fetch_next_id_we_vote_last_position_integer()
         # "wv" = We Vote
         # site_unique_id_prefix = a generated (or assigned) unique id for one server running We Vote
         # "pos" = tells us this is a unique id for an pos
         # next_integer = a unique, sequential integer for this server - not necessarily tied to database id
         self.id_we_vote = "wv{site_unique_id_prefix}pos{next_integer}".format(
             site_unique_id_prefix=site_unique_id_prefix,
             next_integer=next_local_integer,
         )
     super(PositionEntered, self).save(*args, **kwargs)
Exemple #4
0
 def save(self, *args, **kwargs):
     # Even if this organization came from another source we still need a unique id_we_vote
     if self.id_we_vote:
         self.id_we_vote = self.id_we_vote.strip()
     if self.id_we_vote == "" or self.id_we_vote is None:  # If there isn't a value...
         # ...generate a new id
         site_unique_id_prefix = fetch_site_unique_id_prefix()
         next_local_integer = fetch_next_id_we_vote_last_position_integer()
         # "wv" = We Vote
         # site_unique_id_prefix = a generated (or assigned) unique id for one server running We Vote
         # "pos" = tells us this is a unique id for an pos
         # next_integer = a unique, sequential integer for this server - not necessarily tied to database id
         self.id_we_vote = "wv{site_unique_id_prefix}pos{next_integer}".format(
             site_unique_id_prefix=site_unique_id_prefix,
             next_integer=next_local_integer,
         )
     super(PositionEntered, self).save(*args, **kwargs)
Exemple #5
0
 def save(self, *args, **kwargs):
     # Even if this organization came from another source we still need a unique we_vote_id
     if self.we_vote_id:
         self.we_vote_id = self.we_vote_id.strip()
     if self.we_vote_id == "" or self.we_vote_id is None:  # If there isn't a value...
         # ...generate a new id
         site_unique_id_prefix = fetch_site_unique_id_prefix()
         next_local_integer = fetch_next_we_vote_id_last_org_integer()
         # "wv" = We Vote
         # site_unique_id_prefix = a generated (or assigned) unique id for one server running We Vote
         # "org" = tells us this is a unique id for an org
         # next_integer = a unique, sequential integer for this server - not necessarily tied to database id
         self.we_vote_id = "wv{site_unique_id_prefix}org{next_integer}".format(
             site_unique_id_prefix=site_unique_id_prefix, next_integer=next_local_integer
         )
         # TODO we need to deal with the situation where we_vote_id is NOT unique on save
     super(Organization, self).save(*args, **kwargs)
 def save(self, *args, **kwargs):
     # Even if this data came from another source we still need a unique we_vote_id
     if self.we_vote_id:
         self.we_vote_id = self.we_vote_id.strip().lower()
     if self.we_vote_id == "" or self.we_vote_id is None:  # If there isn't a value...
         # ...generate a new id
         site_unique_id_prefix = fetch_site_unique_id_prefix()
         next_local_integer = fetch_next_we_vote_id_last_contest_measure_integer()
         # "wv" = We Vote
         # site_unique_id_prefix = a generated (or assigned) unique id for one server running We Vote
         # "meas" = tells us this is a unique id for a ContestMeasure
         # next_integer = a unique, sequential integer for this server - not necessarily tied to database id
         self.we_vote_id = "wv{site_unique_id_prefix}meas{next_integer}".format(
             site_unique_id_prefix=site_unique_id_prefix,
             next_integer=next_local_integer,
         )
     super(ContestMeasure, self).save(*args, **kwargs)
Exemple #7
0
 def save(self, *args, **kwargs):
     # Even if this organization came from another source we still need a unique we_vote_id
     if self.we_vote_id:
         self.we_vote_id = self.we_vote_id.strip()
     if self.we_vote_id == "" or self.we_vote_id is None:  # If there isn't a value...
         # ...generate a new id
         site_unique_id_prefix = fetch_site_unique_id_prefix()
         next_local_integer = fetch_next_we_vote_id_last_org_integer()
         # "wv" = We Vote
         # site_unique_id_prefix = a generated (or assigned) unique id for one server running We Vote
         # "org" = tells us this is a unique id for an org
         # next_integer = a unique, sequential integer for this server - not necessarily tied to database id
         self.we_vote_id = "wv{site_unique_id_prefix}org{next_integer}".format(
             site_unique_id_prefix=site_unique_id_prefix,
             next_integer=next_local_integer,
         )
         # TODO we need to deal with the situation where we_vote_id is NOT unique on save
     super(Organization, self).save(*args, **kwargs)
Exemple #8
0
 def save(self, *args, **kwargs):
     # Even if this data came from another source we still need a unique we_vote_id
     if self.we_vote_id:
         self.we_vote_id = self.we_vote_id.strip()
     if self.we_vote_id == "" or self.we_vote_id is None:  # If there isn't a value...
         # ...generate a new id
         site_unique_id_prefix = fetch_site_unique_id_prefix()
         next_local_integer = fetch_next_we_vote_id_last_candidate_campaign_integer()
         # "wv" = We Vote
         # site_unique_id_prefix = a generated (or assigned) unique id for one server running We Vote
         # "cand" = tells us this is a unique id for a CandidateCampaign
         # next_integer = a unique, sequential integer for this server - not necessarily tied to database id
         self.we_vote_id = "wv{site_unique_id_prefix}cand{next_integer}".format(
             site_unique_id_prefix=site_unique_id_prefix,
             next_integer=next_local_integer,
         )
     if self.maplight_id == "":  # We want this to be unique IF there is a value, and otherwise "None"
         self.maplight_id = None
     super(CandidateCampaign, self).save(*args, **kwargs)
Exemple #9
0
 def save(self, *args, **kwargs):
     # Even if this data came from another source we still need a unique we_vote_id
     if self.we_vote_id:
         self.we_vote_id = self.we_vote_id.strip()
     if self.we_vote_id == "" or self.we_vote_id is None:  # If there isn't a value...
         # ...generate a new id
         site_unique_id_prefix = fetch_site_unique_id_prefix()
         next_local_integer = fetch_next_we_vote_id_last_candidate_campaign_integer()
         # "wv" = We Vote
         # site_unique_id_prefix = a generated (or assigned) unique id for one server running We Vote
         # "cand" = tells us this is a unique id for a CandidateCampaign
         # next_integer = a unique, sequential integer for this server - not necessarily tied to database id
         self.we_vote_id = "wv{site_unique_id_prefix}cand{next_integer}".format(
             site_unique_id_prefix=site_unique_id_prefix,
             next_integer=next_local_integer,
         )
     if self.maplight_id == "":  # We want this to be unique IF there is a value, and otherwise "None"
         self.maplight_id = None
     super(CandidateCampaign, self).save(*args, **kwargs)
Exemple #10
0
 def save(self, *args, **kwargs):
     if self.email:
         self.email = self.email.lower().strip()
         if not validate_email(self.email):  # ...make sure it is a valid email
             # If it isn't a valid email, don't save the value as an email -- just save a blank field
             self.email = None
     if self.we_vote_id:
         self.we_vote_id = self.we_vote_id.strip()
     if self.we_vote_id == "" or self.we_vote_id is None:  # If there isn't a value...
         # ...generate a new id
         site_unique_id_prefix = fetch_site_unique_id_prefix()
         next_local_integer = fetch_next_we_vote_id_last_voter_integer()
         # "wv" = We Vote
         # site_unique_id_prefix = a generated (or assigned) unique id for one server running We Vote
         # "voter" = tells us this is a unique id for an org
         # next_integer = a unique, sequential integer for this server - not necessarily tied to database id
         self.we_vote_id = "wv{site_unique_id_prefix}voter{next_integer}".format(
             site_unique_id_prefix=site_unique_id_prefix, next_integer=next_local_integer
         )
         # TODO we need to deal with the situation where we_vote_id is NOT unique on save
     super(Voter, self).save(*args, **kwargs)