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;








0















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









share|improve this question






















  • 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

















0















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









share|improve this question






















  • 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













0












0








0








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









share|improve this question














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






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Mar 23 at 21:59









Ole Kristian LosvikOle Kristian Losvik

64131426




64131426












  • 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

















  • 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
















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












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
);



);













draft saved

draft discarded


















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















draft saved

draft discarded
















































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.




draft saved


draft discarded














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





















































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







Popular posts from this blog

Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

Swift 4 - func physicsWorld not invoked on collision? The Next CEO of Stack OverflowHow to call Objective-C code from Swift#ifdef replacement in the Swift language@selector() in Swift?#pragma mark in Swift?Swift for loop: for index, element in array?dispatch_after - GCD in Swift?Swift Beta performance: sorting arraysSplit a String into an array in Swift?The use of Swift 3 @objc inference in Swift 4 mode is deprecated?How to optimize UITableViewCell, because my UITableView lags

Access current req object everywhere in Node.js ExpressWhy are global variables considered bad practice? (node.js)Using req & res across functionsHow do I get the path to the current script with Node.js?What is Node.js' Connect, Express and “middleware”?Node.js w/ express error handling in callbackHow to access the GET parameters after “?” in Express?Modify Node.js req object parametersAccess “app” variable inside of ExpressJS/ConnectJS middleware?Node.js Express app - request objectAngular Http Module considered middleware?Session variables in ExpressJSAdd properties to the req object in expressjs with Typescript