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

Passing an object #1

Open
arnolsalas opened this issue Mar 18, 2017 · 8 comments
Open

Passing an object #1

arnolsalas opened this issue Mar 18, 2017 · 8 comments
Labels

Comments

@arnolsalas
Copy link

Hi,

Is there a way I can pass a variable such as {{ object.url }} instead on the url string?

@chris-erickson
Copy link

Sorry, I don't understand the question. Please provide sample code or some examples of what you want and why the current implementation isn't sufficient.

@arnolsalas
Copy link
Author

arnolsalas commented Mar 22, 2017

Hi,

Apologies for the confusion.

In this example:
{% load youtube_thumbnail %}
img src="{% youtube_thumbnail_url 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' %}"

I would like to replace 'https://www.youtube.com/watch?v=dQw4w9WgXcQ' with {{ object.url }} which is coming from a view.

I hope this makes sense.

@chris-erickson
Copy link

Does the django with tag do what you need?

@arnolsalas
Copy link
Author

No, the url variable is being rendered by a view.

@chris-erickson
Copy link

I'm not following how this would be a problem, you could set that context variable before the YouTube tag. {% youtube_thumbnail_url object.url %} might even work.

@arnolsalas
Copy link
Author

Thank you for getting back to me so quickly.

I tried it but it crashes....

@chris-erickson
Copy link

Sorry, I don't have any ideas then with such limited context. I recommend figuring out how to pass context variables around in templates from a view.

@arnolsalas
Copy link
Author

Ok thanks.

Though I am passing context variables to the template all fine. The thing is that the app doesn't seem to recognise the variable and it only works with the actual url string.

Thank you for the patience!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants