def add_party(self, partyId): election_party = db.session.query(ElectionParty.Model).filter( ElectionParty.Model.partyId == partyId, ElectionParty.Model.electionId == self.electionId).one_or_none() if election_party is None: election_party = ElectionParty.create(electionId=self.electionId, partyId=partyId) return election_party
def add_party(self, partyId): return ElectionParty.create(electionId=self.electionId, partyId=partyId)