Add description field to Product model
Issue: The landing page template supported displaying product descriptions, but the Product model didn't load the description field from config.yaml files. Changes: - Added optional 'description' parameter to Product.__init__() - Updated Product.to_dict() to include description (if present) - Updated Product.from_dict() to load description from config - Added test to verify descriptions are displayed on landing page All 9 landing page tests passing. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -14,16 +14,18 @@ class Product:
|
||||
owner_language: Preferred language for product owner
|
||||
assigned_owner_ids: List of product owner user IDs
|
||||
status: Product status ('active' or 'archived')
|
||||
description: Optional product description for landing page
|
||||
"""
|
||||
|
||||
def __init__(self, product_id, name, submission_url_slug, owner_language,
|
||||
assigned_owner_ids, status='active'):
|
||||
assigned_owner_ids, status='active', description=None):
|
||||
self.product_id = product_id
|
||||
self.name = name
|
||||
self.submission_url_slug = submission_url_slug
|
||||
self.owner_language = owner_language
|
||||
self.assigned_owner_ids = assigned_owner_ids or []
|
||||
self.status = status
|
||||
self.description = description
|
||||
|
||||
def to_dict(self):
|
||||
"""Convert product to dictionary
|
||||
@@ -31,7 +33,7 @@ class Product:
|
||||
Returns:
|
||||
dict: Product data
|
||||
"""
|
||||
return {
|
||||
data = {
|
||||
'product_id': self.product_id,
|
||||
'name': self.name,
|
||||
'submission_url_slug': self.submission_url_slug,
|
||||
@@ -39,6 +41,9 @@ class Product:
|
||||
'assigned_owner_ids': self.assigned_owner_ids,
|
||||
'status': self.status
|
||||
}
|
||||
if self.description:
|
||||
data['description'] = self.description
|
||||
return data
|
||||
|
||||
@classmethod
|
||||
def from_dict(cls, data):
|
||||
@@ -56,7 +61,8 @@ class Product:
|
||||
submission_url_slug=data['submission_url_slug'],
|
||||
owner_language=data['owner_language'],
|
||||
assigned_owner_ids=data.get('assigned_owner_ids', []),
|
||||
status=data.get('status', 'active')
|
||||
status=data.get('status', 'active'),
|
||||
description=data.get('description')
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
|
||||
Reference in New Issue
Block a user