I am so rusty I’m having trouble writing a simple_tag

 

In the template

 

{% for b in list %}

{% load get_cost %}{% do_cost {{ b.name }} avn avd %}

 

Also tried (per docs) {% do_cost name={{ b.name }} avn=avn avd=avd %}

I definitely have values in the template passed from the view for avn and 
avd and of course b.name 

 

Tag

from django import template

from django.conf import settings

from django.utils.html import escape

from band.models import Data

 

register = template.Library()

 

@register.simple_tag

def do_cost( name, avn, avd, *args, **kwargs ):

    avn = kwargs['avn']

    avd = kwargs['avd']

    name = kwargs['name']

 

    val = Data.objects.filter(property=name).filter(date_period=date)

    return val

 

I just keep getting do_cost takes 3 arguments

*** I know I want it to take 3 arguments!!!!***

Is it telling me that I can’t use {{ b.name }} as an arg?


-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/de8c0f7e-c8ee-4329-a954-457acfd01c64%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to