Converting Boolean Value From Javascript To Django
Converting Boolean Value From Javascript To Django
DOCTYPE html>
<head>
<script
src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>
<script src="https://cdn.sstatic.net/Js/stub.en.js?
v=590a0af41d86"></script>
StackExchange.using("snippets", function () {
StackExchange.snippets.initSnippetRenderer();
});
StackExchange.using("postValidation", function () {
StackExchange.postValidation.initOnBlurAndSubmit($('#post-
form'), 2, 'answer');
});
StackExchange.question.init({showAnswerHelp:true,totalCommentCount:3,shownCommentCo
unt:3,questionId:18178564});
styleCode();
StackExchange.realtime.subscribeToQuestion('1', '18178564');
StackExchange.using("gps", function ()
{ StackExchange.gps.trackOutboundClicks('#content', '.js-post-body'); });
});
</script>
<script>
StackExchange.init({"locale":"en","serverTime":1605124137,"routeName":"Questions/Sh
ow","stackAuthUrl":"https://stackauth.com","networkMetaHostname":"meta.stackexchang
e.com","site":{"name":"Stack Overflow","description":"Q&A for professional and
enthusiast
programmers","isNoticesTabEnabled":true,"enableNewTagCreationWarning":true,"insertS
paceAfterNameTabCompletion":false,"id":1,"childUrl":"https://meta.stackoverflow.com
","styleCodeWithHighlightjs":true,"negativeVoteScoreFloor":null,"enableSocialMediaI
nSharePopup":true,"protocol":"https"},"user":
{"fkey":"af4d746ccaa257ce6f52b2a02ba11ab0a0ec14bc8b64cd15310f0684e4e09a40","tid":"f
39b2831-c6dd-cddf-1314-
386ec56b92cc","rep":0,"isAnonymous":true,"isAnonymousNetworkWide":true},"events":
{"postType":{"question":1},"postEditionSection":
{"title":1,"body":2,"tags":3}},"story":
{"minCompleteBodyLength":75,"likedTagsMaxLength":300,"dislikedTagsMaxLength":300},"
jobPreferences":
{"maxNumDeveloperRoles":2,"maxNumIndustries":4},"svgIconPath":"https://cdn.sstatic.
net/Img/svg-icons","svgIconHash":"dedb5faddfc5"}, {"userProfile":
{"openGraphAPIKey":"4a307e43-b625-49bb-af15-ffadf2bda017"},"userMessaging":
{"showNewFeatureNotice":true},"tags":{},"subscriptions":
{"defaultMaxTrueUpSeats":1000},"snippets":
{"renderDomain":"stacksnippets.net","snippetsEnabled":true},"slack":
{"sidebarAdDismissCookie":"slack-sidebar-
ad","sidebarAdDismissCookieExpirationDays":60.0},"site":
{"allowImageUploads":true,"enableImgurHttps":true,"enableUserHovercards":true,"forc
eHttpsImages":true,"styleCode":true},"intercom":
{"appId":"inf0secd","hostBaseUrl":"https://stacksnippets.net"},"paths":
{},"monitoring":
{"clientTimingsAbsoluteTimeout":30000,"clientTimingsDebounceTimeout":1000},"mention
s":{"maxNumUsersInDropdown":50},"markdown":{},"flags":
{"allowRetractingCommentFlags":true,"allowRetractingFlags":true},"comments":
{},"accounts":{"currentPasswordRequiredForChangingStackIdPassword":true}});
StackExchange.using.setCacheBreakers({"js/adops.en.js":"22a9bd59b1e9","js/ask.en.js
":"83cc8cb596d5","js/begin-edit-
event.en.js":"6f8588669000","js/events.en.js":"396188a6a1bc","js/explore-
qlist.en.js":"5c7424c271ef","js/full-
anon.en.js":"258cd19050a2","js/full.en.js":"08d6b34e1a3b","js/help.en.js":"b66b9c5b
699c","js/highlightjs-loader.en.js":"b5a6c6f2ceb3","js/inline-tag-
editing.en.js":"88510a5b8778","js/keyboard-
shortcuts.en.js":"6805fd97c9ed","js/markdown-it-
loader.en.js":"e8730cf897c1","js/mobile.en.js":"1aab4f795d25","js/moderator.en.js":
"3fe2641ab663","js/postCollections-transpiled.en.js":"5e7b256b3872","js/post-
validation.en.js":"55cf6db930db","js/prettify-
full.en.js":"1298163481a4","js/question-
editor.en.js":"","js/review.en.js":"c6b0397a2685","js/revisions.en.js":"f20f2a79bff
d","js/stacks-
editor.en.js":"0a198d953f96","js/tageditor.en.js":"2b373678c7e7","js/tageditornew.e
n.js":"530dfdab7cd3","js/tagsuggestions.en.js":"9b2c5d9791d2","js/wmd.en.js":"f06a4
0c71118","js/snippet-javascript-codemirror.en.js":"a2f8117ba2f3"});
StackExchange.using("gps", function() {
StackExchange.gps.init(true);
});
</script>
<noscript id="noscript-css"><style>body,.top-bar{margin-
top:1.9em}</style></noscript>
</head>
<body class="question-page unified-theme">
<div id="notify-container"></div>
<div id="custom-header"></div>
</div>
<li class="grid--cell">
<a href="#"
class="-marketing-link js-gps-track js-products-menu"
aria-controls="products-popover"
data-controller="s-popover"
data-action="s-popover#toggle"
data-s-popover-placement="bottom"
data-s-popover-toggle-class="is-selected"
data-gps-track="top_nav.products.click({location:2,
destination:1})"
data-ga="["top navigation","products menu
click",null,null,null]">
Products
</a>
</li>
<li class="-ctas">
<a href="https://stackoverflow.com/users/login?
ssrc=head&returnurl=https%3a%2f%2ffanyv88.com%3a443%2fhttps%2fstackoverflow.com%2fquestions
%2f18178564%2fconverting-boolean-value-from-javascript-to-django" class="login-link
s-btn s-btn__filled py8 js-gps-track" rel="nofollow"
data-gps-track="login.click" data-ga="["top
navigation","login button click",null,null,null]">Log in</a>
<a href="https://stackoverflow.com/users/signup?
ssrc=head&returnurl=%2fusers%2fstory%2fcurrent" class="login-link s-btn s-
btn__primary py8" rel="nofollow" data-ga="["sign up","Sign Up
Navigation","Header",null,null]">Sign up</a>
</li>
</div>
<div class="related-links">
<a href="https://stackoverflow.com/help" class="js-gps-track" data-gps-
track="site_switcher.click({ item_type:14 })">help</a>
<a href="https://chat.stackoverflow.com/?
tab=site&host=stackoverflow.com" class="js-gps-track" data-gps-
track="site_switcher.click({ item_type:6 })">chat</a>
</div>
</li>
<li class="related-site grid">
<div class="L-shaped-icon-container">
<span class="L-shaped-icon"></span>
</div>
<a href="https://meta.stackoverflow.com"
class=" site-link js-gps-track grid gs8 gsx"
data-id="552"
data-gps-track="site.switch({ target_site:552,
item_type:3 }),site_switcher.click({ item_type:4 })">
<div class="favicon favicon-stackoverflowmeta site-icon grid--cell"
title="Meta Stack Overflow"></div>
<span class="grid--cell fl1">
Meta Stack Overflow
</span>
</a>
</li>
</ul>
</div>
</div>
<div class="modal-content" id="your-communities-section">
<div class="call-to-login">
<a href="https://stackoverflow.com/users/signup?ssrc=site_switcher&returnurl=
%2fusers%2fstory%2fcurrent" class="login-link js-gps-track" data-gps-
track="site_switcher.click({ item_type:10 })">Sign up</a> or <a
href="https://stackoverflow.com/users/login?ssrc=site_switcher&returnurl=https
%3a%2f%2fstackoverflow.com%2fquestions%2f18178564%2fconverting-boolean-value-from-
javascript-to-django" class="login-link js-gps-track" data-gps-
track="site_switcher.click({ item_type:11 })">log in</a> to customize your list.
</div>
</div>
<div class="header">
<h3><a href="https://stackexchange.com/sites">more stack exchange
communities</a>
</h3>
<a href="https://stackoverflow.blog" class="fr">company blog</a>
</div>
<div class="modal-content">
<div class="child-content"></div>
</div>
</div>
</li>
</ol>
</div>
</header>
<div id="js-gdpr-consent-banner" class="p8 ff-sans ps-fixed b0 l0 r0 z-banner"
role="banner" aria-hidden="false" style="background-color: #3b4045; color: white;">
<script>
StackExchange.ready(function () { StackExchange.topbar.init(); });
StackExchange.scrollPadding.setPaddingTop(50, 10); </script>
<div class="container">
data-gps-track="top_nav.click({is_current:false, location:2,
destination:8})">
<div class="grid ai-center">
<div class="grid--cell truncate">
Home
</div>
</div>
</a>
</li>
<li>
<ol class="nav-links">
<li class="fs-fine tt-uppercase ml8 mt16 mb4 fc-
light">Public</li>
data-gps-track="top_nav.click({is_current:true, location:2,
destination:1})">
<svg aria-hidden="true" class="svg-icon iconGlobe" width="18" height="18"
viewBox="0 0 18 18"><path d="M9 1a8 8 0 100 16A8 8 0 009 1zM8 15.32a6.4 6.4 0 01-
5.23-7.75L7 11.68v.8c0 .88.12 1.32 1 1.32v1.52zm5.72-2c-.2-.66-1-1.32-1.72-1.32h-
1v-2c0-.44-.56-1-1-1H6V7h1c.44 0 1-.56 1-1V5h2c.88 0 1.4-.72 1.4-1.6v-.33a6.4 6.4 0
012.32 10.24v.01z"/></svg> <span class="-link--channel-
name">Stack Overflow</span>
</a>
</li>
<li class="">
<a id="nav-tags"
href="/tags"
class=" js-gps-track nav-links--link"
data-gps-track="top_nav.click({is_current:false, location:2,
destination:2})">
<div class="grid ai-center">
<div class="grid--cell truncate">
Tags
</div>
</div>
</a>
</li>
<li class="">
<a id="nav-users"
href="/users"
class=" js-gps-track nav-links--link"
data-gps-track="top_nav.click({is_current:false, location:2,
destination:3})">
<div class="grid ai-center">
<div class="grid--cell truncate">
Users
</div>
</div>
</a>
</li>
<li class="fs-fine tt-uppercase ml8 mt16 mb4 fc-
light">Find a Job</li>
<li class="">
<a id="nav-jobs"
href="/jobs?so_medium=StackOverflow&so_source=SiteNav"
class=" js-gps-track nav-links--link"
data-gps-track="top_nav.click({is_current:false, location:2,
destination:6})">
<div class="grid ai-center">
<div class="grid--cell truncate">
Jobs
</div>
</div>
</a>
</li>
<li class="">
<a id="nav-companies"
href="/jobs/companies?
so_medium=StackOverflow&so_source=SiteNav"
class=" js-gps-track nav-links--link"
data-gps-track="top_nav.click({is_current:false, location:2,
destination:12})">
<div class="grid ai-center">
<div class="grid--cell truncate">
Companies
</div>
</div>
</a>
</li>
</ol>
</li>
<li>
<ol class="nav-links">
<li class="grid ai-center jc-space-between ml8 mt24
mb4">
<div class="grid--cell tt-uppercase fs-fine fc-
light">Teams</div>
<div class="grid--cell fs-fine fc-light mr4">
<a href="javascript:void(0)" class="s-link
s-link__inherit js-gps-track"
role="button"
aria-controls="popover-teams-create-
cta"
data-controller="s-popover"
data-action="s-popover#toggle"
data-s-popover-placement="bottom-start"
data-s-popover-toggle-class="is-
selected"
data-gps-track="teams.create.left-
sidenav.click({ Action: ShowInfo })"
data-ga="["teams left navigation -
anonymous","left nav show teams info",null,null,null]">
What’s this?
</a>
</div>
</li>
<li class="ps-relative">
<a href="https://stackoverflow.com/teams"
class="pl8 js-gps-track nav-links--link"
title="Stack Overflow for Teams is a
private, secure spot for your organization's questions and answers."
data-gps-track="teams.create.left-
sidenav.click({ Action: TeamsClick })"
data-ga="["teams left navigation -
anonymous","left nav team
click","stackoverflow.com/teams",null,null]">
<div class="grid ai-center">
<div class="grid--cell s-avatar va-
middle bg-orange-400">
<div class="s-avatar--letter mtn1">
<svg aria-hidden="true"
class="svg-icon iconBriefcaseSm" width="14" height="14" viewBox="0 0 14 14"><path
d="M4 3a1 1 0 011-1h4a1 1 0 011 1v1h.5c.83 0 1.5.67 1.5 1.5v5c0 .83-.67 1.5-1.5
1.5h-7A1.5 1.5 0 012 10.5v-5C2 4.67 2.67 4 3.5 4H4V3zm5 1V3H5v1h4z"/></svg>
</div>
<svg aria-hidden="true"
class="native s-avatar--badge svg-icon iconShieldXSm" width="9" height="10"
viewBox="0 0 9 10"><path d="M0 1.84L4.5 0 9 1.84v3.17C9 7.53 6.3 10 4.5 10 2.7 10 0
7.53 0 5.01V1.84z" fill="var(--white)"/><path d="M1 2.5L4.5 1 8 2.5v2.51C8 7.34
5.34 9 4.5 9 3.65 9 1 7.34 1 5.01V2.5zm2.98 3.02L3.2 7h2.6l-.78-1.48a.4.4 0
01.15-.38c.34-.24.73-.7.73-1.14 0-.71-.5-1.23-1.41-1.23-.92 0-1.39.52-1.39 1.23 0 .
44.4.9.73 1.14.12.08.18.23.15.38z" fill="var(--black-500)"/></svg>
</div>
<div class="grid--cell pl6">
Free 30 Day Trial </div>
</div>
</a>
</li>
</ol>
</li>
</ol>
</nav>
</div>
</div>
</div>
</div>
<div class="grid fw-wrap pb8 mb16 bb bc-black-075">
<div class="grid--cell ws-nowrap mr16 mb8" title="2013-08-12
01:55:27Z">
<span class="fc-light mr2">Asked</span>
<time itemprop="dateCreated" datetime="2013-08-
12T01:55:27">7 years, 3 months ago</time>
</div>
<div class="grid--cell ws-nowrap mr16 mb8">
<span class="fc-light mr2">Active</span>
<a href="?lastactivity" class="s-link s-link__inherit"
title="2020-05-13 01:22:20Z">6 months ago</a>
</div>
<div class="grid--cell ws-nowrap mb8" title="Viewed 12,303
times">
<span class="fc-light mr2">Viewed</span>
12k times
</div>
</div>
<div id="mainbar" role="main" aria-label="question and answers">
<div class="post-layout">
<div class="votecell post-layout--left">
<div class="js-voting-container grid jc-center fd-column ai-stretch gs4
fc-black-200" data-post-id="18178564">
<button class="js-vote-up-btn grid--cell s-btn s-btn__unset c-pointer"
data-controller="s-tooltip" data-s-tooltip-placement="right" title="This question
shows research effort; it is useful and clear" aria-pressed="false" aria-label="Up
vote" data-selected-classes="fc-theme-primary"><svg aria-hidden="true" class="m0
svg-icon iconArrowUpLg" width="36" height="36" viewBox="0 0 36 36"><path d="M2
26h32L18 10 2 26z"/></svg></button>
<div class="js-vote-count grid--cell fc-black-500 fs-title grid fd-column
ai-center" itemprop="upvoteCount" data-value="12">12</div>
<button class="js-vote-down-btn grid--cell s-btn s-btn__unset c-pointer"
data-controller="s-tooltip" data-s-tooltip-placement="right" title="This question
does not show any research effort; it is unclear or not useful" aria-
pressed="false" aria-label="Down vote" data-selected-classes="fc-theme-
primary"><svg aria-hidden="true" class="m0 svg-icon iconArrowDownLg" width="36"
height="36" viewBox="0 0 36 36"><path d="M2 10h32L18 26 2 10z"/></svg></button>
</div>
</div>
<p>I noticed that when Boolean data is sent from javascript to Django view, it is
passed as "true"/"false" (lowercase) instead of "True"/"False"(uppercase). This
causes an unexpected behavior in my application. For example:</p>
<p><strong>vote.js</strong></p>
<pre><code> ....
var xhr = {
'isUpvote': isUpvote
};
return false;
});
</code></pre>
<p><strong>views.py</strong></p>
vote.isUp = isUpvote
vote.save()
</code></pre>
<p>when I save this vote and check my Django admin page, "isUpvote" is ALWAYS set
to True whether true or false is passed from javascript. So what is the best way to
convert javascript's "true/false" boolean value to Django's "True/False" value???
</p>
<p>Thanks!!</p>
<p><strong>ADDED:::::</strong></p>
<p>Well, I added some 'print' lines to check whether I was doing something wrong in
my view:</p>
<pre><code> print(vote.isUp)
vote.isUp = isUpvote
print(vote.isUp)
vote.save()
</code></pre>
<p>The result:</p>
<pre><code> True
false //lowercase
</code></pre>
<div class="post-menu">
<a href="/q/18178564"
rel="nofollow"
itemprop="url"
class="js-share-link js-gps-track"
title="short permalink to this question"
data-gps-track="post.click({ item: 2, priv: 0, post_type: 1 })"
data-controller="se-share-sheet"
data-se-share-sheet-title="Share a link to this question"
data-se-share-sheet-subtitle=""
data-se-share-sheet-post-type="question"
data-se-share-sheet-social="facebook twitter devto"
data-se-share-sheet-location="1"
data-se-share-sheet-license-url="https%3a%2f%2ffanyv88.com%3a443%2fhttps%2fcreativecommons.org
%2flicenses%2fby-sa%2f3.0%2f"
data-se-share-sheet-license-name="CC BY-SA 3.0"
data-s-popover-placement="bottom-start">share</a>
<span class="lsep">|</span>
<a href="/posts/18178564/edit" class="suggest-edit-post js-gps-
track" data-gps-track="post.click({ item: 6, priv: 0, post_type: 1 })"
title="">improve this question</a>
<span class="lsep">|</span>
<button id="btnFollowPost-18178564" class="s-btn s-btn__link fc-black-400 h:fc-
black-700 pb2 js-follow-post js-follow-question js-gps-track" role="button"
data-gps-track="post.click({ item: 14, priv: 0, post_type: 1 })"
data-controller="s-tooltip " data-s-tooltip-placement="bottom"
data-s-popover-placement="bottom" aria-controls=""
title="Follow this question to receive notifications">
follow
</button>
<span class="lsep">|</span>
</div>
</div>
</div>
<div class="user-details" itemprop="author" itemscope
itemtype="http://schema.org/Person">
<span class="d-none" itemprop="name">user2492270</span>
<div class="-flair">
</div>
</div>
</div> </div>
<div class="post-signature owner grid--cell">
<div class="user-info ">
<div class="user-action-time">
asked <span title="2013-08-12 01:55:27Z" class="relativetime">Aug 12 '13 at
1:55</span>
</div>
<div class="user-gravatar32">
<a href="/users/2492270/user2492270"><div class="gravatar-wrapper-32"><img
src="https://www.gravatar.com/avatar/4d69aee6501acddb1f794fa49682f982?
s=32&d=identicon&r=PG" alt="" width="32" height="32" class="bar-
sm"></div></a>
</div>
<div class="user-details" itemprop="author" itemscope
itemtype="http://schema.org/Person">
<a href="/users/2492270/user2492270">user2492270</a><span class="d-none"
itemprop="name">user2492270</span>
<div class="-flair">
<span class="reputation-score" title="reputation score "
dir="ltr">1,853</span><span title="5 gold badges" aria-hidden="true"><span
class="badge1"></span><span class="badgecount">5</span></span><span class="v-
visible-sr">5 gold badges</span><span title="30 silver badges" aria-
hidden="true"><span class="badge2"></span><span
class="badgecount">30</span></span><span class="v-visible-sr">30 silver
badges</span><span title="52 bronze badges" aria-hidden="true"><span
class="badge3"></span><span class="badgecount">52</span></span><span class="v-
visible-sr">52 bronze badges</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="post-layout--right">
<div id="comments-18178564" class="comments js-comments-container bt bc-
black-075 mt12 " data-post-id="18178564" data-min-length="15">
<ul class="comments-list js-comments-list"
data-remaining-comments-count="0"
data-canpost="false"
data-cansee="true"
data-comments-unavailable="false"
data-addlink-disabled="true">
– <a href="/users/1066922/woofmeow"
title="2,180 reputation"
class="comment-user">woofmeow</a>
<span class="comment-date" dir="ltr"><span title="2013-08-12
02:01:13Z, License: CC BY-SA 3.0" class="relativetime-clean">Aug 12 '13 at
2:01</span></span>
</div>
</div>
</li>
<li id="comment-26635122" class="comment js-comment " data-comment-
id="26635122">
<div class="js-comment-actions comment-actions">
<div class="comment-score js-comment-edit-hide">
</div>
</div>
<div class="comment-text js-comment-text-and-form">
<div class="comment-body js-comment-edit-hide">
– <a href="/users/1353011/musa"
title="87,171 reputation"
class="comment-user">Musa</a>
<span class="comment-date" dir="ltr"><span title="2013-08-12
02:02:47Z, License: CC BY-SA 3.0" class="relativetime-clean">Aug 12 '13 at
2:02</span></span>
</div>
</div>
</li>
<li id="comment-43877026" class="comment js-comment " data-comment-
id="43877026">
<div class="js-comment-actions comment-actions">
<div class="comment-score js-comment-edit-hide">
<span title="number of 'useful comment' votes
received"
class="cool">1</span>
</div>
</div>
<div class="comment-text js-comment-text-and-form">
<div class="comment-body js-comment-edit-hide">
– <a href="/users/1839532/wasabigeek"
title="1,933 reputation"
class="comment-user">wasabigeek</a>
<span class="comment-date" dir="ltr"><span title="2015-01-01
17:09:33Z, License: CC BY-SA 3.0" class="relativetime-clean">Jan 1 '15 at
17:09</span></span>
<span title="this comment was edited 1 time">
<svg aria-hidden="true" class="va-text-bottom o50 svg-
icon iconPencilSm" width="14" height="14" viewBox="0 0 14 14"><path d="M11.1
1.71l1.13 1.12c.2.2.2.51 0 .71L11.1 4.7 9.21 2.86l1.17-1.15c.2-.2.51-.2.71 0zM2
10.12l6.37-6.43 1.88 1.88L3.88 12H2v-1.88z"/></svg>
</span>
</div>
</div>
</li>
</ul>
</div>
<div id="answers">
<a name="tab-top"></a>
<div id="answers-header">
<div class="answers-subheader grid ai-center mb8">
<div class="grid--cell fl1">
<h2 class="mb0" data-answercount="11">
11 Answers
<span style="display:none;"
itemprop="answerCount">11</span>
</h2>
</div>
<div class="grid--cell">
<div class=" grid s-btn-group js-filter-btn">
<a class="grid--cell s-btn s-btn__muted s-btn__outlined"
href="/questions/18178564/converting-boolean-value-from-javascript-to-django?
answertab=active#tab-top" data-nav-xhref="" title="Answers with the latest activity
first" data-value="active" data-shortcut="A">
Active</a>
<a class="grid--cell s-btn s-btn__muted s-btn__outlined"
href="/questions/18178564/converting-boolean-value-from-javascript-to-django?
answertab=oldest#tab-top" data-nav-xhref="" title="Answers in the order they were
provided" data-value="oldest" data-shortcut="O">
Oldest</a>
<a class="youarehere is-selected grid--cell s-btn s-btn__muted s-
btn__outlined" href="/questions/18178564/converting-boolean-value-from-javascript-
to-django?answertab=votes#tab-top" data-nav-xhref="" title="Answers with the
highest score first" data-value="votes" data-shortcut="V">
Votes</a>
</div>
</div>
</div>
<script>
$(document)
.ready(function () {
var notification = $('.js-mfnes-container');
notification.find('.js-mfnes-dismiss').on('click',
function () {
notification.remove();
$.ajax("/mfnes/dismiss/18178564/es/1");
});
notification.find('.js-mfnes-link a').on('click',
function () {
$.ajax("/mfnes/click/18178564/es/1");
});
});
</script> </div>
<a name="18179151"></a>
<div id="answer-18179151" class="answer accepted-answer" data-answerid="18179151"
itemprop="acceptedAnswer" itemscope itemtype="http://schema.org/Answer">
<div class="post-layout">
<div class="votecell post-layout--left">
<div class="js-voting-container grid jc-center fd-column ai-stretch gs4
fc-black-200" data-post-id="18179151">
<button class="js-vote-up-btn grid--cell s-btn s-btn__unset c-pointer"
data-controller="s-tooltip" data-s-tooltip-placement="right" title="This answer is
useful" aria-pressed="false" aria-label="Up vote" data-selected-classes="fc-theme-
primary"><svg aria-hidden="true" class="m0 svg-icon iconArrowUpLg" width="36"
height="36" viewBox="0 0 36 36"><path d="M2 26h32L18 10 2 26z"/></svg></button>
<div class="js-vote-count grid--cell fc-black-500 fs-title grid fd-column
ai-center" itemprop="upvoteCount" data-value="5">5</div>
<button class="js-vote-down-btn grid--cell s-btn s-btn__unset c-pointer"
data-controller="s-tooltip" data-s-tooltip-placement="right" title="This answer is
not useful" aria-pressed="false" aria-label="Down vote" data-selected-classes="fc-
theme-primary"><svg aria-hidden="true" class="m0 svg-icon iconArrowDownLg"
width="36" height="36" viewBox="0 0 36 36"><path d="M2 10h32L18 26 2
10z"/></svg></button>
</div>
</div>
<div class="post-menu">
<a href="/a/18179151"
rel="nofollow"
itemprop="url"
class="js-share-link js-gps-track"
title="short permalink to this answer"
data-gps-track="post.click({ item: 2, priv: 0, post_type: 2 })"
data-controller="se-share-sheet"
data-se-share-sheet-title="Share a link to this answer"
data-se-share-sheet-subtitle=""
data-se-share-sheet-post-type="answer"
data-se-share-sheet-social="facebook twitter devto"
data-se-share-sheet-location="2"
data-se-share-sheet-license-url="https%3a%2f%2ffanyv88.com%3a443%2fhttps%2fcreativecommons.org
%2flicenses%2fby-sa%2f3.0%2f"
data-se-share-sheet-license-name="CC BY-SA 3.0"
data-s-popover-placement="bottom-start">share</a>
<span class="lsep">|</span>
<a href="/posts/18179151/edit" class="suggest-edit-post js-gps-
track" data-gps-track="post.click({ item: 6, priv: 0, post_type: 2 })"
title="">improve this answer</a>
<span class="lsep">|</span>
<button id="btnFollowPost-18179151" class="s-btn s-btn__link fc-black-400 h:fc-
black-700 pb2 js-follow-post js-follow-answer js-gps-track" role="button"
data-gps-track="post.click({ item: 14, priv: 0, post_type: 2 })"
data-controller="s-tooltip " data-s-tooltip-placement="bottom"
data-s-popover-placement="bottom" aria-controls=""
title="Follow this answer to receive notifications">
follow
</button>
<span class="lsep">|</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="post-layout--right">
<div id="comments-18179151" class="comments js-comments-container bt bc-
black-075 mt12 " data-post-id="18179151" data-min-length="15">
<ul class="comments-list js-comments-list"
data-remaining-comments-count="0"
data-canpost="false"
data-cansee="true"
data-comments-unavailable="false"
data-addlink-disabled="true">
– <a href="/users/1202214/andreas-bergstr%c3%b6m"
title="9,962 reputation"
class="comment-user">Andreas Bergström</a>
<span class="comment-date" dir="ltr"><span title="2018-05-03
08:58:48Z, License: CC BY-SA 4.0" class="relativetime-clean">May 3 '18 at
8:58</span></span>
</div>
</div>
</li>
</ul>
</div>
<a name="31383709"></a>
<div id="answer-31383709" class="answer" data-answerid="31383709"
itemprop="suggestedAnswer" itemscope itemtype="http://schema.org/Answer">
<div class="post-layout">
<div class="votecell post-layout--left">
<div class="js-voting-container grid jc-center fd-column ai-stretch gs4
fc-black-200" data-post-id="31383709">
<button class="js-vote-up-btn grid--cell s-btn s-btn__unset c-pointer"
data-controller="s-tooltip" data-s-tooltip-placement="right" title="This answer is
useful" aria-pressed="false" aria-label="Up vote" data-selected-classes="fc-theme-
primary"><svg aria-hidden="true" class="m0 svg-icon iconArrowUpLg" width="36"
height="36" viewBox="0 0 36 36"><path d="M2 26h32L18 10 2 26z"/></svg></button>
<div class="js-vote-count grid--cell fc-black-500 fs-title grid fd-column
ai-center" itemprop="upvoteCount" data-value="11">11</div>
<button class="js-vote-down-btn grid--cell s-btn s-btn__unset c-pointer"
data-controller="s-tooltip" data-s-tooltip-placement="right" title="This answer is
not useful" aria-pressed="false" aria-label="Down vote" data-selected-classes="fc-
theme-primary"><svg aria-hidden="true" class="m0 svg-icon iconArrowDownLg"
width="36" height="36" viewBox="0 0 36 36"><path d="M2 10h32L18 26 2
10z"/></svg></button>
</div>
</div>
<pre><code>import json
<div class="post-menu">
<a href="/a/31383709"
rel="nofollow"
itemprop="url"
class="js-share-link js-gps-track"
title="short permalink to this answer"
data-gps-track="post.click({ item: 2, priv: 0, post_type: 2 })"
data-controller="se-share-sheet"
data-se-share-sheet-title="Share a link to this answer"
data-se-share-sheet-subtitle=""
data-se-share-sheet-post-type="answer"
data-se-share-sheet-social="facebook twitter devto"
data-se-share-sheet-location="2"
data-se-share-sheet-license-url="https%3a%2f%2ffanyv88.com%3a443%2fhttps%2fcreativecommons.org
%2flicenses%2fby-sa%2f3.0%2f"
data-se-share-sheet-license-name="CC BY-SA 3.0"
data-s-popover-placement="bottom-start">share</a>
<span class="lsep">|</span>
<a href="/posts/31383709/edit" class="suggest-edit-post js-gps-
track" data-gps-track="post.click({ item: 6, priv: 0, post_type: 2 })"
title="">improve this answer</a>
<span class="lsep">|</span>
<button id="btnFollowPost-31383709" class="s-btn s-btn__link fc-black-400 h:fc-
black-700 pb2 js-follow-post js-follow-answer js-gps-track" role="button"
data-gps-track="post.click({ item: 14, priv: 0, post_type: 2 })"
data-controller="s-tooltip " data-s-tooltip-placement="bottom"
data-s-popover-placement="bottom" aria-controls=""
title="Follow this answer to receive notifications">
follow
</button>
<span class="lsep">|</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="post-layout--right">
<div id="comments-31383709" class="comments js-comments-container bt bc-
black-075 mt12 dno" data-post-id="31383709" data-min-length="15">
<ul class="comments-list js-comments-list"
data-remaining-comments-count="0"
data-canpost="false"
data-cansee="true"
data-comments-unavailable="false"
data-addlink-disabled="true">
</ul>
</div>
<a name="23358673"></a>
<div id="answer-23358673" class="answer" data-answerid="23358673"
itemprop="suggestedAnswer" itemscope itemtype="http://schema.org/Answer">
<div class="post-layout">
<div class="votecell post-layout--left">
<div class="js-voting-container grid jc-center fd-column ai-stretch gs4
fc-black-200" data-post-id="23358673">
<button class="js-vote-up-btn grid--cell s-btn s-btn__unset c-pointer"
data-controller="s-tooltip" data-s-tooltip-placement="right" title="This answer is
useful" aria-pressed="false" aria-label="Up vote" data-selected-classes="fc-theme-
primary"><svg aria-hidden="true" class="m0 svg-icon iconArrowUpLg" width="36"
height="36" viewBox="0 0 36 36"><path d="M2 26h32L18 10 2 26z"/></svg></button>
<div class="js-vote-count grid--cell fc-black-500 fs-title grid fd-column
ai-center" itemprop="upvoteCount" data-value="4">4</div>
<button class="js-vote-down-btn grid--cell s-btn s-btn__unset c-pointer"
data-controller="s-tooltip" data-s-tooltip-placement="right" title="This answer is
not useful" aria-pressed="false" aria-label="Down vote" data-selected-classes="fc-
theme-primary"><svg aria-hidden="true" class="m0 svg-icon iconArrowDownLg"
width="36" height="36" viewBox="0 0 36 36"><path d="M2 10h32L18 26 2
10z"/></svg></button>
</div>
</div>
<pre><code>def convert_trueTrue_falseFalse(input):
if input.lower() == 'false':
return False
elif input.lower() == 'true':
return True
else:
raise ValueError("...")
</code></pre>
</div>
</div>
</div>
</div>
</div>
<div class="post-layout--right">
<div id="comments-23358673" class="comments js-comments-container bt bc-
black-075 mt12 dno" data-post-id="23358673" data-min-length="15">
<ul class="comments-list js-comments-list"
data-remaining-comments-count="0"
data-canpost="false"
data-cansee="true"
data-comments-unavailable="false"
data-addlink-disabled="true">
</ul>
</div>
<a name="22536916"></a>
<div id="answer-22536916" class="answer" data-answerid="22536916"
itemprop="suggestedAnswer" itemscope itemtype="http://schema.org/Answer">
<div class="post-layout">
<div class="votecell post-layout--left">
<div class="js-voting-container grid jc-center fd-column ai-stretch gs4
fc-black-200" data-post-id="22536916">
<button class="js-vote-up-btn grid--cell s-btn s-btn__unset c-pointer"
data-controller="s-tooltip" data-s-tooltip-placement="right" title="This answer is
useful" aria-pressed="false" aria-label="Up vote" data-selected-classes="fc-theme-
primary"><svg aria-hidden="true" class="m0 svg-icon iconArrowUpLg" width="36"
height="36" viewBox="0 0 36 36"><path d="M2 26h32L18 10 2 26z"/></svg></button>
<div class="js-vote-count grid--cell fc-black-500 fs-title grid fd-column
ai-center" itemprop="upvoteCount" data-value="3">3</div>
<button class="js-vote-down-btn grid--cell s-btn s-btn__unset c-pointer"
data-controller="s-tooltip" data-s-tooltip-placement="right" title="This answer is
not useful" aria-pressed="false" aria-label="Down vote" data-selected-classes="fc-
theme-primary"><svg aria-hidden="true" class="m0 svg-icon iconArrowDownLg"
width="36" height="36" viewBox="0 0 36 36"><path d="M2 10h32L18 26 2
10z"/></svg></button>
</div>
</div>
<h2>Problem:</h2>
<p>If I send below JSON to server, boolean fields come as test("true", "false") and
I must be access to <code>catalogues</code> as
<code>request.POST.getlist("catalogues[]")</code>. Also I can't make form
validation easly.</p>
<pre><code>var data = {
"name": "foo",
"catalogues": [1,2,3],
"is_active": false
}
<h2>Solution</h2>
<p>I get rid of this problems by sending json data as <strong>string</strong> and
converting data to back to json at server side. </p>
catalogues = data['catalogues']
is_active = data['is_active']
</code></pre>
<p>Now I can made form validation and code is more clean :)</p>
</div>
<div class="mt24">
<div class="grid fw-wrap ai-start jc-end gs8 gsy">
<time itemprop="dateCreated" datetime="2014-03-20T14:59:51"></time>
<div class="grid--cell mr16" style="flex: 1 1 100px;">
<div class="post-menu">
<a href="/a/22536916"
rel="nofollow"
itemprop="url"
class="js-share-link js-gps-track"
title="short permalink to this answer"
data-gps-track="post.click({ item: 2, priv: 0, post_type: 2 })"
data-controller="se-share-sheet"
data-se-share-sheet-title="Share a link to this answer"
data-se-share-sheet-subtitle=""
data-se-share-sheet-post-type="answer"
data-se-share-sheet-social="facebook twitter devto"
data-se-share-sheet-location="2"
data-se-share-sheet-license-url="https%3a%2f%2ffanyv88.com%3a443%2fhttps%2fcreativecommons.org
%2flicenses%2fby-sa%2f3.0%2f"
data-se-share-sheet-license-name="CC BY-SA 3.0"
data-s-popover-placement="bottom-start">share</a>
<span class="lsep">|</span>
<a href="/posts/22536916/edit" class="suggest-edit-post js-gps-
track" data-gps-track="post.click({ item: 6, priv: 0, post_type: 2 })"
title="">improve this answer</a>
<span class="lsep">|</span>
<button id="btnFollowPost-22536916" class="s-btn s-btn__link fc-black-400 h:fc-
black-700 pb2 js-follow-post js-follow-answer js-gps-track" role="button"
data-gps-track="post.click({ item: 14, priv: 0, post_type: 2 })"
data-controller="s-tooltip " data-s-tooltip-placement="bottom"
data-s-popover-placement="bottom" aria-controls=""
title="Follow this answer to receive notifications">
follow
</button>
<span class="lsep">|</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="post-layout--right">
<div id="comments-22536916" class="comments js-comments-container bt bc-
black-075 mt12 dno" data-post-id="22536916" data-min-length="15">
<ul class="comments-list js-comments-list"
data-remaining-comments-count="0"
data-canpost="false"
data-cansee="true"
data-comments-unavailable="false"
data-addlink-disabled="true">
</ul>
</div>
<a name="18178603"></a>
<div id="answer-18178603" class="answer" data-answerid="18178603"
itemprop="suggestedAnswer" itemscope itemtype="http://schema.org/Answer">
<div class="post-layout">
<div class="votecell post-layout--left">
<div class="js-voting-container grid jc-center fd-column ai-stretch gs4
fc-black-200" data-post-id="18178603">
<button class="js-vote-up-btn grid--cell s-btn s-btn__unset c-pointer"
data-controller="s-tooltip" data-s-tooltip-placement="right" title="This answer is
useful" aria-pressed="false" aria-label="Up vote" data-selected-classes="fc-theme-
primary"><svg aria-hidden="true" class="m0 svg-icon iconArrowUpLg" width="36"
height="36" viewBox="0 0 36 36"><path d="M2 26h32L18 10 2 26z"/></svg></button>
<div class="js-vote-count grid--cell fc-black-500 fs-title grid fd-column
ai-center" itemprop="upvoteCount" data-value="1">1</div>
<button class="js-vote-down-btn grid--cell s-btn s-btn__unset c-pointer"
data-controller="s-tooltip" data-s-tooltip-placement="right" title="This answer is
not useful" aria-pressed="false" aria-label="Down vote" data-selected-classes="fc-
theme-primary"><svg aria-hidden="true" class="m0 svg-icon iconArrowDownLg"
width="36" height="36" viewBox="0 0 36 36"><path d="M2 10h32L18 26 2
10z"/></svg></button>
</div>
</div>
<div class="answercell post-layout--right">
<p>However in your above code you seem to be passing a string instead of the
variable here</p>
<pre>
isUpvote = request.POST.get('isUpvote')
</pre>
<div class="post-menu">
<a href="/a/18178603"
rel="nofollow"
itemprop="url"
class="js-share-link js-gps-track"
title="short permalink to this answer"
data-gps-track="post.click({ item: 2, priv: 0, post_type: 2 })"
data-controller="se-share-sheet"
data-se-share-sheet-title="Share a link to this answer"
data-se-share-sheet-subtitle=""
data-se-share-sheet-post-type="answer"
data-se-share-sheet-social="facebook twitter devto"
data-se-share-sheet-location="2"
data-se-share-sheet-license-url="https%3a%2f%2ffanyv88.com%3a443%2fhttps%2fcreativecommons.org
%2flicenses%2fby-sa%2f3.0%2f"
data-se-share-sheet-license-name="CC BY-SA 3.0"
data-s-popover-placement="bottom-start">share</a>
<span class="lsep">|</span>
<a href="/posts/18178603/edit" class="suggest-edit-post js-gps-
track" data-gps-track="post.click({ item: 6, priv: 0, post_type: 2 })"
title="">improve this answer</a>
<span class="lsep">|</span>
<button id="btnFollowPost-18178603" class="s-btn s-btn__link fc-black-400 h:fc-
black-700 pb2 js-follow-post js-follow-answer js-gps-track" role="button"
data-gps-track="post.click({ item: 14, priv: 0, post_type: 2 })"
data-controller="s-tooltip " data-s-tooltip-placement="bottom"
data-s-popover-placement="bottom" aria-controls=""
title="Follow this answer to receive notifications">
follow
</button>
<span class="lsep">|</span>
</div>
</div>
<div class="post-signature grid--cell fl0">
<div class="user-info user-hover">
<div class="user-action-time">
answered <span title="2013-08-12 02:00:10Z" class="relativetime">Aug 12 '13
at 2:00</span>
</div>
<div class="user-gravatar32">
<a href="/users/1066922/woofmeow"><div class="gravatar-wrapper-32"><img
src="https://www.gravatar.com/avatar/72e6ce209cb700c6ce2f166594d6b512?
s=32&d=identicon&r=PG" alt="" width="32" height="32" class="bar-
sm"></div></a>
</div>
<div class="user-details" itemprop="author" itemscope
itemtype="http://schema.org/Person">
<a href="/users/1066922/woofmeow">woofmeow</a><span class="d-none"
itemprop="name">woofmeow</span>
<div class="-flair">
<span class="reputation-score" title="reputation score "
dir="ltr">2,180</span><span title="12 silver badges" aria-hidden="true"><span
class="badge2"></span><span class="badgecount">12</span></span><span class="v-
visible-sr">12 silver badges</span><span title="12 bronze badges" aria-
hidden="true"><span class="badge3"></span><span
class="badgecount">12</span></span><span class="v-visible-sr">12 bronze
badges</span>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="post-layout--right">
<div id="comments-18178603" class="comments js-comments-container bt bc-
black-075 mt12 " data-post-id="18178603" data-min-length="15">
<ul class="comments-list js-comments-list"
data-remaining-comments-count="0"
data-canpost="false"
data-cansee="true"
data-comments-unavailable="false"
data-addlink-disabled="true">
– <a href="/users/2492270/user2492270"
title="1,853 reputation"
class="comment-user owner">user2492270</a>
<span class="comment-date" dir="ltr"><span title="2013-08-12
02:10:24Z, License: CC BY-SA 3.0" class="relativetime-clean">Aug 12 '13 at
2:10</span></span>
</div>
</div>
</li>
<li id="comment-26635275" class="comment js-comment " data-comment-
id="26635275">
<div class="js-comment-actions comment-actions">
<div class="comment-score js-comment-edit-hide">
</div>
</div>
<div class="comment-text js-comment-text-and-form">
<div class="comment-body js-comment-edit-hide">
– <a href="/users/1066922/woofmeow"
title="2,180 reputation"
class="comment-user">woofmeow</a>
<span class="comment-date" dir="ltr"><span title="2013-08-12
02:17:31Z, License: CC BY-SA 3.0" class="relativetime-clean">Aug 12 '13 at
2:17</span></span>
</div>
</div>
</li>
</ul>
</div>
<a name="50150854"></a>
<div id="answer-50150854" class="answer" data-answerid="50150854"
itemprop="suggestedAnswer" itemscope itemtype="http://schema.org/Answer">
<div class="post-layout">
<div class="votecell post-layout--left">
<div class="js-voting-container grid jc-center fd-column ai-stretch gs4
fc-black-200" data-post-id="50150854">
<button class="js-vote-up-btn grid--cell s-btn s-btn__unset c-pointer"
data-controller="s-tooltip" data-s-tooltip-placement="right" title="This answer is
useful" aria-pressed="false" aria-label="Up vote" data-selected-classes="fc-theme-
primary"><svg aria-hidden="true" class="m0 svg-icon iconArrowUpLg" width="36"
height="36" viewBox="0 0 36 36"><path d="M2 26h32L18 10 2 26z"/></svg></button>
<div class="js-vote-count grid--cell fc-black-500 fs-title grid fd-column
ai-center" itemprop="upvoteCount" data-value="1">1</div>
<button class="js-vote-down-btn grid--cell s-btn s-btn__unset c-pointer"
data-controller="s-tooltip" data-s-tooltip-placement="right" title="This answer is
not useful" aria-pressed="false" aria-label="Down vote" data-selected-classes="fc-
theme-primary"><svg aria-hidden="true" class="m0 svg-icon iconArrowDownLg"
width="36" height="36" viewBox="0 0 36 36"><path d="M2 10h32L18 26 2
10z"/></svg></button>
</div>
</div>
<pre><code>import json
def view_function(request):
json_boolean_to_python_boolean = json.loads(request.POST.get('json_field'))
</code></pre>
</div>
<div class="mt24">
<div class="grid fw-wrap ai-start jc-end gs8 gsy">
<time itemprop="dateCreated" datetime="2018-05-03T08:54:59"></time>
<div class="grid--cell mr16" style="flex: 1 1 100px;">
<div class="post-menu">
<a href="/a/50150854"
rel="nofollow"
itemprop="url"
class="js-share-link js-gps-track"
title="short permalink to this answer"
data-gps-track="post.click({ item: 2, priv: 0, post_type: 2 })"
data-controller="se-share-sheet"
data-se-share-sheet-title="Share a link to this answer"
data-se-share-sheet-subtitle=""
data-se-share-sheet-post-type="answer"
data-se-share-sheet-social="facebook twitter devto"
data-se-share-sheet-location="2"
data-se-share-sheet-license-url="https%3a%2f%2ffanyv88.com%3a443%2fhttps%2fcreativecommons.org
%2flicenses%2fby-sa%2f4.0%2f"
data-se-share-sheet-license-name="CC BY-SA 4.0"
data-s-popover-placement="bottom-start">share</a>
<span class="lsep">|</span>
<a href="/posts/50150854/edit" class="suggest-edit-post js-gps-
track" data-gps-track="post.click({ item: 6, priv: 0, post_type: 2 })"
title="">improve this answer</a>
<span class="lsep">|</span>
<button id="btnFollowPost-50150854" class="s-btn s-btn__link fc-black-400 h:fc-
black-700 pb2 js-follow-post js-follow-answer js-gps-track" role="button"
data-gps-track="post.click({ item: 14, priv: 0, post_type: 2 })"
data-controller="s-tooltip " data-s-tooltip-placement="bottom"
data-s-popover-placement="bottom" aria-controls=""
title="Follow this answer to receive notifications">
follow
</button>
<span class="lsep">|</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="post-layout--right">
<div id="comments-50150854" class="comments js-comments-container bt bc-
black-075 mt12 dno" data-post-id="50150854" data-min-length="15">
<ul class="comments-list js-comments-list"
data-remaining-comments-count="0"
data-canpost="false"
data-cansee="true"
data-comments-unavailable="false"
data-addlink-disabled="true">
</ul>
</div>
<a name="59560679"></a>
<div id="answer-59560679" class="answer" data-answerid="59560679"
itemprop="suggestedAnswer" itemscope itemtype="http://schema.org/Answer">
<div class="post-layout">
<div class="votecell post-layout--left">
<div class="js-voting-container grid jc-center fd-column ai-stretch gs4
fc-black-200" data-post-id="59560679">
<button class="js-vote-up-btn grid--cell s-btn s-btn__unset c-pointer"
data-controller="s-tooltip" data-s-tooltip-placement="right" title="This answer is
useful" aria-pressed="false" aria-label="Up vote" data-selected-classes="fc-theme-
primary"><svg aria-hidden="true" class="m0 svg-icon iconArrowUpLg" width="36"
height="36" viewBox="0 0 36 36"><path d="M2 26h32L18 10 2 26z"/></svg></button>
<div class="js-vote-count grid--cell fc-black-500 fs-title grid fd-column
ai-center" itemprop="upvoteCount" data-value="1">1</div>
<button class="js-vote-down-btn grid--cell s-btn s-btn__unset c-pointer"
data-controller="s-tooltip" data-s-tooltip-placement="right" title="This answer is
not useful" aria-pressed="false" aria-label="Down vote" data-selected-classes="fc-
theme-primary"><svg aria-hidden="true" class="m0 svg-icon iconArrowDownLg"
width="36" height="36" viewBox="0 0 36 36"><path d="M2 10h32L18 26 2
10z"/></svg></button>
</div>
</div>
<p>In Javascript/jquery:</p>
<pre><code>$.ajax({
url: <!-- url for your view -->,
type: "POST",
data: {
is_enabled: $("#id_enable_feature").prop("checked").toString() <!-- Here
it's either true or false>
}
})
</code></pre>
<div class="post-menu">
<a href="/a/59560679"
rel="nofollow"
itemprop="url"
class="js-share-link js-gps-track"
title="short permalink to this answer"
data-gps-track="post.click({ item: 2, priv: 0, post_type: 2 })"
data-controller="se-share-sheet"
data-se-share-sheet-title="Share a link to this answer"
data-se-share-sheet-subtitle=""
data-se-share-sheet-post-type="answer"
data-se-share-sheet-social="facebook twitter devto"
data-se-share-sheet-location="2"
data-se-share-sheet-license-url="https%3a%2f%2ffanyv88.com%3a443%2fhttps%2fcreativecommons.org
%2flicenses%2fby-sa%2f4.0%2f"
data-se-share-sheet-license-name="CC BY-SA 4.0"
data-s-popover-placement="bottom-start">share</a>
<span class="lsep">|</span>
<a href="/posts/59560679/edit" class="suggest-edit-post js-gps-
track" data-gps-track="post.click({ item: 6, priv: 0, post_type: 2 })"
title="">improve this answer</a>
<span class="lsep">|</span>
<button id="btnFollowPost-59560679" class="s-btn s-btn__link fc-black-400 h:fc-
black-700 pb2 js-follow-post js-follow-answer js-gps-track" role="button"
data-gps-track="post.click({ item: 14, priv: 0, post_type: 2 })"
data-controller="s-tooltip " data-s-tooltip-placement="bottom"
data-s-popover-placement="bottom" aria-controls=""
title="Follow this answer to receive notifications">
follow
</button>
<span class="lsep">|</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="post-layout--right">
<div id="comments-59560679" class="comments js-comments-container bt bc-
black-075 mt12 dno" data-post-id="59560679" data-min-length="15">
<ul class="comments-list js-comments-list"
data-remaining-comments-count="0"
data-canpost="false"
data-cansee="true"
data-comments-unavailable="false"
data-addlink-disabled="true">
</ul>
</div>
<a name="45023308"></a>
<div id="answer-45023308" class="answer" data-answerid="45023308"
itemprop="suggestedAnswer" itemscope itemtype="http://schema.org/Answer">
<div class="post-layout">
<div class="votecell post-layout--left">
<div class="js-voting-container grid jc-center fd-column ai-stretch gs4
fc-black-200" data-post-id="45023308">
<button class="js-vote-up-btn grid--cell s-btn s-btn__unset c-pointer"
data-controller="s-tooltip" data-s-tooltip-placement="right" title="This answer is
useful" aria-pressed="false" aria-label="Up vote" data-selected-classes="fc-theme-
primary"><svg aria-hidden="true" class="m0 svg-icon iconArrowUpLg" width="36"
height="36" viewBox="0 0 36 36"><path d="M2 26h32L18 10 2 26z"/></svg></button>
<div class="js-vote-count grid--cell fc-black-500 fs-title grid fd-column
ai-center" itemprop="upvoteCount" data-value="0">0</div>
<button class="js-vote-down-btn grid--cell s-btn s-btn__unset c-pointer"
data-controller="s-tooltip" data-s-tooltip-placement="right" title="This answer is
not useful" aria-pressed="false" aria-label="Down vote" data-selected-classes="fc-
theme-primary"><svg aria-hidden="true" class="m0 svg-icon iconArrowDownLg"
width="36" height="36" viewBox="0 0 36 36"><path d="M2 10h32L18 26 2
10z"/></svg></button>
</div>
</div>
<p>Also I should mention that if you are working with Django's forms and are trying
to pass compatible Boolean value to the <code>Form</code> or <code>ModelForm</code>
class via Ajax, you need to use the precise values Django is expecting.</p>
<ol>
<li>Unknown</li>
<li>Yes (True)</li>
<li>No (False)</li>
</ol>
<p>So for example, the following would deliver Boolean data to Django's form
properly:</p>
<div class="post-menu">
<a href="/a/45023308"
rel="nofollow"
itemprop="url"
class="js-share-link js-gps-track"
title="short permalink to this answer"
data-gps-track="post.click({ item: 2, priv: 0, post_type: 2 })"
data-controller="se-share-sheet"
data-se-share-sheet-title="Share a link to this answer"
data-se-share-sheet-subtitle=""
data-se-share-sheet-post-type="answer"
data-se-share-sheet-social="facebook twitter devto"
data-se-share-sheet-location="2"
data-se-share-sheet-license-url="https%3a%2f%2ffanyv88.com%3a443%2fhttps%2fcreativecommons.org
%2flicenses%2fby-sa%2f4.0%2f"
data-se-share-sheet-license-name="CC BY-SA 4.0"
data-s-popover-placement="bottom-start">share</a>
<span class="lsep">|</span>
<a href="/posts/45023308/edit" class="suggest-edit-post js-gps-
track" data-gps-track="post.click({ item: 6, priv: 0, post_type: 2 })"
title="">improve this answer</a>
<span class="lsep">|</span>
<button id="btnFollowPost-45023308" class="s-btn s-btn__link fc-black-400 h:fc-
black-700 pb2 js-follow-post js-follow-answer js-gps-track" role="button"
data-gps-track="post.click({ item: 14, priv: 0, post_type: 2 })"
data-controller="s-tooltip " data-s-tooltip-placement="bottom"
data-s-popover-placement="bottom" aria-controls=""
title="Follow this answer to receive notifications">
follow
</button>
<span class="lsep">|</span>
</div>
</div>
<div class="post-signature grid--cell fl0">
<div class="user-info ">
<div class="user-action-time">
<a href="/posts/45023308/revisions" title="show all edits to this post"
class="js-gps-track"
data-gps-track="post.click({ item: 4, priv: 0, post_type:
2 })">edited <span title="2018-10-05 23:24:44Z" class="relativetime">Oct 5 '18 at
23:24</span></a>
</div>
<div class="user-gravatar32">
</div>
<div class="user-details">
<div class="-flair">
</div>
</div>
</div> </div>
</div>
</div>
</div>
</div>
<div class="post-layout--right">
<div id="comments-45023308" class="comments js-comments-container bt bc-
black-075 mt12 " data-post-id="45023308" data-min-length="15">
<ul class="comments-list js-comments-list"
data-remaining-comments-count="0"
data-canpost="false"
data-cansee="true"
data-comments-unavailable="false"
data-addlink-disabled="true">
– <a href="/users/5749040/jack-brounstein"
title="113 reputation"
class="comment-user">Jack Brounstein</a>
<span class="comment-date" dir="ltr"><span title="2017-12-21
03:24:28Z, License: CC BY-SA 3.0" class="relativetime-clean">Dec 21 '17 at
3:24</span></span>
</div>
</div>
</li>
</ul>
</div>
<a name="52752727"></a>
<div id="answer-52752727" class="answer" data-answerid="52752727"
itemprop="suggestedAnswer" itemscope itemtype="http://schema.org/Answer">
<div class="post-layout">
<div class="votecell post-layout--left">
<div class="js-voting-container grid jc-center fd-column ai-stretch gs4
fc-black-200" data-post-id="52752727">
<button class="js-vote-up-btn grid--cell s-btn s-btn__unset c-pointer"
data-controller="s-tooltip" data-s-tooltip-placement="right" title="This answer is
useful" aria-pressed="false" aria-label="Up vote" data-selected-classes="fc-theme-
primary"><svg aria-hidden="true" class="m0 svg-icon iconArrowUpLg" width="36"
height="36" viewBox="0 0 36 36"><path d="M2 26h32L18 10 2 26z"/></svg></button>
<div class="js-vote-count grid--cell fc-black-500 fs-title grid fd-column
ai-center" itemprop="upvoteCount" data-value="0">0</div>
<button class="js-vote-down-btn grid--cell s-btn s-btn__unset c-pointer"
data-controller="s-tooltip" data-s-tooltip-placement="right" title="This answer is
not useful" aria-pressed="false" aria-label="Down vote" data-selected-classes="fc-
theme-primary"><svg aria-hidden="true" class="m0 svg-icon iconArrowDownLg"
width="36" height="36" viewBox="0 0 36 36"><path d="M2 10h32L18 26 2
10z"/></svg></button>
</div>
</div>
<pre><code>var xhr = {
'isUpvote': Number(isUpvote)
};
</code></pre>
<p>In python:</p>
<pre><code>try:
is_upvote = bool(int(request.POST.get('isUpvote', 0)))
except ValueError:
// handle exception here
</code></pre>
</div>
<div class="mt24">
<div class="grid fw-wrap ai-start jc-end gs8 gsy">
<time itemprop="dateCreated" datetime="2018-10-11T05:20:50"></time>
<div class="grid--cell mr16" style="flex: 1 1 100px;">
<div class="post-menu">
<a href="/a/52752727"
rel="nofollow"
itemprop="url"
class="js-share-link js-gps-track"
title="short permalink to this answer"
data-gps-track="post.click({ item: 2, priv: 0, post_type: 2 })"
data-controller="se-share-sheet"
data-se-share-sheet-title="Share a link to this answer"
data-se-share-sheet-subtitle=""
data-se-share-sheet-post-type="answer"
data-se-share-sheet-social="facebook twitter devto"
data-se-share-sheet-location="2"
data-se-share-sheet-license-url="https%3a%2f%2ffanyv88.com%3a443%2fhttps%2fcreativecommons.org
%2flicenses%2fby-sa%2f4.0%2f"
data-se-share-sheet-license-name="CC BY-SA 4.0"
data-s-popover-placement="bottom-start">share</a>
<span class="lsep">|</span>
<a href="/posts/52752727/edit" class="suggest-edit-post js-gps-
track" data-gps-track="post.click({ item: 6, priv: 0, post_type: 2 })"
title="">improve this answer</a>
<span class="lsep">|</span>
<button id="btnFollowPost-52752727" class="s-btn s-btn__link fc-black-400 h:fc-
black-700 pb2 js-follow-post js-follow-answer js-gps-track" role="button"
data-gps-track="post.click({ item: 14, priv: 0, post_type: 2 })"
data-controller="s-tooltip " data-s-tooltip-placement="bottom"
data-s-popover-placement="bottom" aria-controls=""
title="Follow this answer to receive notifications">
follow
</button>
<span class="lsep">|</span>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="post-layout--right">
<div id="comments-52752727" class="comments js-comments-container bt bc-
black-075 mt12 dno" data-post-id="52752727" data-min-length="15">
<ul class="comments-list js-comments-list"
data-remaining-comments-count="0"
data-canpost="false"
data-cansee="true"
data-comments-unavailable="false"
data-addlink-disabled="true">
</ul>
</div>
<a name="57411976"></a>
<div id="answer-57411976" class="answer" data-answerid="57411976"
itemprop="suggestedAnswer" itemscope itemtype="http://schema.org/Answer">
<div class="post-layout">
<div class="votecell post-layout--left">
<div class="js-voting-container grid jc-center fd-column ai-stretch gs4
fc-black-200" data-post-id="57411976">
<button class="js-vote-up-btn grid--cell s-btn s-btn__unset c-pointer"
data-controller="s-tooltip" data-s-tooltip-placement="right" title="This answer is
useful" aria-pressed="false" aria-label="Up vote" data-selected-classes="fc-theme-
primary"><svg aria-hidden="true" class="m0 svg-icon iconArrowUpLg" width="36"
height="36" viewBox="0 0 36 36"><path d="M2 26h32L18 10 2 26z"/></svg></button>
<div class="js-vote-count grid--cell fc-black-500 fs-title grid fd-column
ai-center" itemprop="upvoteCount" data-value="0">0</div>
<button class="js-vote-down-btn grid--cell s-btn s-btn__unset c-pointer"
data-controller="s-tooltip" data-s-tooltip-placement="right" title="This answer is
not useful" aria-pressed="false" aria-label="Down vote" data-selected-classes="fc-
theme-primary"><svg aria-hidden="true" class="m0 svg-icon iconArrowDownLg"
width="36" height="36" viewBox="0 0 36 36"><path d="M2 10h32L18 26 2
10z"/></svg></button>
</div>
</div>
<pre><code>isUpvote = request.POST.get("isUpvote")
isUpvote = isUpvote == True or isUpvote == "true" or isUpvote == "True"
</code></pre>
</div>
<div class="mt24">
<div class="grid fw-wrap ai-start jc-end gs8 gsy">
<time itemprop="dateCreated" datetime="2019-08-08T11:53:05"></time>
<div class="grid--cell mr16" style="flex: 1 1 100px;">
<div class="post-menu">
<a href="/a/57411976"
rel="nofollow"
itemprop="url"
class="js-share-link js-gps-track"
title="short permalink to this answer"
data-gps-track="post.click({ item: 2, priv: 0, post_type: 2 })"
data-controller="se-share-sheet"
data-se-share-sheet-title="Share a link to this answer"
data-se-share-sheet-subtitle=""
data-se-share-sheet-post-type="answer"
data-se-share-sheet-social="facebook twitter devto"
data-se-share-sheet-location="2"
data-se-share-sheet-license-url="https%3a%2f%2ffanyv88.com%3a443%2fhttps%2fcreativecommons.org
%2flicenses%2fby-sa%2f4.0%2f"
data-se-share-sheet-license-name="CC BY-SA 4.0"
data-s-popover-placement="bottom-start">share</a>
<span class="lsep">|</span>
<a href="/posts/57411976/edit" class="suggest-edit-post js-gps-
track" data-gps-track="post.click({ item: 6, priv: 0, post_type: 2 })"
title="">improve this answer</a>
<span class="lsep">|</span>
<button id="btnFollowPost-57411976" class="s-btn s-btn__link fc-black-400 h:fc-
black-700 pb2 js-follow-post js-follow-answer js-gps-track" role="button"
data-gps-track="post.click({ item: 14, priv: 0, post_type: 2 })"
data-controller="s-tooltip " data-s-tooltip-placement="bottom"
data-s-popover-placement="bottom" aria-controls=""
title="Follow this answer to receive notifications">
follow
</button>
<span class="lsep">|</span>
</div>
</div>
<div class="post-signature grid--cell fl0">
<div class="user-info ">
<div class="user-action-time">
<a href="/posts/57411976/revisions" title="show all edits to this post"
class="js-gps-track"
data-gps-track="post.click({ item: 4, priv: 0, post_type:
2 })">edited <span title="2019-08-09 07:44:54Z" class="relativetime">Aug 9 '19 at
7:44</span></a>
</div>
<div class="user-gravatar32">
</div>
<div class="user-details">
<div class="-flair">
</div>
</div>
</div> </div>
</div>
</div>
</div>
</div>
<div class="post-layout--right">
<div id="comments-57411976" class="comments js-comments-container bt bc-
black-075 mt12 " data-post-id="57411976" data-min-length="15">
<ul class="comments-list js-comments-list"
data-remaining-comments-count="0"
data-canpost="false"
data-cansee="true"
data-comments-unavailable="false"
data-addlink-disabled="true">
– <a href="/users/3216427/joanis"
title="3,770 reputation"
class="comment-user">joanis</a>
<span class="comment-date" dir="ltr"><span title="2019-08-08
15:22:28Z, License: CC BY-SA 4.0" class="relativetime-clean">Aug 8 '19 at
15:22</span></span>
</div>
</div>
</li>
</ul>
</div>
<a name="61150865"></a>
<div id="answer-61150865" class="answer" data-answerid="61150865"
itemprop="suggestedAnswer" itemscope itemtype="http://schema.org/Answer">
<div class="post-layout">
<div class="votecell post-layout--left">
<div class="js-voting-container grid jc-center fd-column ai-stretch gs4
fc-black-200" data-post-id="61150865">
<button class="js-vote-up-btn grid--cell s-btn s-btn__unset c-pointer"
data-controller="s-tooltip" data-s-tooltip-placement="right" title="This answer is
useful" aria-pressed="false" aria-label="Up vote" data-selected-classes="fc-theme-
primary"><svg aria-hidden="true" class="m0 svg-icon iconArrowUpLg" width="36"
height="36" viewBox="0 0 36 36"><path d="M2 26h32L18 10 2 26z"/></svg></button>
<div class="js-vote-count grid--cell fc-black-500 fs-title grid fd-column
ai-center" itemprop="upvoteCount" data-value="0">0</div>
<button class="js-vote-down-btn grid--cell s-btn s-btn__unset c-pointer"
data-controller="s-tooltip" data-s-tooltip-placement="right" title="This answer is
not useful" aria-pressed="false" aria-label="Down vote" data-selected-classes="fc-
theme-primary"><svg aria-hidden="true" class="m0 svg-icon iconArrowDownLg"
width="36" height="36" viewBox="0 0 36 36"><path d="M2 10h32L18 26 2
10z"/></svg></button>
</div>
</div>
<div class="post-menu">
<a href="/a/61150865"
rel="nofollow"
itemprop="url"
class="js-share-link js-gps-track"
title="short permalink to this answer"
data-gps-track="post.click({ item: 2, priv: 0, post_type: 2 })"
data-controller="se-share-sheet"
data-se-share-sheet-title="Share a link to this answer"
data-se-share-sheet-subtitle=""
data-se-share-sheet-post-type="answer"
data-se-share-sheet-social="facebook twitter devto"
data-se-share-sheet-location="2"
data-se-share-sheet-license-url="https%3a%2f%2ffanyv88.com%3a443%2fhttps%2fcreativecommons.org
%2flicenses%2fby-sa%2f4.0%2f"
data-se-share-sheet-license-name="CC BY-SA 4.0"
data-s-popover-placement="bottom-start">share</a>
<span class="lsep">|</span>
<a href="/posts/61150865/edit" class="suggest-edit-post js-gps-
track" data-gps-track="post.click({ item: 6, priv: 0, post_type: 2 })"
title="">improve this answer</a>
<span class="lsep">|</span>
<button id="btnFollowPost-61150865" class="s-btn s-btn__link fc-black-400 h:fc-
black-700 pb2 js-follow-post js-follow-answer js-gps-track" role="button"
data-gps-track="post.click({ item: 14, priv: 0, post_type: 2 })"
data-controller="s-tooltip " data-s-tooltip-placement="bottom"
data-s-popover-placement="bottom" aria-controls=""
title="Follow this answer to receive notifications">
follow
</button>
<span class="lsep">|</span>
</div>
</div>
<div class="post-signature grid--cell fl0">
<div class="user-info ">
<div class="user-action-time">
<a href="/posts/61150865/revisions" title="show all edits to this post"
class="js-gps-track"
data-gps-track="post.click({ item: 4, priv: 0, post_type:
2 })">edited <span title="2020-05-13 01:22:20Z" class="relativetime">May 13 at
1:22</span></a>
</div>
<div class="user-gravatar32">
</div>
<div class="user-details">
<div class="-flair">
</div>
</div>
</div> </div>
</div>
</div>
</div>
</div>
<div class="post-layout--right">
<div id="comments-61150865" class="comments js-comments-container bt bc-
black-075 mt12 dno" data-post-id="61150865" data-min-length="15">
<ul class="comments-list js-comments-list"
data-remaining-comments-count="0"
data-canpost="false"
data-cansee="true"
data-comments-unavailable="false"
data-addlink-disabled="true">
</ul>
</div>
<a name='new-answer'></a>
<form id="post-form"
action="/questions/18178564/answer/submit" method="post" class="js-add-answer-
component post-form">
<input type="hidden" id="post-id"
value="18178564" />
<input type="hidden" id="qualityBanWarningShown"
name="qualityBanWarningShown" value="false" />
<input type="hidden" name="referrer"
value="https://www.google.com/" />
<h2 class="space">
Your Answer
</h2>
<script>
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
</script>
<script>
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({
useStacksEditor: false,
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by \u003ca
href=\"https://imgur.com/\"\u003e\u003csvg class=\"svg-icon\" width=\"50\"
height=\"18\" viewBox=\"0 0 50 18\" fill=\"none\"
xmlns=\"http://www.w3.org/2000/svg\"\u003e\u003cpath d=\"M46.1709 9.17788C46.1709
8.26454 46.2665 7.94324 47.1084 7.58816C47.4091 7.46349 47.7169 7.36433 48.0099
7.26993C48.9099 6.97997 49.672 6.73443 49.672 5.93063C49.672 5.22043 48.9832
4.61182 48.1414 4.61182C47.4335 4.61182 46.7256 4.91628 46.0943 5.50789C45.7307
4.9328 45.2525 4.66231 44.6595 4.66231C43.6264 4.66231 43.1481 5.28821 43.1481
6.59048V11.9512C43.1481 13.2535 43.6264 13.8962 44.6595 13.8962C45.6924 13.8962
46.1709 13.2535 46.1709 11.9512V9.17788Z\"/\u003e\u003cpath d=\"M32.492
10.1419C32.492 12.6954 34.1182 14.0484 37.0451 14.0484C39.9723 14.0484 41.5985
12.6954 41.5985 10.1419V6.59049C41.5985 5.28821 41.1394 4.66232 40.1061
4.66232C39.0732 4.66232 38.5948 5.28821 38.5948 6.59049V9.60062C38.5948 10.8521
38.2696 11.5455 37.0451 11.5455C35.8209 11.5455 35.4954 10.8521 35.4954
9.60062V6.59049C35.4954 5.28821 35.0173 4.66232 34.0034 4.66232C32.9703 4.66232
32.492 5.28821 32.492 6.59049V10.1419Z\" /\u003e\u003cpath fill-rule=\"evenodd\"
clip-rule=\"evenodd\" d=\"M25.6622 17.6335C27.8049 17.6335 29.3739 16.9402 30.2537
15.6379C30.8468 14.7755 30.9615 13.5579 30.9615 11.9512V6.59049C30.9615 5.28821
30.4833 4.66231 29.4502 4.66231C28.9913 4.66231 28.4555 4.94978 28.1109
5.50789C27.499 4.86533 26.7335 4.56087 25.7005 4.56087C23.1369 4.56087 21.0134
6.57349 21.0134 9.27932C21.0134 11.9852 23.003 13.913 25.3754 13.913C26.5612 13.913
27.4607 13.4902 28.1109 12.6616C28.1109 12.7229 28.1161 12.7799 28.121
12.8346C28.1256 12.8854 28.1301 12.9342 28.1301 12.983C28.1301 14.4373 27.2502
15.2321 25.777 15.2321C24.8349 15.2321 24.1352 14.9821 23.5661 14.7787C23.176
14.6393 22.8472 14.5218 22.5437 14.5218C21.7977 14.5218 21.2429 15.0123 21.2429
15.6887C21.2429 16.7375 22.9072 17.6335 25.6622 17.6335ZM24.1317 9.27932C24.1317
7.94324 24.9928 7.09766 26.1024 7.09766C27.2119 7.09766 28.0918 7.94324 28.0918
9.27932C28.0918 10.6321 27.2311 11.5116 26.1024 11.5116C24.9737 11.5116 24.1317
10.6491 24.1317 9.27932Z\"/\u003e\u003cpath d=\"M16.8045 11.9512C16.8045 13.2535
17.2637 13.8962 18.2965 13.8962C19.3298 13.8962 19.8079 13.2535 19.8079
11.9512V8.12928C19.8079 5.82936 18.4879 4.62866 16.4027 4.62866C15.1594 4.62866
14.279 4.98375 13.3609 5.88013C12.653 5.05154 11.6581 4.62866 10.3573
4.62866C9.34336 4.62866 8.57809 4.89931 7.9466 5.5079C7.58314 4.9328 7.10506
4.66232 6.51203 4.66232C5.47873 4.66232 5.00066 5.28821 5.00066
6.59049V11.9512C5.00066 13.2535 5.47873 13.8962 6.51203 13.8962C7.54479 13.8962
8.0232 13.2535 8.0232 11.9512V8.90741C8.0232 7.58817 8.44431 6.91179 9.53458
6.91179C10.5104 6.91179 10.893 7.58817 10.893 8.94108V11.9512C10.893 13.2535
11.3711 13.8962 12.4044 13.8962C13.4375 13.8962 13.9157 13.2535 13.9157
11.9512V8.90741C13.9157 7.58817 14.3365 6.91179 15.4269 6.91179C16.4027 6.91179
16.8045 7.58817 16.8045 8.94108V11.9512Z\"/\u003e\u003cpath d=\"M3.31675
6.59049C3.31675 5.28821 2.83866 4.66232 1.82471 4.66232C0.791758 4.66232 0.313354
5.28821 0.313354 6.59049V11.9512C0.313354 13.2535 0.791758 13.8962 1.82471
13.8962C2.85798 13.8962 3.31675 13.2535 3.31675 11.9512V6.59049Z\"
/\u003e\u003cpath d=\"M1.87209 0.400291C0.843612 0.400291 0 1.1159 0 1.98861C0
2.87869 0.822846 3.57676 1.87209 3.57676C2.90056 3.57676 3.7234 2.87869 3.7234
1.98861C3.7234 1.1159 2.90056 0.400291 1.87209 0.400291Z\"
fill=\"#1BB76E\"/\u003e\u003c/svg\u003e\u003c/a\u003e",
contentPolicyHtml: "User contributions licensed under \u003ca
href=\"https://stackoverflow.com/help/licensing\"\u003ecc by-sa\u003c/a\u003e
\u003ca href=\"https://stackoverflow.com/legal/content-policy\"\u003e(content
policy)\u003c/a\u003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true,enableSnippets:true
});
}
});
</script>
<div id="post-editor" class="post-editor js-post-editor">
<div class="ps-relative">
<div class="wmd-container mb8">
<div id="wmd-button-bar" class="wmd-button-bar btr-sm"></div>
<div class="js-stacks-validation">
<div class="ps-relative">
<textarea id="wmd-input"
name="post-text"
class="wmd-input s-input bar0 js-post-body-field"
data-post-type-id="2"
cols="92" rows="15"
tabindex="101"
data-min-length=""></textarea>
</div>
<div class="s-input-message mt4 d-none js-stacks-validation-
message"></div>
</div>
</div>
</div>
<div>
<div id="draft-saved" class="fc-success h24" style="display:none;">Draft
saved</div>
<div id="draft-discarded" class="fc-error h24" style="display:none;">Draft
discarded</div>
</div>
<div class="edit-block">
<input id="fkey" name="fkey" type="hidden"
value="af4d746ccaa257ce6f52b2a02ba11ab0a0ec14bc8b64cd15310f0684e4e09a40">
<input id="author" name="author" type="text">
</div>
</div>
<div class="ps-relative">
<div class="form-item dno new-post-
login p0 my16">
<div class="grid gs16 md:fd-column new-login-form">
<div class="grid fd-column w50 md:w-auto gsy gs8 jc-space-
between new-login-left">
<h3 class="grid--cell fs-title">Sign up or <a id="login-
link" href="/users/login?ssrc=question_page&returnurl=https%3a%2f
%2fstackoverflow.com%2fquestions%2f18178564%2fconverting-boolean-value-from-
javascript-to-django%23new-answer">log in</a></h3>
<script>
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-
link');
</div>
</div>
</div>
<script>
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login',
'https%3a%2f%2ffanyv88.com%3a443%2fhttps%2fstackoverflow.com%2fquestions%2f18178564%2fconverting-boolean-value-
from-javascript-to-django%23new-answer', 'question_page');
}
);
</script>
<noscript>
<h3 class="grid--cell fs-title">Post as a guest</h3>
<div class="grid--cell">
<div class="grid gs4 gsy fd-column">
<label class="s-label" for="display-name">Name</label>
<div class="grid ps-relative">
<input class="s-input" id="display-name" name="display-
name" maxlength="30" type="text" value="" tabindex="105" placeholder="" />
</div>
</div>
</div>
<div class="grid--cell">
<div class="grid gs4 gsy fd-column">
<div class="grid--cell">
<div class="grid gs2 gsy fd-column">
<label class="grid--cell s-label" for="m-
address">Email</label>
<p class="grid--cell s-description">Required, but never
shown</p>
</div>
</div>
<div class="grid ps-relative">
<input class="s-input js-post-email-field" id="m-address"
name="m-address" type="text" value="" size="40" tabindex="106" placeholder="" />
</div>
</div>
</div>
</noscript>
</div>
<div id="hireme"></div>
</div>
</li>
<li >
<div class="favicon favicon-gis" title="Geographic Information
Systems Stack Exchange"></div><a
href="https://gis.stackexchange.com/questions/378941/what-does-qgis-arrow-
direction-mean" class="js-gps-track question-hyperlink mb0" data-gps-
track="site.switch({ item_type:11, target_site:79 });
posts_hot_network.click({ item_type:2, location:11 })">
What does QGIS arrow direction mean?
</a>
</li>
<li >
<div class="favicon favicon-writing" title="Writing Stack
Exchange"></div><a href="https://writing.stackexchange.com/questions/53577/if-your-
introduction-can-function-as-a-conclusion-isnt-it-redundant-to-write-a" class="js-
gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11,
target_site:166 }); posts_hot_network.click({ item_type:2, location:11 })">
If your Introduction can function as a Conclusion, isn't
it redundant to write anything in the Conclusion beside "refer to the
Introduction"?
</a>
</li>
<li >
<div class="favicon favicon-music" title="Music: Practice &
Theory Stack Exchange"></div><a
href="https://music.stackexchange.com/questions/107418/are-these-diagonal-dotted-
lines-legitimate-notation" class="js-gps-track question-hyperlink mb0" data-gps-
track="site.switch({ item_type:11, target_site:240 });
posts_hot_network.click({ item_type:2, location:11 })">
Are these diagonal dotted lines legitimate notation?
</a>
</li>
<li >
<div class="favicon favicon-academia" title="Academia Stack
Exchange"></div><a href="https://academia.stackexchange.com/questions/158615/does-
it-make-sense-to-let-a-colleague-know-about-his-repeated-misspelling" class="js-
gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11,
target_site:415 }); posts_hot_network.click({ item_type:2, location:11 })">
Does it make sense to let a colleague know about his repeated
misspelling?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-rpg" title="Role-playing Games Stack
Exchange"></div><a href="https://rpg.stackexchange.com/questions/177288/what-is-
the-lowest-level-character-that-can-unfailingly-beat-the-lost-mine-of-ph"
class="js-gps-track question-hyperlink mb0" data-gps-
track="site.switch({ item_type:11, target_site:122 });
posts_hot_network.click({ item_type:2, location:11 })">
What is the lowest level character that can unfailingly beat
the Lost Mine of Phandelver starting encounter?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-crypto" title="Cryptography Stack
Exchange"></div><a href="https://crypto.stackexchange.com/questions/86085/why-are-
the-ciphertexts-of-ansible-vaults-aes256-encrypted-files-disproportiona" class="js-
gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11,
target_site:281 }); posts_hot_network.click({ item_type:2, location:11 })">
Why are the ciphertexts of Ansible Vault's AES256-
encrypted files disproportionately composed of '3' and '6'?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-retrocomputing" title="Retrocomputing
Stack Exchange"></div><a
href="https://retrocomputing.stackexchange.com/questions/16856/why-did-the-altair-
use-100-pin-edge-connectors" class="js-gps-track question-hyperlink mb0" data-gps-
track="site.switch({ item_type:11, target_site:648 });
posts_hot_network.click({ item_type:2, location:11 })">
Why did the Altair use 100-pin edge connectors?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-mathoverflow"
title="MathOverflow"></div><a
href="https://mathoverflow.net/questions/376144/mixed-hodge-structure-of-general-
linear-group" class="js-gps-track question-hyperlink mb0" data-gps-
track="site.switch({ item_type:11, target_site:504 });
posts_hot_network.click({ item_type:2, location:11 })">
mixed Hodge structure of general linear group
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-music" title="Music: Practice &
Theory Stack Exchange"></div><a
href="https://music.stackexchange.com/questions/107411/how-seriously-did-romantic-
composers-take-key-characterizations" class="js-gps-track question-hyperlink mb0"
data-gps-track="site.switch({ item_type:11, target_site:240 });
posts_hot_network.click({ item_type:2, location:11 })">
How seriously did romantic composers take key
characterizations?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-politics" title="Politics Stack
Exchange"></div><a href="https://politics.stackexchange.com/questions/60063/what-
is-the-reasoning-behind-nighttime-restrictions-during-pandemic" class="js-gps-track
question-hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:475
}); posts_hot_network.click({ item_type:2, location:11 })">
What is the reasoning behind nighttime restrictions during
pandemic?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-askubuntu" title="Ask Ubuntu"></div><a
href="https://askubuntu.com/questions/1291311/how-to-take-partial-screen-shots"
class="js-gps-track question-hyperlink mb0" data-gps-
track="site.switch({ item_type:11, target_site:89 });
posts_hot_network.click({ item_type:2, location:11 })">
How to take partial screen shots?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-security" title="Information Security
Stack Exchange"></div><a
href="https://security.stackexchange.com/questions/240688/how-do-open-source-
projects-prevent-disclosing-a-bug-while-fixing-it" class="js-gps-track question-
hyperlink mb0" data-gps-track="site.switch({ item_type:11, target_site:162 });
posts_hot_network.click({ item_type:2, location:11 })">
How do open-source projects prevent disclosing a bug while
fixing it?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-aviation" title="Aviation Stack
Exchange"></div><a href="https://aviation.stackexchange.com/questions/82174/what-
instrument-can-be-used-to-check-that-constant-attitude-is-maintained" class="js-
gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11,
target_site:528 }); posts_hot_network.click({ item_type:2, location:11 })">
What instrument can be used to check that constant attitude is
maintained?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-webmasters" title="Webmasters Stack
Exchange"></div><a href="https://webmasters.stackexchange.com/questions/132118/do-
cname-subdomains-redirect-to-their-target" class="js-gps-track question-hyperlink
mb0" data-gps-track="site.switch({ item_type:11, target_site:45 });
posts_hot_network.click({ item_type:2, location:11 })">
Do CNAME subdomains redirect to their target?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-gamedev" title="Game Development Stack
Exchange"></div><a href="https://gamedev.stackexchange.com/questions/186888/when-
to-carry-on-with-a-buggy-game-state-versus-terminate-the-process" class="js-gps-
track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11,
target_site:53 }); posts_hot_network.click({ item_type:2, location:11 })">
When to carry on with a buggy game state versus terminate the
process?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-pets" title="Pets Stack
Exchange"></div><a href="https://pets.stackexchange.com/questions/29032/does-
purring-tire-cats" class="js-gps-track question-hyperlink mb0" data-gps-
track="site.switch({ item_type:11, target_site:518 });
posts_hot_network.click({ item_type:2, location:11 })">
Does purring tire cats?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-retrocomputing" title="Retrocomputing
Stack Exchange"></div><a
href="https://retrocomputing.stackexchange.com/questions/16815/did-computers-come-
with-circuit-diagrams" class="js-gps-track question-hyperlink mb0" data-gps-
track="site.switch({ item_type:11, target_site:648 });
posts_hot_network.click({ item_type:2, location:11 })">
Did computers come with circuit diagrams?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-codegolf" title="Code Golf Stack
Exchange"></div><a href="https://codegolf.stackexchange.com/questions/214981/make-
a-minimal-and-maximal-2-digit-number-from-digits-of-two-3-digit-numbers" class="js-
gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11,
target_site:200 }); posts_hot_network.click({ item_type:2, location:11 })">
Make a minimal and maximal 2-digit number from digits of two 3-
digit numbers
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-dba" title="Database Administrators
Stack Exchange"></div><a href="https://dba.stackexchange.com/questions/279457/what-
could-cause-sql-server-to-deny-execution-of-a-sp-at-first-but-allow-it-lat"
class="js-gps-track question-hyperlink mb0" data-gps-
track="site.switch({ item_type:11, target_site:182 });
posts_hot_network.click({ item_type:2, location:11 })">
What could cause SQL Server to deny execution of a SP at first,
but allow it later with no privileges change?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-diy" title="Home Improvement Stack
Exchange"></div><a href="https://diy.stackexchange.com/questions/208502/if-using-
an-old-240v-cable-to-make-two-120v-circuits-is-there-a-risk-of-overhea" class="js-
gps-track question-hyperlink mb0" data-gps-track="site.switch({ item_type:11,
target_site:73 }); posts_hot_network.click({ item_type:2, location:11 })">
If using an old 240v cable to make two 120v circuits, is there
a risk of overheating the shared neutral return?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-blender" title="Blender Stack
Exchange"></div><a href="https://blender.stackexchange.com/questions/201578/object-
movement-unit" class="js-gps-track question-hyperlink mb0" data-gps-
track="site.switch({ item_type:11, target_site:502 });
posts_hot_network.click({ item_type:2, location:11 })">
Object movement unit
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-bicycles" title="Bicycles Stack
Exchange"></div><a href="https://bicycles.stackexchange.com/questions/73292/is-it-
best-to-attack-the-flat-before-a-hill" class="js-gps-track question-hyperlink mb0"
data-gps-track="site.switch({ item_type:11, target_site:126 });
posts_hot_network.click({ item_type:2, location:11 })">
Is it best to attack the flat before a hill?
</a>
</li>
<li class="dno js-hidden">
<div class="favicon favicon-movies" title="Movies & TV Stack
Exchange"></div><a href="https://movies.stackexchange.com/questions/111551/how-can-
a-chess-game-with-clock-take-5-hours" class="js-gps-track question-hyperlink mb0"
data-gps-track="site.switch({ item_type:11, target_site:367 });
posts_hot_network.click({ item_type:2, location:11 })">
How can a chess game with clock take 5 hours?
</a>
</li>
</ul>
<a href="#"
class="show-more js-show-more js-gps-track"
data-gps-track="posts_hot_network.click({ item_type:3, location:11 })">
more hot questions
</a>
</div>
</div>
</div>
<script>StackExchange.ready(function()
{$.get('/posts/18178564/ivc/0dd7');});</script>
<noscript><div><img src="/posts/18178564/ivc/0dd7" class="dno" alt="" width="0"
height="0"></div></noscript><div style="display:none" id="js-codeblock-
lang">default</div></div>
</div>
</div>
<script>;try{(function(a){function b(a){return'string'==typeof a?
document.getElementById(a):a}function c(a){return a=b(a),!!
a&&'none'===getComputedStyle(a).display}function d(a){return!c(a)}function e(a)
{return!!a}function f(a){return /^\s*$/.test(b(a).innerHTML)}function g(a){var
b=a.style;b.height=b.maxHeight=b.minHeight='auto',b.display='none'}function h(a)
{var b=a.style;b.height=b.maxHeight=b.minHeight='auto',b.display='none',
[].forEach.call(a.children,h)}function i(a){var
b=a.style;b.height=b.maxHeight=b.minHeight='auto',b.removeProperty('display')}funct
ion j(a,b){var c;return function(){return a&&(c=a.call(b||
this,arguments),a=null),c}}function k(a){var
b=document.createElement('script');b.src=a,document.body.appendChild(b)}function
l(a){return m([],a)}function m(a,b){return a.push=function(a){return b(),delete
this.push,this.push(a)},a}function n(){try{return!new Function('return
async()=>{};')}catch(a){return!0}}function o(){return'undefined'!=typeof
googletag&&!!googletag.apiReady}function p(){o()||(googletag={cmd:l(B)})}function
q(){var a=document.createElement('div');a.className='adsbox',a.id='clc-
abd',a.style.position='absolute',a.style.pointerEvents='none',a.innerHTML=' ',
document.body.appendChild(a)}function r(){return Object.keys(F.ids)}function s(a)
{var b=F.ids[a],c=F.slots[b];'function'==typeof
c&&(c=c(a));return{path:'/'+C+'/'+E+'/'+b+'/'+D,sizes:c,zone:b}}function t(a)
{try{Array.isArray(clc.dfp.slotsRenderedEvents)||
(clc.dfp.slotsRenderedEvents=[]),clc.dfp.slotsRenderedEvents.push(a);var
b=a.slot.getSlotElementId(),c=[];b||c.push('id=0');var
d=document.getElementById(b);if(!b||d?d.hasAttribute('data-clc-
stalled')&&c.push('st=1'):c.push('el=0'),0!==c.length)return void
G(c.join('&'));var
e=s(b),f=e.zone;if(clc.collapse&&clc.collapse[f]&&a.isEmpty)return h(d),void
d.setAttribute('data-clc-ready','true');if(-1!
==y.dh.indexOf(a.lineItemId))h(d);else if(a.lineItemId){d.setAttribute('data-clc-
prefilled','true');var j=d.parentElement;if(j.classList.contains('js-zone-
container')){g(j);var k=j.querySelectorAll('.js-report-ad-button-
container'),l=k[0];switch(l.style.height='24px',b){case'dfp-tlb':case'dfp-tag':
{j.classList.add('mb8');break}case'dfp-mlb':case'dfp-smlb':case'dfp-bmlb':
{j.classList.add('my8');break}case'dfp-isb':
{j.classList.add('mt24');break}case'dfp-m-aq':
{j.classList.add('my12'),j.classList.add('mx-auto');break}default:}i(j),i(d)}else
i(d);if('dfp-msb'==b){var
m=document.getElementById('hireme');h(m)}}d.setAttribute('data-clc-
ready','true')}catch(a){var n=document.querySelector('#dfp-tsb, #dfp-isb, #clc-
tsb');n&&n.setAttribute('data-clc-ready','true'),G('e=1')}}function u(a,b){'dfp-
isb'===a&&b.setTargeting('Sidebar',['Inline']),'dfp-
tsb'===a&&b.setTargeting('Sidebar',['Right']);var
c=s(a),d=c.path,e=c.sizes,f=c.zone,g=googletag.defineSlot(d,e,a);g.addService(b),!
1}function v(b){var c=a.dfp&&a.dfp.targeting||
{};'SystemDefault'===c.ProductVariant&&(window.matchMedia&&window.matchMedia('(pref
ers-color-scheme: dark)').matches?
c.ProductVariant='Dark':c.ProductVariant='Light'),Object.keys(c).forEach(function(a
){b.setTargeting(a,c[a])})}function w(a){var
g=a.map(b).filter(e);return{eligible:g.filter(f).filter(d),ineligible:g.filter(c)}}
function x(b){void 0===b&&(b=r());var c=['dfp-mlb','dfp-smlb'];if(!o())return
p(),void googletag.cmd.push(function(){return x(b)});var
d=w(b),e=d.eligible,f=d.ineligible;if(e.forEach(function(a){g(a)}),f.forEach(h),0!
==e.length){y.abd&&q(),googletag.destroySlots();var
i=googletag.pubads();y.sf&&(i.setForceSafeFrame(!
0),i.setSafeFrameConfig({allowOverlayExpansion:!0,allowPushExpansion:!0,sandbox:!
0})),y.ll||i.enableSingleRequest(),a.sreEvent||
(i.addEventListener('slotRenderEnded',t),a.sreEvent=!0),v(i);var
j=e.filter(function(a){return!y.ll||0>c.indexOf(a.id)}),k=e.filter(function(a)
{return!!y.ll&&0<=c.indexOf(a.id)});j.forEach(function(a)
{u(a.id,i),a.setAttribute('data-dfp-
zone','true')}),googletag.enableServices(),j.forEach(function(a)
{googletag.display(a.id)}),y.ll&&(i.enableLazyLoad({fetchMarginPercent:0,renderMarg
inPercent:0}),k.forEach(function(a){u(a.id,i),a.setAttribute('data-clc-
prefilled','true')}),k.forEach(function(a){googletag.display(a.id)}))}}var
y=function(a){for(var b=[],c=1;c<arguments.length;c++)b[c-1]=arguments[c];for(var
d,e=0,f=b;e<f.length;e++)for(var g in d=f[e],d)a[g]=d[g];return a}
({"lib":"https://cdn.sstatic.net/clc/clc.min.js?
v=d7c7e62bd2f5","style":"https://cdn.sstatic.net/clc/styles/clc.min.css?
v=83419f27e8fa","u":"https://clc.stackoverflow.com/markup.js","wa":true,"kt":2000,"
tto":true,"h":"clc.stackoverflow.com","allowed":"^(((talent\\.)?stackoverflow)|
(blog\\.codinghorror)|(serverfault|askubuntu)|([^\\.]
+\\.stackexchange))\\.com$","wv":true,"al":false,"dh":
[5171832659],"abd":true},a.options||{}),z=j(function(){var
a=y.lib;n()&&(a=a.replace(/(\.min)?\.js(\?v=[0-9a-fA-F]+)?
$/,'.ie$1.js$2')),k(a)}),A=a.cmd||[];Array.isArray(A)&&(0<A.length?z():m(A,z));var
B=j(function()
{k('https://www.googletagservices.com/tag/js/gpt.js')}),C='248424177',D=/^\/tags\//
.test(location.pathname)||/^\/questions\/tagged\//.test(location.pathname)?'tag-
pages':/^\/$/.test(location.pathname)||/^\/home/.test(location.pathname)?'home-
page':'question-pages',E=location.hostname;var F={slots:{lb:[[728,90]],mlb:
[[728,90]],smlb:[[728,90]],bmlb:[[728,90]],sb:function(a){return'dfp-tsb'===a?
[[300,250],[300,600]]:[[300,250]]},"tag-sponsorship":[[730,135]],"mobile-below-
question":[[320,50],[300,250]],msb:[[300,250],[300,600]]},ids:{"dfp-tlb":'lb',"dfp-
mlb":'mlb',"dfp-smlb":'smlb',"dfp-bmlb":'bmlb',"dfp-tsb":'sb',"dfp-isb":'sb',"dfp-
tag":'tag-sponsorship',"dfp-msb":'msb',"dfp-m-aq":'mobile-below-question',"clc-
tlb":'lb',"clc-mlb":'mlb',"clc-tsb":'sb'}},G=function(a){new
Image().src='https://'+y.h+'/stalled.gif?'+a};(function(){var
b=y.al;b&&A.push(function(){return a.load()})})
(),p(),a.dfp={load:x},a.options=y,a.cmd=A})(this.clc=this.clc||{})}catch(a)
{window.console.error(a)}</script> <script>
var clc = clc || {};
clc.collapse = { sb: !0, 'tag-sponsorship': !0, lb: !0, mlb: !0, smlb: !0,
bmlb: !0, 'mobile-below-question': !0 };
clc.options = clc.options || {};
clc.options.sf = !0;
clc.options.hb = !1;
clc.options.ll = !0;
clc.cmd = clc.cmd || [];
clc.cmd.push(function ()
{ window.clc_request='Au2kT9R6htgIAAAAAARiFQECAAAAAgAAAAAmAAAAfGphdmFzY3JpcHR8anF1Z
XJ5fHB5dGhvbnxhamF4fGRqYW5nb3wAwGTxArFtZM24Dw'; clc.load(); });
clc.dfp = clc.dfp || {};
clc.dfp.targeting = {Registered:['false'],'so-tag':
['javascript','jquery','python','ajax','django'],'tag-reportable':
['javascript','jquery','python','ajax','django'],'tag-non-reportable':
['javascript','jquery','python','ajax','django'],Persona:
['DevOps'],NumberOfAnswers:['11']};
var googletag = googletag || {};
googletag.cmd = googletag.cmd || [];
googletag.cmd.push(function () { clc.dfp.load(); });
StackExchange.ready(function () { googletag.cmd.push(function ()
{ StackExchange.ads.init(googletag, '/ads/report-ad', 'Report this ad') }) });
</script>
</div>
</nav>
<div class="site-footer--copyright fs-fine">
<ul class="-list">
<li class="-item"><a class="js-gps-track -link" data-gps-
track="footer.click({ location: 2, link:4 })" href="https://stackoverflow.blog?
blb=1">Blog</a></li>
<li class="-item"><a
href="https://www.facebook.com/officialstackoverflow/" class="-link js-gps-track"
data-gps-track="footer.click({ location: 2, link: 31 })">Facebook</a></li>
<li class="-item"><a href="https://twitter.com/stackoverflow"
class="-link js-gps-track" data-gps-track="footer.click({ location: 2, link:
32 })">Twitter</a></li>
<li class="-item"><a href="https://linkedin.com/company/stack-
overflow" class="-link js-gps-track" data-gps-track="footer.click({ location: 2,
link: 33 })">LinkedIn</a></li>
<li class="-item"><a
href="https://www.instagram.com/thestackoverflow" class="-link js-gps-track" data-
gps-track="footer.click({ location: 2, link: 36 })">Instagram</a></li>
</ul>
</footer>
<script>StackExchange.ready(function ()
{ StackExchange.responsiveness.addSwitcher(); })</script>
<noscript>
<div id="noscript-warning">Stack Overflow works best with JavaScript
enabled
<img src="https://pixel.quantserve.com/pixel/p-c1rF4kxgLUzNc.gif"
alt="" class="dno">
</div>
</noscript>
<script>
(function(i, s, o, g, r, a, m) {
i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function() { (i[r].q
= i[r].q || []).push(arguments) }, i[r].l = 1 * new Date(); a = s.createElement(o),
m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g;
m.parentNode.insertBefore(a, m);
})(window, document, 'script', 'https://www.google-
analytics.com/analytics.js', 'ga');
StackExchange.ready(function () {
StackExchange.ga.init({
sendTitles: true,
tracker: window.ga,
trackingCodes: [
'UA-108242619-1'
],
checkDimension: 'dimension42'
});
StackExchange.ga.setDimension('dimension2', '|javascript|
jquery|python|ajax|django|');
StackExchange.ga.setDimension('dimension3', 'Questions/Show');
StackExchange.ga.trackPageView();
});
/**/
var _qevents = _qevents || [],
_comscore = _comscore || [];
(function() {
var s = document.getElementsByTagName('script')[0],
qc = document.createElement('script');
qc.async = true;
qc.src = 'https://secure.quantserve.com/quant.js';
s.parentNode.insertBefore(qc, s);
_qevents.push({ qacct: "p-c1rF4kxgLUzNc" });/**/
var sc = document.createElement('script');
sc.async = true;
sc.src = 'https://sb.scorecardresearch.com/beacon.js';
s.parentNode.insertBefore(sc, s);
_comscore.push({ c1: "2", c2: "17440561" }); })();
</script>
</body>
</html>