Ejemplo n.º 1
0
    def convert_poll_choices(self):
        cursor = connection.cursor();
        cursor.execute("SELECT * FROM smf_poll_choices");
        rows = cursor.fetchall()

        for row in rows:
            try: 
                poll = Poll.objects.get(old_poll_id=row[0])
                try:
                    choice = Choice()
                    choice.poll = poll
                    choice.old_choice_id = row[1]
                    choice.label = row[2]
                    choice.votes = row[3]
                    choice.save()

                except Exception, e:
                    print str(e)
            except Poll.DoesNotExist, e:
                print str(e)
Ejemplo n.º 2
0
    def convert_poll_choices(self):
        cursor = connection.cursor()
        cursor.execute("SELECT * FROM smf_poll_choices")
        rows = cursor.fetchall()

        for row in rows:
            try:
                poll = Poll.objects.get(old_poll_id=row[0])
                try:
                    choice = Choice()
                    choice.poll = poll
                    choice.old_choice_id = row[1]
                    choice.label = row[2]
                    choice.votes = row[3]
                    choice.save()

                except Exception, e:
                    print str(e)
            except Poll.DoesNotExist, e:
                print str(e)