def convert_polls(self): self.clear_polls() cursor = connection.cursor() cursor.execute("SELECT * FROM smf_polls") rows = cursor.fetchall() for row in rows: try: profile = Profile.objects.get(old_user_id=row[7]) try: poll = Poll() poll.old_poll_id = row[0] poll.user = profile.user poll.username = row[8] poll.question = row[1] if row[2] == 1: poll.locked = True poll.expires_on = self.fix_epoch(row[4]) if row[5] == 0: poll.hide_results_until_vote = False if row[6] == 0: poll.allow_changing_votes = False poll.allow_changing_votes = False if row[9] == 1: poll.allow_changing_votes = True poll.hide_results_until_expored = False poll.save() except Exception, e: print "Could not save poll: %s" % (str(e)) except Profile.DoesNotExist, e: pass
def get_mocked_step_with_poll_question(self, question, script_slug='registration_script'): mocked_poll = Poll() mocked_poll.question = question poll_step = ScriptStep() poll_step.poll = mocked_poll poll_step.script = Script(slug=script_slug) return poll_step