Fix: Admin SEO dashboard - use Category.name instead of relationship
Problem: /admin/seo zwracał błąd 500 z AttributeError: category
Przyczyna: Company.category jest relacją SQLAlchemy (obiektem), nie stringiem.
Rozwiązanie: Użycie Category.name.label('category_name') z właściwym JOIN.
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
174316a530
commit
8705a5b015
7
app.py
7
app.py
@ -3545,12 +3545,15 @@ def admin_seo():
|
||||
Company.name,
|
||||
Company.slug,
|
||||
Company.website,
|
||||
Company.category,
|
||||
Category.name.label('category_name'),
|
||||
CompanyWebsiteAnalysis.pagespeed_seo_score,
|
||||
CompanyWebsiteAnalysis.pagespeed_performance_score,
|
||||
CompanyWebsiteAnalysis.pagespeed_accessibility_score,
|
||||
CompanyWebsiteAnalysis.pagespeed_best_practices_score,
|
||||
CompanyWebsiteAnalysis.seo_audited_at
|
||||
).outerjoin(
|
||||
Category,
|
||||
Company.category_id == Category.id
|
||||
).outerjoin(
|
||||
CompanyWebsiteAnalysis,
|
||||
Company.id == CompanyWebsiteAnalysis.company_id
|
||||
@ -3568,7 +3571,7 @@ def admin_seo():
|
||||
'name': row.name,
|
||||
'slug': row.slug,
|
||||
'website': row.website,
|
||||
'category': row.category,
|
||||
'category': row.category_name,
|
||||
'seo_score': row.pagespeed_seo_score,
|
||||
'performance_score': row.pagespeed_performance_score,
|
||||
'accessibility_score': row.pagespeed_accessibility_score,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user