Re: parsing data from fileupload

2009-05-18 Thread Chris Shenton
Oh, make sure your upload form specifies the 'enctype' attribute so it will actually send a file object, like: {% block content %} Upload a file... {{ form.as_p }} {% endblock %} --~--~-~--~~~---~--~~ You received this message because you are subscribed

Re: parsing data from fileupload

2009-05-18 Thread Chris Shenton
On May 18, 2009, at 12:12 PM, Patrick wrote: > > Well, I guess what I'm confused about is adding data that doesn't come > directly from forms. > I ended up doing this and it seemed to work. > > for line in file: >b=Book() >b.title=line >b.save() Here is how I do it, Model, Form,

Re: parsing data from fileupload

2009-05-18 Thread Patrick
Well, I guess what I'm confused about is adding data that doesn't come directly from forms. I ended up doing this and it seemed to work. for line in file: b=Book() b.title=line b.save() Thanks On May 17, 3:41 pm, Alex Gaynor wrote: > On Sun, May 17, 2009 at

Re: parsing data from fileupload

2009-05-17 Thread Alex Gaynor
On Sun, May 17, 2009 at 5:39 PM, Patrick wrote: > > Filenames is also a table, but I'm interested in the data withing the > file. > > On May 17, 2:38 pm, Antoni Aloy wrote: > > 2009/5/17 Patrick : > > > > > How do I add data from a

Re: parsing data from fileupload

2009-05-17 Thread Patrick
Filenames is also a table, but I'm interested in the data withing the file. On May 17, 2:38 pm, Antoni Aloy wrote: > 2009/5/17 Patrick : > > > How do I add data from a fileupload to a database? > > For example, if I have a Book model that is for names

Re: parsing data from fileupload

2009-05-17 Thread Antoni Aloy
2009/5/17 Patrick : > > How do I add data from a fileupload to a database? > For example, if I have a Book model that is for names of books and a > FileNames model that is used on a form, how do I populate Book.title. > > class FileNames(models.Model): >    title =

parsing data from fileupload

2009-05-17 Thread Patrick
How do I add data from a fileupload to a database? For example, if I have a Book model that is for names of books and a FileNames model that is used on a form, how do I populate Book.title. class FileNames(models.Model): title = models.FileField(upload_to='tmp', blank=False) class