python - Django-filer get absolute URL and Django Celery Upload -


Is it possible to get the full url of the uploaded file only with Django Filer?

My problem is this:

I am using Django Filer to upload music. I then want to submit this file to the Diegogo Celebery for uploading to MyScloud using my API. But ..

I do not know how to get the file's URL. I am not using ideas, I just want to use the administrator, just grab the uploaded file and send it to Galleria to upload it to mixed cloud using my API. But I can only import the object from the model to the celery.

My model:

  class MixcloudUpload (models.Model): files = FilerFileField (null = true, blank = true) data = {'name': 'API Test '} def save (self, * args, ** kwargs): Super (MixcloudUpload, Self). From Save (* Args, ** kwargs) Task Import uploadtask uploadtask .delay (self.id)  

My work:

sets Django Filer upload_at (datetime field) Model attribute upload Please. You can filter it on to get new uploads to forward Mixcloud.

Filler documentation in this regard is a bit difficult to get the full URL. But these two characteristics can be used:

  • File.objects.all () [0] .path , the file is the path to the file system.
  • file. Population: () [0] .url , URL path after domain, such as: / media / filer_public / 23/23 / 34565b67-e1de-41da-3132-1403c335fdd4 / test_img.png / . If you need to include your domain in your own self then the complete path will be something like this: "http" + urlencode (site_obj.domain) + filer_obj.url .

Comments