Hello Brian,
I am trying to load do as suggested below but I get an error -
Invalid block tag on line 114: 'nimbisshop_latest'. Did you forget to
register or load this tag?
I get the error inside my index.html
I thought it was due to a nested tag but I moved it outside, still the
message persists.
add nimbisshop_tags to the {% load list %}
Could anyone explain the above a little bit more, please? Anything I am
missing out?
Thanking you regards
On Wednesday, 5 December 2012 20:04:10 UTC, Brian Schott wrote:
>
> Here is a quick copy paste of what we do if you want to use a templatetag
> as a starting point.
>
> Brian
>
> templates/pages/index.html
> == add nimbisshop_tags to the {% load list %}
> == insert something like this:
>
> <h3> Latest Software </h3>
> {% nimbisshop_latest "catalog" "span2" 3 %}
>
> <yourapp>/templatetags/nimbisshop_tags.py
> ===
> from cartridge.shop.models import Category, Product
> register = template.Library()
>
> @register.inclusion_tag("includes/nimbisshop_latest.html")
> def nimbisshop_latest(category, span, count):
> try:
> category = Category.objects.get(slug=category)
> products = category.products.filter(
> available=True).order_by('-publish_date')[0:count]
> except Category.DoesNotExist:
> products = []
> return {'span': span, 'products': products}
> ===
>
> <yourapp>/templates/includes/nimbisshop_latest.html
> ===
> {% load static %}
> <ul class="thumbnails">
> {% for p in products %}
> <li class="{{ span }}">
> <div class="thumbnail">
> <a href="{{ p.get_absolute_url }}">
> <img
> src="{% get_media_prefix %}{{ p.image }}" alt="">
> <h4>{{ p.title }}</h4></a>
> </div>
> </li>
> {% endfor %}
> </ul>
> ===
>
>
>
> On Dec 5, 2012, at 8:15 AM, Ken Bolton <[email protected] <javascript:>>
> wrote:
>
> Hi Jesse,
>
> Mezzanine and Cartridge are "just" Django applications, which is probably
> my favorite thing about the stack. To get a list of products onto the
> homepage, start by adding a custom view that adds the queryset of Products
> you want to the context, set that view in the url pattern, then iterate
> over the context list in the template.
>
> Let us know if you need more specific details.
>
> best,
> Ken
>
>
> On Tue, Dec 4, 2012 at 7:14 PM, Jesse Ramirez <[email protected]
> <javascript:>> wrote:
>
>> I'm not sure if this has been covered, but what is the best/recommended
>> way of adding products to the homepage in mezzanine with cartridge?
>
>
>
>
--
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.