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 getting templates to work in Django project #204

Closed
saadatqadri opened this issue Dec 1, 2014 · 3 comments
Closed

Trouble getting templates to work in Django project #204

saadatqadri opened this issue Dec 1, 2014 · 3 comments
Labels

Comments

@saadatqadri
Copy link

@stevenschobert this is an amazing library!
I'm having some issues getting templating to work with Instafeed in a Django project. I followed the directions on the site, and I can get the basic setup working. However, when I try to add the template option as suggested, the and tags are empty in my rendered Django template.

Strangely enough, this works on codepen: http://codepen.io/anon/pen/bNVepr

Any help would be great appreciated!

@stevenschobert
Copy link
Owner

Hey @saadatqadri! Sorry to hear you're having issues.

My initial impression, is that you are experiencing something similar to #41, where Django already has the curly-brace {{ }} syntax reserved.

To work around this, either pull your JavaScript code into a separate file (out of your html template), or set your template string ahead of time:

{% with instafeedTemplate="<a href='{{link}}'><img src='{{image}}' /></a>" %}     
<script type="text/javascript">
    var feed = new Instafeed({
        get: 'tagged',
        tagName: 'awesome',
        clientId: 'YOUR_CLIENT_ID',
        template: '{{instafeedTemplate}}'
    });
    feed.run();
</script>
{% endwith %}

@saadatqadri
Copy link
Author

@stevenschobert thanks! I had a feeling it had something to do with django's template.

For reference, {% verbatim %} also works.

@stevenschobert
Copy link
Owner

Ah, good to know! Thanks!

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