Convert to black formatting
This commit is contained in:
@@ -1,3 +1 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- coding: utf-8 -*-
|
||||
from .seed_command import SeedCommand
|
||||
|
@@ -19,30 +19,26 @@ def seed_things():
|
||||
|
||||
def seed_thing(cls):
|
||||
things = [
|
||||
{
|
||||
'name': 'Pizza Slicer',
|
||||
'purpose': 'Cut delicious pizza',
|
||||
},
|
||||
{
|
||||
'name': 'Rolling Pin',
|
||||
'purpose': 'Roll delicious pizza',
|
||||
},
|
||||
{
|
||||
'name': 'Pizza Oven',
|
||||
'purpose': 'Bake delicious pizza',
|
||||
},
|
||||
{"name": "Pizza Slicer", "purpose": "Cut delicious pizza"},
|
||||
{"name": "Rolling Pin", "purpose": "Roll delicious pizza"},
|
||||
{"name": "Pizza Oven", "purpose": "Bake delicious pizza"},
|
||||
]
|
||||
db.session.bulk_insert_mappings(cls, things)
|
||||
|
||||
|
||||
class SeedCommand(Command):
|
||||
""" Seed the DB."""
|
||||
|
||||
def run(self):
|
||||
if input('Are you sure you want to drop all tables and recreate? (y/N)\n'
|
||||
).lower() == 'y':
|
||||
print('Dropping tables...')
|
||||
if (
|
||||
input(
|
||||
"Are you sure you want to drop all tables and recreate? (y/N)\n"
|
||||
).lower()
|
||||
== "y"
|
||||
):
|
||||
print("Dropping tables...")
|
||||
db.drop_all()
|
||||
db.create_all()
|
||||
seed_things()
|
||||
db.session.commit()
|
||||
print('DB successfully seeded.')
|
||||
print("DB successfully seeded.")
|
||||
|
Reference in New Issue
Block a user