File size: 1,093 Bytes
a6be783
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
from api.models import Product, BlogPost, Review
from .practice_cleanup import clear_practice_data
from .practice_users import create_practice_users, PASSWORD
from .practice_catalog import create_categories, create_practice_products
from .practice_content import create_articles, create_reviews
from .practice_artists import create_practice_artists


def run_practice_seed(command):
    clear_practice_data(command)
    categories = create_categories()
    users, sellers, buyer = create_practice_users(command)
    products = create_practice_products(command, users, categories)
    create_articles(command, sellers)
    create_reviews(products, buyer)
    create_practice_artists(users)
    command.stdout.write(command.style.SUCCESS('Successfully seeded practice database.'))
    command.stdout.write(f'Marketplace: {Product.objects.count()} active listings')
    command.stdout.write(f'Articles: {BlogPost.objects.count()} published posts')
    command.stdout.write(f'Reviews: {Review.objects.count()} customer reviews')
    command.stdout.write(f'Practice accounts password: {PASSWORD}')