Exception when using variable as part of tag in Django template (Wagtail CMS)Django Template Variables and JavascriptCan I access constants in settings.py from templates in Django?How to put comments in Django templatesHow to set a value of a variable inside a template code?Numeric for loop in Django templatesRendering a template variable as HTMLI don't understand this Django template error messageAngularJS with Django - Conflicting template tagsWagtail Image template tagsTags not found in Wagtail Blog: Using the URLconf defined in mysite.urls, Django tried these URL patterns
Alexandrov's generalization of Cauchy's rigidity theorem
Status of proof by contradiction and excluded middle throughout the history of mathematics?
Why do testers need root cause analysis?
Did significant numbers of Japanese officers escape prosecution during the Tokyo Trials?
Navigating a quick return to previous employer
Unary Enumeration
Time complexity of an algorithm: Is it important to state the base of the logarithm?
Toxic, harassing lab environment
Why isn't Tyrion mentioned in 'A song of Ice and Fire'?
How would a developer who mostly fixed bugs for years at a company call out their contributions in their CV?
Are there guidelines for finding good names for LaTeX 2e packages and control sequences defined in these packages?
Split into three!
Physical only checkdb is failing, but full one is completed successfully
Why did other houses not demand this?
I want to ask company flying me out for office tour if I can bring my fiance
Is superuser the same as root?
Why does Bran want to find Drogon?
How does Dreadhorde Arcanist interact with split cards?
Team has team lunch everyday, am I forced to go?
Are there historical examples of audiences drawn to a work that was "so bad it's good"?
Merge pdfs sequentially
"Official wife" or "Formal wife"?
How can I minimize the damage of an unstable nuclear reactor to the surrounding area?
How to create a `range`-like iterable object of floats?
Exception when using variable as part of tag in Django template (Wagtail CMS)
Django Template Variables and JavascriptCan I access constants in settings.py from templates in Django?How to put comments in Django templatesHow to set a value of a variable inside a template code?Numeric for loop in Django templatesRendering a template variable as HTMLI don't understand this Django template error messageAngularJS with Django - Conflicting template tagsWagtail Image template tagsTags not found in Wagtail Blog: Using the URLconf defined in mysite.urls, Django tried these URL patterns
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
Setting up a Django/Wagtail CMS site. Trying to make a template for images, which takes sizing as an variable, and including the template with:
% include "patterns/molecules/media/image.html" with media=page.featured_image caption=page.image_caption imgclass="extra-wide" sizing="fill-854x480" %
And then in the template, I am using the following code:
% with sizing as size %
% if size %
% image media size as img %
% else %
% image media fill-1280x720 as img %
% endif %
% endwith %
However, it ends up with an exception:
InvalidFilterSpecError at /slug/
Unrecognised operation: size
Request Method: GET
Request URL: http://localhost:8000/slug/
Django Version: 2.1.7
Exception Type: InvalidFilterSpecError
django django-templates wagtail
add a comment |
Setting up a Django/Wagtail CMS site. Trying to make a template for images, which takes sizing as an variable, and including the template with:
% include "patterns/molecules/media/image.html" with media=page.featured_image caption=page.image_caption imgclass="extra-wide" sizing="fill-854x480" %
And then in the template, I am using the following code:
% with sizing as size %
% if size %
% image media size as img %
% else %
% image media fill-1280x720 as img %
% endif %
% endwith %
However, it ends up with an exception:
InvalidFilterSpecError at /slug/
Unrecognised operation: size
Request Method: GET
Request URL: http://localhost:8000/slug/
Django Version: 2.1.7
Exception Type: InvalidFilterSpecError
django django-templates wagtail
If your sizing is a string you're passing into the templateinclude
, why not just write it in theimage.html
include? And the% with sizing as size %
could be removed in favour of simply usingsizing
instead ofsize
(it's creating an extra var in the template, which will cause more logic and confusion in the template in the long run.
– Kalob Taulien
Mar 24 at 19:36
So I'm looking into this and it seems that% include .... with sizing="string-here" %
is then using the string version of the sizing in the% image %
tag which isn't working as you'd expect. It might be better to do the image sizing logic inside the included file.% if size == "fill-1280x720" %% image media fill-1280x720 as img %% endif %
. I'm not 100% certain this is the solution to go with, but it's certainly an option to go with.
– Kalob Taulien
Mar 24 at 19:46
add a comment |
Setting up a Django/Wagtail CMS site. Trying to make a template for images, which takes sizing as an variable, and including the template with:
% include "patterns/molecules/media/image.html" with media=page.featured_image caption=page.image_caption imgclass="extra-wide" sizing="fill-854x480" %
And then in the template, I am using the following code:
% with sizing as size %
% if size %
% image media size as img %
% else %
% image media fill-1280x720 as img %
% endif %
% endwith %
However, it ends up with an exception:
InvalidFilterSpecError at /slug/
Unrecognised operation: size
Request Method: GET
Request URL: http://localhost:8000/slug/
Django Version: 2.1.7
Exception Type: InvalidFilterSpecError
django django-templates wagtail
Setting up a Django/Wagtail CMS site. Trying to make a template for images, which takes sizing as an variable, and including the template with:
% include "patterns/molecules/media/image.html" with media=page.featured_image caption=page.image_caption imgclass="extra-wide" sizing="fill-854x480" %
And then in the template, I am using the following code:
% with sizing as size %
% if size %
% image media size as img %
% else %
% image media fill-1280x720 as img %
% endif %
% endwith %
However, it ends up with an exception:
InvalidFilterSpecError at /slug/
Unrecognised operation: size
Request Method: GET
Request URL: http://localhost:8000/slug/
Django Version: 2.1.7
Exception Type: InvalidFilterSpecError
django django-templates wagtail
django django-templates wagtail
asked Mar 23 at 21:59
Ole Kristian LosvikOle Kristian Losvik
64131426
64131426
If your sizing is a string you're passing into the templateinclude
, why not just write it in theimage.html
include? And the% with sizing as size %
could be removed in favour of simply usingsizing
instead ofsize
(it's creating an extra var in the template, which will cause more logic and confusion in the template in the long run.
– Kalob Taulien
Mar 24 at 19:36
So I'm looking into this and it seems that% include .... with sizing="string-here" %
is then using the string version of the sizing in the% image %
tag which isn't working as you'd expect. It might be better to do the image sizing logic inside the included file.% if size == "fill-1280x720" %% image media fill-1280x720 as img %% endif %
. I'm not 100% certain this is the solution to go with, but it's certainly an option to go with.
– Kalob Taulien
Mar 24 at 19:46
add a comment |
If your sizing is a string you're passing into the templateinclude
, why not just write it in theimage.html
include? And the% with sizing as size %
could be removed in favour of simply usingsizing
instead ofsize
(it's creating an extra var in the template, which will cause more logic and confusion in the template in the long run.
– Kalob Taulien
Mar 24 at 19:36
So I'm looking into this and it seems that% include .... with sizing="string-here" %
is then using the string version of the sizing in the% image %
tag which isn't working as you'd expect. It might be better to do the image sizing logic inside the included file.% if size == "fill-1280x720" %% image media fill-1280x720 as img %% endif %
. I'm not 100% certain this is the solution to go with, but it's certainly an option to go with.
– Kalob Taulien
Mar 24 at 19:46
If your sizing is a string you're passing into the template
include
, why not just write it in the image.html
include? And the % with sizing as size %
could be removed in favour of simply using sizing
instead of size
(it's creating an extra var in the template, which will cause more logic and confusion in the template in the long run.– Kalob Taulien
Mar 24 at 19:36
If your sizing is a string you're passing into the template
include
, why not just write it in the image.html
include? And the % with sizing as size %
could be removed in favour of simply using sizing
instead of size
(it's creating an extra var in the template, which will cause more logic and confusion in the template in the long run.– Kalob Taulien
Mar 24 at 19:36
So I'm looking into this and it seems that
% include .... with sizing="string-here" %
is then using the string version of the sizing in the % image %
tag which isn't working as you'd expect. It might be better to do the image sizing logic inside the included file. % if size == "fill-1280x720" %% image media fill-1280x720 as img %% endif %
. I'm not 100% certain this is the solution to go with, but it's certainly an option to go with.– Kalob Taulien
Mar 24 at 19:46
So I'm looking into this and it seems that
% include .... with sizing="string-here" %
is then using the string version of the sizing in the % image %
tag which isn't working as you'd expect. It might be better to do the image sizing logic inside the included file. % if size == "fill-1280x720" %% image media fill-1280x720 as img %% endif %
. I'm not 100% certain this is the solution to go with, but it's certainly an option to go with.– Kalob Taulien
Mar 24 at 19:46
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55318790%2fexception-when-using-variable-as-part-of-tag-in-django-template-wagtail-cms%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55318790%2fexception-when-using-variable-as-part-of-tag-in-django-template-wagtail-cms%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
If your sizing is a string you're passing into the template
include
, why not just write it in theimage.html
include? And the% with sizing as size %
could be removed in favour of simply usingsizing
instead ofsize
(it's creating an extra var in the template, which will cause more logic and confusion in the template in the long run.– Kalob Taulien
Mar 24 at 19:36
So I'm looking into this and it seems that
% include .... with sizing="string-here" %
is then using the string version of the sizing in the% image %
tag which isn't working as you'd expect. It might be better to do the image sizing logic inside the included file.% if size == "fill-1280x720" %% image media fill-1280x720 as img %% endif %
. I'm not 100% certain this is the solution to go with, but it's certainly an option to go with.– Kalob Taulien
Mar 24 at 19:46