Electronics & Programming

develissimo

Open Source electronics development and programming

  • You are not logged in.

#1 Nov. 11, 2005 12:06:38

s.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

templates for CSV


Hi all,

in the template doco there's some mentioning of other formats than
HTML, e.g. CSV and email.
Has anyone tried to use the django template framework for producing CSV
files or emails?
Does anyone know how that could be done?

R
/stava

Offline

#2 Nov. 11, 2005 12:10:21

M.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

templates for CSV


stava wrote:in the template doco there's some mentioning of other formats than
HTML, e.g. CSV and email.
Has anyone tried to use the django template framework for producing CSV
files or emails?
Does anyone know how that could be done?It shouldn't be of any problem. Just make a template lie this:

{% for object in object_lis %}
"{{ object.field1 }}","{{ object.field2 }}","{{ object.field3 }}"
{% endfor %}

And here you got CSV file.

Offline

#3 Nov. 11, 2005 14:55:23

Adrian H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

templates for CSV


On 11/11/05, stava <> wrote:
> in the template doco there's some mentioning of other formats than
> HTML, e.g. CSV and email.
> Has anyone tried to use the django template framework for producing CSV
> files or emails?
> Does anyone know how that could be done?

Hi stava,

I've written documentation for you. Check it out here:http://www.djangoproject.com/documentation/outputting_csv/Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org

Offline

#4 Nov. 11, 2005 15:47:01

R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

templates for CSV


Doesn't your template based approach require the model to do some
formatting of the output before passing to the template to get the
quotes in the right place?

Robert

> -----Original Message-----
> From: django-users@googlegroups.com
> On Behalf Of Adrian Holovaty
> Sent: Friday, November 11, 2005 8:55 AM
> To: django-users@googlegroups.com
> Subject: Re: templates for CSV
>
>
>
> On 11/11/05, stava <> wrote:
> > in the template doco there's some mentioning of other formats than
> > HTML, e.g. CSV and email. Has anyone tried to use the
> django template
> > framework for producing CSV files or emails?
> > Does anyone know how that could be done?
>
> Hi stava,
>
> I've written documentation for you. Check it out here:
>http://www.djangoproject.com/documentation/outputting_csv/Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org

Offline

#5 Nov. 11, 2005 16:06:13

Adrian H.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

templates for CSV


On 11/11/05, <> wrote:
> Doesn't your template based approach require the model to do some
> formatting of the output before passing to the template to get the
> quotes in the right place?

No...I'm not quite sure what you mean.

Adrian

--
Adrian Holovaty
holovaty.com | djangoproject.com | chicagocrime.org

Offline

#6 Nov. 11, 2005 16:11:33

R.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

templates for CSV


That would be because I did not read your example very carefully...

Never mind

Robert

> -----Original Message-----
> From: django-users@googlegroups.com
> On Behalf Of Adrian Holovaty
> Sent: Friday, November 11, 2005 10:06 AM
> To: django-users@googlegroups.com
> Subject: Re: templates for CSV
>
>
>
> On 11/11/05, <> wrote:
> > Doesn't your template based approach require the model to do some
> > formatting of the output before passing to the template to get the
> > quotes in the right place?
>
> No...I'm not quite sure what you mean.
>
> Adrian
>
> --
> Adrian Holovaty
> holovaty.com | djangoproject.com | chicagocrime.org
>

Offline

#7 Nov. 11, 2005 21:54:23

s.
Registered: 2009-11-02
Reputation: +  0  -
Profile   Send e-mail  

templates for CSV


Many thanks!

/stava

Offline

Board footer

Moderator control

Enjoy the 20th of November
PoweredBy

The Forums are managed by develissimo stuff members, if you find any issues or misplaced content please help us to fix it. Thank you! Tell us via Contact Options
Leave a Message
Welcome to Develissimo Live Support