have moved page_teaser_tags.py into mezzanine's pages\templatetags folder

On Thursday, April 9, 2015 at 12:50:59 PM UTC-4, Josh Cartmell wrote:
>
> There are still some problems in the usage of the tag.  An as_tag adds 
> something to the context, so I wouldn't render anything in the tag.  For 
> example, once you call {% page_teaser "about-us" as teased_page %} 
> teased_page is added to the context so you would access it like, {{ 
> teased_page }}.
>
> Try something like this:
> https://gist.github.com/joshcartme/bcdda75f1607890587ca 
> <https://www.google.com/url?q=https%3A%2F%2Fgist.github.com%2Fjoshcartme%2Fbcdda75f1607890587ca&sa=D&sntz=1&usg=AFQjCNHdGA02SFrka767-wTTu3KXt44Tog>
>
> btw, where is templatetags/page_teaser_tags.py?  It should be inside an 
> app that is in your INSTALLED_APPS setting.
>
> Good luck!
>
> On Thu, Apr 9, 2015 at 10:38 AM, roland balint <raba...@gmail.com 
> <javascript:>> wrote:
>
>> gone through again but still need help; missing something and can't 
>> figure it out ...
>> the goal is to get the first 50 characters from a published page onto the 
>> index page
>> so
>>
>> index.html
>>
>>   {% include "teaser.html" %}
>>
>> teaser.html
>>
>>   {% load page_teaser_tags keyword_tags mezzanine_tags i18n %}
>>
>>   {% block page_teaser %}
>>   {% page_teaser "about-us" as teased_page %}
>>   {% if teased_page %}
>>   {% teased_page %}
>>   {% endif %}
>>   {% endblock %}
>>
>> page_teaser_tags.py
>>
>> from __future__ import unicode_literals
>>
>> from mezzanine.pages.models import Page
>> from mezzanine import template
>>
>> register = template.Library()
>>
>> @register.as_tag
>> def page_teaser(page=None):
>>     """
>>     return the requested page
>>     usage
>>     {% page_teaser page="about-us" as page_teased %}
>>     """
>>
>>     pages = Page.objects.published()
>>     if page is not None:
>>     try:
>>         page_teased = pages.filter(slug=page)
>>     except page_teased.DoesNotExist:
>>         return []
>>     return render(page_teased.description)
>>
>> my templatetags\page_teaser_tags.py never gets triggered at all (meaning 
>> there is no compiled python file in the folder)
>> however i do reach the "teaser.html" file but can't passed it no matter 
>> where i place my tag file
>>
>> thx
>> 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 mezzanine-use...@googlegroups.com <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 mezzanine-users+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to