> > if form.is_valid():
> > f = request.FILES['file']
> > data_set = DataSet()
> > data_set.save('foo', f)
>
> I suspect this is the problem: you create an empty instnce of DataSet
> and then call its save method. model.save has three optional arguments
> [1]
On Sun, Jun 05, 2011 at 07:18:24PM -0700, Roy Smith wrote:
> I'm trying to figure out how to upload a file. I've got a model that
> looks like:
>
> class DataSet(models.Model):
> file = models.FileField(upload_to='data/%Y/%m/%d')
>
> and my view method is:
>
> def create_data_set(request):
On Sun, 2011-06-05 at 19:18 -0700, Roy Smith wrote:
> ctx = {'form': form}
> ctx.update(csrf(request))
indent these two lines
--
regards
KG
http://lawgon.livejournal.com
Coimbatore LUG rox
http://ilugcbe.techstud.org/
--
You received this message because you are subscribed to the Googl
I'm trying to figure out how to upload a file. I've got a model that
looks like:
class DataSet(models.Model):
file = models.FileField(upload_to='data/%Y/%m/%d')
and my view method is:
def create_data_set(request):
if request.method == 'POST':
form = DataSetForm(request.POST,
4 matches
Mail list logo