diff --git a/plants/services/vpc.py b/plants/services/vpc.py index 2cdf740..2911d97 100644 --- a/plants/services/vpc.py +++ b/plants/services/vpc.py @@ -151,12 +151,13 @@ def scrape_plant(slug): h1 = soup.find('h1') name = h1.get_text(strip=True) if h1 else slug.replace('-', ' ').title() - # Hero image + # Hero image — VPC wraps the plant photo in a .wp-caption figure hero_img = '' - for sel in ['.woocommerce-product-gallery img', '.product-images img', 'article img']: + for sel in ['.wp-caption img', 'figure img', '.elementor-widget-image img']: img = soup.select_one(sel) - if img and img.get('src', '').startswith('http'): - hero_img = img['src'] + src = img.get('src', '') if img else '' + if src.startswith('http') and 'Grif_VPC' not in src and 'NoImage' not in src: + hero_img = src break result = { diff --git a/plants/views/plants.py b/plants/views/plants.py index efde4cb..3476380 100644 --- a/plants/views/plants.py +++ b/plants/views/plants.py @@ -101,6 +101,7 @@ def plant_edit(request, pk): return render(request, 'plants/plant_form.html', { 'form': form, 'plant': plant, + 'species': plant.species, 'title': 'Edit Plant', })