Custom Tag in xml template

1

I try to create a custom tag or custom tag but for an xml, I do not know if the error is because it is only for html or I am doing it wrong this is my code:

from django import template

register = template.Library()


@register.assignment_tag
def ivaGenerado(precio_producto):

    iva_generado = float((precio_producto * 12)/100)
    return iva_generado

in my xml I have something like this:

{% load custom_tags %}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<factura id="comprobante" version="1.0.0">
    <infoTributaria>
        <ambiente>1</ambiente>
      ....
    ...
              {% ivaGenerado venta.precio  as ivagenerado %}
                    <valor>{{ ivagenerado }}</valor>

the error generates me just to include the tag:

  

Invalid block tag on line 62: 'ivaGenerated', expected 'empty' or   'endfor'. Did you forget to register or load this tag?

It should be noted that I also have another tag but in a template (html) that works but I want to do it for an xml

    
asked by Diego Avila 20.12.2018 в 17:51
source

0 answers