ValueError: Single '}' encountered in format string

def get_product_spec(product, model_name):
    table_content = ''
    for name, value in PRODUCT_SPEC[model_name].items():
        table_content += TABLE_CONTENT.format(name = name, value = getattr(product,value))
    return table_content

@register.filter
def product_spec(product):
    model_name = product.__class__._meta.model_name
    return TABLE_HEAD + get_product_spec(product, model_name) + TABLE_TAIL

line 59, in product_spec
    return TABLE_HEAD + get_product_spec(product, model_name) + TABLE_TAIL
 line 53, in get_product_spec
    table_content += TABLE_CONTENT.format(name = name, value = getattr(product,value))

Ответы (1 шт):

Автор решения: manneyland
TABLE_CONTENT = """
 <tr>
      <td>{name}</td>
      <td>{value}}</td>
    </tr>
    </tr>
"""

{value}} my problem

→ Ссылка