Skip to content

Trouble with images #29

@Chuckpy

Description

@Chuckpy

Passing an entire object to view context and putting in it to the html that goes to pdf, i'm trying to get an image. Thats the view :

def customer_reader_pdf_view(request,*args,**kwargs):
    pk = kwargs.get('pk')
    customer = get_object_or_404(Customer, pk=pk)
    
    template_path = 'users/pdf_customer.html'
    context = {'customer': customer }       
        ...
    ```
But in the html wen i try to get the image passing the url : 

<img src="{{ customer.logo.url }}" heigth="200px">

Traceback (most recent call last):
File "/home/marcus_andrade/Desktop/pyp/Django_PDF/venv/lib/python3.8/site-packages/xhtml2pdf/context.py", line 773, in _getFileDeprecated
nv = self.pathCallback(name, relative)
TypeError: 'str' object is not callable
Need a valid file name!


I get the url, but it broke my code ... someone could help me ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions