class Creative(models.Model):
creative = models.FileField(upload_to='creative')
element = models.ForeignKey(Element)
#views.py(1)
attachment = request.FILES[attachment_num]
element.creative_set.create(creative=attachment)
#views.py(2)
attachment = request.FILES[attachment_num]
Creative.objects.create(creative=attachment,element=new_element)
Both of these make an entry in the database 'filename.txt'
But doing so from the admin results in 'creative/filename.txt' which
is what i want
Can anyone spot an error?
Do I have to pass upload_to to create function in views.py?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---