I have created a app which will upload the file at a particular location. How can I read the file uploaded after the model is saved? When I click on the file link on change_field_page
it gives page not found. I'm using Django 1.2 and django-admin for this.
Here's my models.py
:
class UploadClass(models.Model):
id=models.AutoField(primary_key=True)
template_name=models.ForeignKey(sas,verbose_name=ugettext_lazy('Template Name'))
sample=models.FileField(upload_to='%Y/%B/',verbose_name=ugettext_lazy('Sample'))
status=models.IntegerField(ugettext_lazy('Status'),choices=statusChoices,default=0)
created_on=models.DateTimeField(ugettext_lazy('Created on'),auto_now_add=True)
def __unicode__(self):
return (self.template_name.name)
I'm not doing anything informs.py
. How can I open the file after saving the object?
One way to do this is to create a view for the 'url' and return the file. Are there any others?