I'm currently using one solution proposed at the forum, replacing 

{{ blog_post.description_from_content }}

with a

{% if blog_post.gen_description %}
{{ blog_post.content|safe|truncatewords:60 }}
{% else %}
        {{ blog_post.description|safe }}
        {% endif %}

and it works pretty well, where 

I believe the optimal solution would be for Mezzanine to offer a better 
default por the generation of descriptions, along with Eduardo's solution, 
which is to have a setting where the developer can point to a callable.

Em segunda-feira, 16 de maio de 2016 12:03:04 UTC-4, Ryne Everett escreveu:
>
> description = content[:max_char_count]
>>
>> Isn't something like this viable?
>
>
> I don't see how cutting off mid-word, or even mid-sentence could be an 
> improvement. But maybe capturing every sentence within a character limit 
> with something like:
>
> description = re.sub(r"[!?.].*$", '', content[:max_char_count])
>
> That's probably not quite right, but the idea is to cut out everything 
> after the last punctuation mark.
>
> On Mon, May 16, 2016 at 2:36 PM, Efraim AUGUSTO GONCALVES <
> [email protected] <javascript:>> wrote:
>
>> Yes. This may be the best solution.
>>
>>
>> Em segunda-feira, 16 de maio de 2016 10:28:58 UTC-4, Eduardo Rivas 
>> escreveu:
>>>
>>> Another solution: let the developer point to a callable via settings. 
>>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Mezzanine Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to [email protected] <javascript:>.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Mezzanine Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to