Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble with images #29

Open
Chuckpy opened this issue May 25, 2021 · 0 comments
Open

Trouble with images #29

Chuckpy opened this issue May 25, 2021 · 0 comments

Comments

@Chuckpy
Copy link

Chuckpy commented May 25, 2021

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 ?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant