trying but, page_teaser_tag.py doesn't get triggered at all ( do have 
__init__.py in templatetags folder )
in index.html
  {% include "teaser.html" %}
in teaser.html
  {% load page_teaser_tag %}
  <p>{{ single_page.description|safe|truncatechars:50 }}</p>
in page_teaser_tag.py
  from __future__ import unicode_literals
  from django.shortcuts import get_object_or_404, render_to_response
  from mezzanine.pages.models import Page
  from mezzanine.template import Library

  register = Library()

  @register.simple_tag(page_teaser)
  def page_teaser(request, slug):
      """
      return the requested page
      later would like to be able to send which page to be returned
      """
      slug = 'about-us'
      single_page = get_object_or_404(Page, slug=slug)
      return render_to_response('teaser.html', {'single_page': 
single_page,})


On Tuesday, April 7, 2015 at 2:16:15 PM UTC-4, Josh Cartmell wrote:
>
> Hi Roland, first use a page process, template tag or some other method to 
> pull the page you want to show content from onto the home page.
>
> Then use either 
> https://docs.djangoproject.com/en/1.8/ref/templates/builtins/#truncatechars-html
>  
> or truncatewords_html to cut the text down to the size you want.
>
> Good luck!
>
> On Tue, Apr 7, 2015 at 2:00 PM, roland balint <[email protected] 
> <javascript:>> wrote:
>
>> not sure if this has already been asked or done...
>> how can we do a page teaser?
>> was thinking about the first 100 character from a rich text page to be 
>> displayed on the index page
>> thank you,
>> roland
>>
>>  -- 
>> 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