changes to addtestdata
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import logging
|
||||
import json
|
||||
|
||||
import requests
|
||||
|
||||
from django.core.management.base import BaseCommand
|
||||
from django.contrib.gis.geos import GEOSGeometry, MultiPolygon
|
||||
|
||||
@@ -19,6 +21,8 @@ logging.basicConfig(
|
||||
|
||||
class Command(BaseCommand):
|
||||
|
||||
logo_url = "https://picsum.photos/200/300"
|
||||
|
||||
def handle(self, *args, **kwargs):
|
||||
print("Creating fake data to populate database")
|
||||
|
||||
@@ -47,7 +51,18 @@ class Command(BaseCommand):
|
||||
for i in range(100):
|
||||
name = fake.last_name_nonbinary()
|
||||
description = fake.paragraph(nb_sentences=5)
|
||||
product = ProductFactory(name=name, description=description)
|
||||
# TODO: apply tags from tag list
|
||||
|
||||
"""
|
||||
# TODO: add dynamic image to product
|
||||
response = requests.get(self.logo_url)
|
||||
if response.status_code == 200:
|
||||
response.raw.decode_content = True
|
||||
image = response.raw
|
||||
else:
|
||||
image= None
|
||||
"""
|
||||
product = ProductFactory(name=name, description=description,)
|
||||
logging.debug(f"New Product {product.name} created")
|
||||
print(".", end = '')
|
||||
print('')
|
||||
|
||||
Reference in New Issue
Block a user