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
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,
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
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
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
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 =
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
7 matches
Mail list logo