コード例 #1
0
    def convert_categories(self):
        start_time = time.time()
        cursor = connection.cursor()
        cursor.execute("SELECT * FROM smf_categories;")
        rows = cursor.fetchall()

        for row in rows:
            category = Category()

            category.old_category_id    = row[0]
            category.name               = row[2]
            category.position           = row[1]
            category.active             = True
            category.save()

        self.calculate_time(start_time, time.time())
コード例 #2
0
    def convert_categories(self):
        start_time = time.time()
        cursor = connection.cursor()
        cursor.execute("SELECT * FROM smf_categories;")
        rows = cursor.fetchall()

        for row in rows:
            category = Category()

            category.old_category_id = row[0]
            category.name = row[2]
            category.position = row[1]
            category.active = True
            category.save()

        self.calculate_time(start_time, time.time())