예제 #1
0
def add_fake_data(count):
    """
    Adds fake data to the database.
    """
    User.generate_fake(count=count)
    ZIPCode.generate_fake()
    Resource.generate_fake()
    ResourceReview.generate_fake(count=count)
    Address.generate_fake()
    AffiliationTag.generate_default()

    # Set a random zip for each user without one.
    User.set_random_zip_codes(User.query.filter_by(zip_code=None).all(),
                              ZIPCode.query.all())
    # Set a random affiliation tag for each user.
    User.set_random_affiliation_tags(User.query.all(),
                                     AffiliationTag.query.all())
예제 #2
0
def setup_dev():
    """Runs the set-up needed for local development."""
    setup_general()

    admin_email = '*****@*****.**'
    if User.query.filter_by(email=admin_email).first() is None:
        User.create_confirmed_admin('Default',
                                    'Admin',
                                    admin_email,
                                    'password',
                                    ZIPCode.create_zip_code('19104'))