Filefield

3 views
Skip to first unread message

manu.polline

unread,
Feb 22, 2010, 1:05:38 PM2/22/10
to Django REST interface
Hi everyone,
my name is Manuel. I'm tryng to upload a file directly in a filefield
of Django model exposed by django-rest-interface.
It'is possible?
this is my model :

class File(models.Model):
file = models.FileField(upload_to='files',
help_text=_("file itself"))
page = models.ForeignKey(page)

and my urls.py :
json_File_resource = Collection(
queryset = File.objects.all(),
authentication = HttpBasicAuthentication(),
permitted_methods = ('GET', 'POST', 'PUT', 'DELETE'),
receiver = JSONReceiver(),
responder = JSONResponder()
)

urlpatterns = patterns('',
....
....
url(r'^json/CampaignFile/(.*?)/?$',json_File_resource),
...
)

The GET works and the PUT to other field too but not the POST or the
PUT on filefield Field.
How i can pass the local file to the remote Service in the JSON
string?

Please Help Me!!!

Manuel

Reply all
Reply to author
Forward
0 new messages