Hello,
I want to cry a function allowing me to complete a template *. Xml. May I
have a problem with the passage of the object render_to_response. In short
here is my code. In fact, I do not know how to return an object that can
permattre me to complete my template automatically.
I am using django 1.1 and Python 2.6
Function writes to the file views.py
def main_formation(request, formation_id):
formations = Formation.objects.get(id=formation_id)
variables = RequestContext(request, {
'formations': formations
})
return render_to_response('saisie/formation.xml', variables)
This is mu xml template
<?xml version="1.0" encoding="UTF-8" ?>
<cdm:CDM xmlns:cdm="http://cdm-fr.fr/2006/CDM-frSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://cdm-fr.fr/2006/CDM-frSchema
http://cdm-fr.fr/2006/schemas/CDM-fr.xsd" language="fr-FR">
{% if formations %}
<cdm:contacts>
<cdm:contactData>
<cdm:adr>
<cdm:locality>{{ formation.ville }}</cdm:locality>
<cdm:country>{{ formation.pays }}</cdm:country>
</cdm:adr>
</cdm:contactData>
</cdm:contacts>
{% endif %}
</cdm:CDM>
Thanks for your help.
--
You received this message because you are subscribed to the Google Groups
"Django users" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/django-users/-/U_4GarjysOgJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en.