class Photo(models.Model):
image1=models.FileField(blank=True, default="",upload_to="media/images",null=True)
image2=models.FileField(blank=True, default="",upload_to="media/images",null=True)
def __str__(self):
return str(self.image1)
How can i download images from the both field on a pdf file in django rest framework?
Option 1
Looks like this packagesatisfy your needs,
django-easy-pdf
Check the above package
Option 2
We can use templatetag filter
Let say you have image url in your html like below,
Now if we need to add this image into PDF then you can use that package library to handle it.
Create the file as myapp/templatetags/pdf_filters.py:
Now we can load this filter