Wait a secound, you are doing some very strange things.... I didn't see this before.
You have defined the following: @register.simple_tag def do_cost( name, avn, avd, *args, **kwargs ): avn = kwargs['avn'] avd = kwargs['avd'] name = kwargs['name'] return name The method has 3 parameters that you are sending to it - name, avn and avd. They correspond to the values sent to the method in order. So you don't need to use the kwargs dictionary - it's unnecessary... You could just write: @register.simple_tag def do_cost( name, avn, avd, *args, **kwargs ): return name Beacause you have sent the name to the method? Regards, Andréas Den ons 22 aug. 2018 kl 16:09 skrev MikeKJ <mike.jo...@paston.co.uk>: > Thank you Andreas Kuhne, progress > > > So this {% load get_cost %}{% do_cost b.name avn avd %} was working quite > happily but for some reason is now complaining > > Exception Type: TemplateSyntaxError > Exception Value: > > Caught KeyError while rendering: 'avn' > > > Exception Location claims to be get_cost.py in do_cost, line 10 which > is avn = kwargs['avn'] > > but the exception is in the template line {% load get_cost %}{% do_cost > b.name avn avd %} > > > > -- > 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/8d9d18dd-c8cb-494c-a2b8-8b06b64c40d3%40googlegroups.com > <https://groups.google.com/d/msgid/django-users/8d9d18dd-c8cb-494c-a2b8-8b06b64c40d3%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/CAK4qSCcnJzyrWXGjTyF9NZAc0SE6zxQ1gbrd1ZM2Oc%2B3ZL_tyQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.