WIP
This commit is contained in:
parent
ad963f7e4c
commit
6ffbb14bc2
@ -2,13 +2,11 @@ import random
|
|||||||
import re
|
import re
|
||||||
from isodate import parse_duration as iso_parse_duration
|
from isodate import parse_duration as iso_parse_duration
|
||||||
from isodate.isoerror import ISO8601Error
|
from isodate.isoerror import ISO8601Error
|
||||||
from recipe_scrapers._exceptions import ElementNotFoundInHtml
|
|
||||||
|
|
||||||
from cookbook.helper.ingredient_parser import parse as parse_single_ingredient
|
from cookbook.helper.ingredient_parser import parse as parse_single_ingredient
|
||||||
from cookbook.models import Keyword
|
from cookbook.models import Keyword
|
||||||
from django.utils.dateparse import parse_duration
|
from django.utils.dateparse import parse_duration
|
||||||
from html import unescape
|
from html import unescape
|
||||||
from recipe_scrapers._schemaorg import SchemaOrgException
|
|
||||||
from recipe_scrapers._utils import get_minutes
|
from recipe_scrapers._utils import get_minutes
|
||||||
|
|
||||||
|
|
||||||
@ -56,6 +54,7 @@ def get_from_scraper(scrape, space):
|
|||||||
recipe_json['cookTime'] = get_minutes(scrape.schema.data.get("cookTime")) or 0
|
recipe_json['cookTime'] = get_minutes(scrape.schema.data.get("cookTime")) or 0
|
||||||
except Exception:
|
except Exception:
|
||||||
recipe_json['cookTime'] = 0
|
recipe_json['cookTime'] = 0
|
||||||
|
|
||||||
if recipe_json['cookTime'] + recipe_json['prepTime'] == 0:
|
if recipe_json['cookTime'] + recipe_json['prepTime'] == 0:
|
||||||
try:
|
try:
|
||||||
recipe_json['prepTime'] = get_minutes(scrape.total_time()) or 0
|
recipe_json['prepTime'] = get_minutes(scrape.total_time()) or 0
|
||||||
|
@ -18,6 +18,6 @@ class Migration(migrations.Migration):
|
|||||||
migrations.AlterField(
|
migrations.AlterField(
|
||||||
model_name='userpreference',
|
model_name='userpreference',
|
||||||
name='use_fractions',
|
name='use_fractions',
|
||||||
field=models.BooleanField(default=False),
|
field=models.BooleanField(default=True),
|
||||||
),
|
),
|
||||||
]
|
]
|
||||||
|
@ -19,7 +19,7 @@ def set_default_search_vector(apps, schema_editor):
|
|||||||
|
|
||||||
class Migration(migrations.Migration):
|
class Migration(migrations.Migration):
|
||||||
dependencies = [
|
dependencies = [
|
||||||
('cookbook', '0119_auto_20210411_2101'),
|
('cookbook', '0121_auto_20210518_1638'),
|
||||||
]
|
]
|
||||||
operations = [
|
operations = [
|
||||||
migrations.AddField(
|
migrations.AddField(
|
@ -21,7 +21,7 @@ from django.contrib.staticfiles.storage import staticfiles_storage
|
|||||||
from django.utils.translation import gettext_lazy as _
|
from django.utils.translation import gettext_lazy as _
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
from webpack_loader.loader import WebpackLoader
|
from webpack_loader.loader import WebpackLoader
|
||||||
|
load_dotenv()
|
||||||
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
|
||||||
|
|
||||||
# Get vars from .env files
|
# Get vars from .env files
|
||||||
|
Loading…
Reference in New Issue
Block a user