flask- how to suppress “None” from a query
I'm building a fantasy baseball website in python/flask, using Bulma for the css. I'm fairly new to flask development. MySql is the backend database. The page that I'm building is to show draft results. I'm done with the exception of this little pesky problem. I've done lots of searching, but haven't found my specific answer, so asking for a little help...
The page displays a table of draft results. Each row will contain either a major league baseball player or a minor league player, but not both. In other words, one of the last 2 columns should be blank, one should have a player name with a link to his mlb/milb page. What I'm getting is this:
What I want is for the "None" values to be blank. Here is my relevant code:
app.py
@app.route('/draft_results_prior/<string:yr>/')
def draft_results_prior(yr)
try:
conn = mysql.connect()
cursor = conn.cursor(pymysql.cursors.DictCursor)
cursor.execute("SELECT dr.draft_round, dr.pick_no, (SELECT af.city FROM act_franchise as af WHERE af.team_id = dr.original_team_id) orig_team, (SELECT af2.city FROM act_franchise as af2 WHERE af2.team_id = dr.traded_team_id) trade_team, dr.mlb_id, CONCAT('http://m.mlb.com/player/',dr.mlb_id) as Link, (SELECT concat(mlbr.name_first,' ', mlbr.name_last) FROM mlb_rosters as mlbr WHERE mlbr.mlb_id = dr.mlb_id) mlb_name, dr.milb_id, CONCAT('http://www.milb.com/player/index.jsp?sid=milb&player_id=',dr.milb_id) as milb_Link, (SELECT concat(milbr.name_first,' ', milbr.name_last) FROM milb_players as milbr WHERE milbr.milb_id = dr.milb_id) milb_name, dr.intl_id FROM draft_results as dr WHERE dr.ibc_year = %s",(yr))
thisDraft = cursor.fetchall()`
return render_template('draft_results_prior.html', thisDraft=thisDraft, yr=yr)
except Exception as e:
print(e)
finally:
cursor.close()
conn.close()
return render_template('draft_results_prior.html', thisDraft=thisDraft)
In draft_results_prior.html, I have this table:
<table class="table table-bordered is-fullwidth is-striped is-hoverable">
<thead>
<tr>
<th class= "yellowones">Round #</th>
<th class= "yellowones">Pick #</th>
<th class= "yellowones">Team</th>
<th class= "yellowones">Traded To</th>
<th class= "yellowones">MLB Pick</th>
<th class= "yellowones">MiLB Pick</th>
</tr>
</thead>
% for dr in thisDraft %
<tbody>
<td class= "greenones has-text-left">dr.draft_round</td>
<td class= "greenones has-text-left">dr.pick_no</td>
<td class= "greenones has-text-left">dr.orig_team</td>
<td class= "greenones has-text-left">dr.trade_team</td>
<td class= "greenones has-text-left"><a href="dr.Link">dr.mlb_name</a></td>
<td class= "greenones has-text-left"><a href="dr.milb_Link">dr.milb_name</a></td>
</tbody>
% endfor %
</table>
I feel like I need some sort of "if" loop around the last 2 columns to check if the value is null, but I'm unsure of the syntax. Any pointers would be really appreciated!
EDITED BASED ON kungpho's answer below:
If I do this:
<td class= "greenones has-text-left"><a href="dr.Link">dr.mlb_name</a></td>
% if dr.milb_name %
<td class= "greenones has-text-left"><a href="dr.milb_Link">dr.milb_name</a></td>
% else %
% endif %
I get this:
That is exactly what I want for the MiLB Pick column. So I tried to do the same to the MLB column, but it combined both columns into one:
% if dr.mlb_name %
<td class= "greenones has-text-left"><a href="dr.Link">dr.mlb_name</a></td>
% else %
% endif %
% if dr.milb_name %
<td class= "greenones has-text-left"><a href="dr.milb_Link">dr.milb_name</a></td>
% else %
% endif %
This is what it did:
How can I keep both columns?
EDIT #2- CORRECT answer
Here's the correct answer:
% if dr.mlb_name %
<td class= "greenones has-text-left"><a href="dr.Link">dr.mlb_name</a></td>
% else %
<td class= "greenones has-text-left"><a href=""></a></td>
% endif %
% if dr.milb_name %
<td class= "greenones has-text-left"><a href="dr.milb_Link">dr.milb_name</a></td>
% else %
<td class= "greenones has-text-left"><a href=""></a></td>
% endif %
Yields:
Woohoo!
python mysql flask bulma
add a comment |
I'm building a fantasy baseball website in python/flask, using Bulma for the css. I'm fairly new to flask development. MySql is the backend database. The page that I'm building is to show draft results. I'm done with the exception of this little pesky problem. I've done lots of searching, but haven't found my specific answer, so asking for a little help...
The page displays a table of draft results. Each row will contain either a major league baseball player or a minor league player, but not both. In other words, one of the last 2 columns should be blank, one should have a player name with a link to his mlb/milb page. What I'm getting is this:
What I want is for the "None" values to be blank. Here is my relevant code:
app.py
@app.route('/draft_results_prior/<string:yr>/')
def draft_results_prior(yr)
try:
conn = mysql.connect()
cursor = conn.cursor(pymysql.cursors.DictCursor)
cursor.execute("SELECT dr.draft_round, dr.pick_no, (SELECT af.city FROM act_franchise as af WHERE af.team_id = dr.original_team_id) orig_team, (SELECT af2.city FROM act_franchise as af2 WHERE af2.team_id = dr.traded_team_id) trade_team, dr.mlb_id, CONCAT('http://m.mlb.com/player/',dr.mlb_id) as Link, (SELECT concat(mlbr.name_first,' ', mlbr.name_last) FROM mlb_rosters as mlbr WHERE mlbr.mlb_id = dr.mlb_id) mlb_name, dr.milb_id, CONCAT('http://www.milb.com/player/index.jsp?sid=milb&player_id=',dr.milb_id) as milb_Link, (SELECT concat(milbr.name_first,' ', milbr.name_last) FROM milb_players as milbr WHERE milbr.milb_id = dr.milb_id) milb_name, dr.intl_id FROM draft_results as dr WHERE dr.ibc_year = %s",(yr))
thisDraft = cursor.fetchall()`
return render_template('draft_results_prior.html', thisDraft=thisDraft, yr=yr)
except Exception as e:
print(e)
finally:
cursor.close()
conn.close()
return render_template('draft_results_prior.html', thisDraft=thisDraft)
In draft_results_prior.html, I have this table:
<table class="table table-bordered is-fullwidth is-striped is-hoverable">
<thead>
<tr>
<th class= "yellowones">Round #</th>
<th class= "yellowones">Pick #</th>
<th class= "yellowones">Team</th>
<th class= "yellowones">Traded To</th>
<th class= "yellowones">MLB Pick</th>
<th class= "yellowones">MiLB Pick</th>
</tr>
</thead>
% for dr in thisDraft %
<tbody>
<td class= "greenones has-text-left">dr.draft_round</td>
<td class= "greenones has-text-left">dr.pick_no</td>
<td class= "greenones has-text-left">dr.orig_team</td>
<td class= "greenones has-text-left">dr.trade_team</td>
<td class= "greenones has-text-left"><a href="dr.Link">dr.mlb_name</a></td>
<td class= "greenones has-text-left"><a href="dr.milb_Link">dr.milb_name</a></td>
</tbody>
% endfor %
</table>
I feel like I need some sort of "if" loop around the last 2 columns to check if the value is null, but I'm unsure of the syntax. Any pointers would be really appreciated!
EDITED BASED ON kungpho's answer below:
If I do this:
<td class= "greenones has-text-left"><a href="dr.Link">dr.mlb_name</a></td>
% if dr.milb_name %
<td class= "greenones has-text-left"><a href="dr.milb_Link">dr.milb_name</a></td>
% else %
% endif %
I get this:
That is exactly what I want for the MiLB Pick column. So I tried to do the same to the MLB column, but it combined both columns into one:
% if dr.mlb_name %
<td class= "greenones has-text-left"><a href="dr.Link">dr.mlb_name</a></td>
% else %
% endif %
% if dr.milb_name %
<td class= "greenones has-text-left"><a href="dr.milb_Link">dr.milb_name</a></td>
% else %
% endif %
This is what it did:
How can I keep both columns?
EDIT #2- CORRECT answer
Here's the correct answer:
% if dr.mlb_name %
<td class= "greenones has-text-left"><a href="dr.Link">dr.mlb_name</a></td>
% else %
<td class= "greenones has-text-left"><a href=""></a></td>
% endif %
% if dr.milb_name %
<td class= "greenones has-text-left"><a href="dr.milb_Link">dr.milb_name</a></td>
% else %
<td class= "greenones has-text-left"><a href=""></a></td>
% endif %
Yields:
Woohoo!
python mysql flask bulma
add a comment |
I'm building a fantasy baseball website in python/flask, using Bulma for the css. I'm fairly new to flask development. MySql is the backend database. The page that I'm building is to show draft results. I'm done with the exception of this little pesky problem. I've done lots of searching, but haven't found my specific answer, so asking for a little help...
The page displays a table of draft results. Each row will contain either a major league baseball player or a minor league player, but not both. In other words, one of the last 2 columns should be blank, one should have a player name with a link to his mlb/milb page. What I'm getting is this:
What I want is for the "None" values to be blank. Here is my relevant code:
app.py
@app.route('/draft_results_prior/<string:yr>/')
def draft_results_prior(yr)
try:
conn = mysql.connect()
cursor = conn.cursor(pymysql.cursors.DictCursor)
cursor.execute("SELECT dr.draft_round, dr.pick_no, (SELECT af.city FROM act_franchise as af WHERE af.team_id = dr.original_team_id) orig_team, (SELECT af2.city FROM act_franchise as af2 WHERE af2.team_id = dr.traded_team_id) trade_team, dr.mlb_id, CONCAT('http://m.mlb.com/player/',dr.mlb_id) as Link, (SELECT concat(mlbr.name_first,' ', mlbr.name_last) FROM mlb_rosters as mlbr WHERE mlbr.mlb_id = dr.mlb_id) mlb_name, dr.milb_id, CONCAT('http://www.milb.com/player/index.jsp?sid=milb&player_id=',dr.milb_id) as milb_Link, (SELECT concat(milbr.name_first,' ', milbr.name_last) FROM milb_players as milbr WHERE milbr.milb_id = dr.milb_id) milb_name, dr.intl_id FROM draft_results as dr WHERE dr.ibc_year = %s",(yr))
thisDraft = cursor.fetchall()`
return render_template('draft_results_prior.html', thisDraft=thisDraft, yr=yr)
except Exception as e:
print(e)
finally:
cursor.close()
conn.close()
return render_template('draft_results_prior.html', thisDraft=thisDraft)
In draft_results_prior.html, I have this table:
<table class="table table-bordered is-fullwidth is-striped is-hoverable">
<thead>
<tr>
<th class= "yellowones">Round #</th>
<th class= "yellowones">Pick #</th>
<th class= "yellowones">Team</th>
<th class= "yellowones">Traded To</th>
<th class= "yellowones">MLB Pick</th>
<th class= "yellowones">MiLB Pick</th>
</tr>
</thead>
% for dr in thisDraft %
<tbody>
<td class= "greenones has-text-left">dr.draft_round</td>
<td class= "greenones has-text-left">dr.pick_no</td>
<td class= "greenones has-text-left">dr.orig_team</td>
<td class= "greenones has-text-left">dr.trade_team</td>
<td class= "greenones has-text-left"><a href="dr.Link">dr.mlb_name</a></td>
<td class= "greenones has-text-left"><a href="dr.milb_Link">dr.milb_name</a></td>
</tbody>
% endfor %
</table>
I feel like I need some sort of "if" loop around the last 2 columns to check if the value is null, but I'm unsure of the syntax. Any pointers would be really appreciated!
EDITED BASED ON kungpho's answer below:
If I do this:
<td class= "greenones has-text-left"><a href="dr.Link">dr.mlb_name</a></td>
% if dr.milb_name %
<td class= "greenones has-text-left"><a href="dr.milb_Link">dr.milb_name</a></td>
% else %
% endif %
I get this:
That is exactly what I want for the MiLB Pick column. So I tried to do the same to the MLB column, but it combined both columns into one:
% if dr.mlb_name %
<td class= "greenones has-text-left"><a href="dr.Link">dr.mlb_name</a></td>
% else %
% endif %
% if dr.milb_name %
<td class= "greenones has-text-left"><a href="dr.milb_Link">dr.milb_name</a></td>
% else %
% endif %
This is what it did:
How can I keep both columns?
EDIT #2- CORRECT answer
Here's the correct answer:
% if dr.mlb_name %
<td class= "greenones has-text-left"><a href="dr.Link">dr.mlb_name</a></td>
% else %
<td class= "greenones has-text-left"><a href=""></a></td>
% endif %
% if dr.milb_name %
<td class= "greenones has-text-left"><a href="dr.milb_Link">dr.milb_name</a></td>
% else %
<td class= "greenones has-text-left"><a href=""></a></td>
% endif %
Yields:
Woohoo!
python mysql flask bulma
I'm building a fantasy baseball website in python/flask, using Bulma for the css. I'm fairly new to flask development. MySql is the backend database. The page that I'm building is to show draft results. I'm done with the exception of this little pesky problem. I've done lots of searching, but haven't found my specific answer, so asking for a little help...
The page displays a table of draft results. Each row will contain either a major league baseball player or a minor league player, but not both. In other words, one of the last 2 columns should be blank, one should have a player name with a link to his mlb/milb page. What I'm getting is this:
What I want is for the "None" values to be blank. Here is my relevant code:
app.py
@app.route('/draft_results_prior/<string:yr>/')
def draft_results_prior(yr)
try:
conn = mysql.connect()
cursor = conn.cursor(pymysql.cursors.DictCursor)
cursor.execute("SELECT dr.draft_round, dr.pick_no, (SELECT af.city FROM act_franchise as af WHERE af.team_id = dr.original_team_id) orig_team, (SELECT af2.city FROM act_franchise as af2 WHERE af2.team_id = dr.traded_team_id) trade_team, dr.mlb_id, CONCAT('http://m.mlb.com/player/',dr.mlb_id) as Link, (SELECT concat(mlbr.name_first,' ', mlbr.name_last) FROM mlb_rosters as mlbr WHERE mlbr.mlb_id = dr.mlb_id) mlb_name, dr.milb_id, CONCAT('http://www.milb.com/player/index.jsp?sid=milb&player_id=',dr.milb_id) as milb_Link, (SELECT concat(milbr.name_first,' ', milbr.name_last) FROM milb_players as milbr WHERE milbr.milb_id = dr.milb_id) milb_name, dr.intl_id FROM draft_results as dr WHERE dr.ibc_year = %s",(yr))
thisDraft = cursor.fetchall()`
return render_template('draft_results_prior.html', thisDraft=thisDraft, yr=yr)
except Exception as e:
print(e)
finally:
cursor.close()
conn.close()
return render_template('draft_results_prior.html', thisDraft=thisDraft)
In draft_results_prior.html, I have this table:
<table class="table table-bordered is-fullwidth is-striped is-hoverable">
<thead>
<tr>
<th class= "yellowones">Round #</th>
<th class= "yellowones">Pick #</th>
<th class= "yellowones">Team</th>
<th class= "yellowones">Traded To</th>
<th class= "yellowones">MLB Pick</th>
<th class= "yellowones">MiLB Pick</th>
</tr>
</thead>
% for dr in thisDraft %
<tbody>
<td class= "greenones has-text-left">dr.draft_round</td>
<td class= "greenones has-text-left">dr.pick_no</td>
<td class= "greenones has-text-left">dr.orig_team</td>
<td class= "greenones has-text-left">dr.trade_team</td>
<td class= "greenones has-text-left"><a href="dr.Link">dr.mlb_name</a></td>
<td class= "greenones has-text-left"><a href="dr.milb_Link">dr.milb_name</a></td>
</tbody>
% endfor %
</table>
I feel like I need some sort of "if" loop around the last 2 columns to check if the value is null, but I'm unsure of the syntax. Any pointers would be really appreciated!
EDITED BASED ON kungpho's answer below:
If I do this:
<td class= "greenones has-text-left"><a href="dr.Link">dr.mlb_name</a></td>
% if dr.milb_name %
<td class= "greenones has-text-left"><a href="dr.milb_Link">dr.milb_name</a></td>
% else %
% endif %
I get this:
That is exactly what I want for the MiLB Pick column. So I tried to do the same to the MLB column, but it combined both columns into one:
% if dr.mlb_name %
<td class= "greenones has-text-left"><a href="dr.Link">dr.mlb_name</a></td>
% else %
% endif %
% if dr.milb_name %
<td class= "greenones has-text-left"><a href="dr.milb_Link">dr.milb_name</a></td>
% else %
% endif %
This is what it did:
How can I keep both columns?
EDIT #2- CORRECT answer
Here's the correct answer:
% if dr.mlb_name %
<td class= "greenones has-text-left"><a href="dr.Link">dr.mlb_name</a></td>
% else %
<td class= "greenones has-text-left"><a href=""></a></td>
% endif %
% if dr.milb_name %
<td class= "greenones has-text-left"><a href="dr.milb_Link">dr.milb_name</a></td>
% else %
<td class= "greenones has-text-left"><a href=""></a></td>
% endif %
Yields:
Woohoo!
python mysql flask bulma
python mysql flask bulma
edited Nov 13 '18 at 7:00
noel
asked Nov 13 '18 at 4:48
noelnoel
316
316
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
In your case, yes, it looks like a simple if
should do the trick. You'll still want to render the column itself, just not the contents, so your HTML stays valid (browsers will often tolerate it if you don't, but it's still better to keep it as clean as possible).
Example:
<td class="greenones has-text-left">
% if dr.milb_Link %
<a href=" dr.milb_Link "> dr.milb_name </a>
% else %
% endif %
</td>
If you were just displaying a value and not an HTML element, Jinja2 has a built-in default
filter (true
here applies it to falsey values, not just undefined variables):
default(' ', true)
Thank you @kungphu. This is very close to what I am looking for, except it makes all the answers appear in a single column. I was looking for the 2 columns to continue to exist, but with blanks. I'll edit up above based on your answer. I am very close! Thank you!
– noel
Nov 13 '18 at 6:41
You're welcome. I called it an example because it's just one of the columns; you'll need to implement it for the other one. :) It's almost directly copy and paste from here.
– kungphu
Nov 13 '18 at 6:46
Please see my edit in my original question. It didn't quite work. Very close though! Thank you again for the help.
– noel
Nov 13 '18 at 6:49
You've put theif
outside thetd
; it needs to be inside, otherwise as you can see, thetd
itself isn't rendered.
– kungphu
Nov 13 '18 at 6:55
1
Nevermind- I figured it out. Thanks again!
– noel
Nov 13 '18 at 6:58
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53273992%2fflask-how-to-suppress-none-from-a-query%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
In your case, yes, it looks like a simple if
should do the trick. You'll still want to render the column itself, just not the contents, so your HTML stays valid (browsers will often tolerate it if you don't, but it's still better to keep it as clean as possible).
Example:
<td class="greenones has-text-left">
% if dr.milb_Link %
<a href=" dr.milb_Link "> dr.milb_name </a>
% else %
% endif %
</td>
If you were just displaying a value and not an HTML element, Jinja2 has a built-in default
filter (true
here applies it to falsey values, not just undefined variables):
default(' ', true)
Thank you @kungphu. This is very close to what I am looking for, except it makes all the answers appear in a single column. I was looking for the 2 columns to continue to exist, but with blanks. I'll edit up above based on your answer. I am very close! Thank you!
– noel
Nov 13 '18 at 6:41
You're welcome. I called it an example because it's just one of the columns; you'll need to implement it for the other one. :) It's almost directly copy and paste from here.
– kungphu
Nov 13 '18 at 6:46
Please see my edit in my original question. It didn't quite work. Very close though! Thank you again for the help.
– noel
Nov 13 '18 at 6:49
You've put theif
outside thetd
; it needs to be inside, otherwise as you can see, thetd
itself isn't rendered.
– kungphu
Nov 13 '18 at 6:55
1
Nevermind- I figured it out. Thanks again!
– noel
Nov 13 '18 at 6:58
add a comment |
In your case, yes, it looks like a simple if
should do the trick. You'll still want to render the column itself, just not the contents, so your HTML stays valid (browsers will often tolerate it if you don't, but it's still better to keep it as clean as possible).
Example:
<td class="greenones has-text-left">
% if dr.milb_Link %
<a href=" dr.milb_Link "> dr.milb_name </a>
% else %
% endif %
</td>
If you were just displaying a value and not an HTML element, Jinja2 has a built-in default
filter (true
here applies it to falsey values, not just undefined variables):
default(' ', true)
Thank you @kungphu. This is very close to what I am looking for, except it makes all the answers appear in a single column. I was looking for the 2 columns to continue to exist, but with blanks. I'll edit up above based on your answer. I am very close! Thank you!
– noel
Nov 13 '18 at 6:41
You're welcome. I called it an example because it's just one of the columns; you'll need to implement it for the other one. :) It's almost directly copy and paste from here.
– kungphu
Nov 13 '18 at 6:46
Please see my edit in my original question. It didn't quite work. Very close though! Thank you again for the help.
– noel
Nov 13 '18 at 6:49
You've put theif
outside thetd
; it needs to be inside, otherwise as you can see, thetd
itself isn't rendered.
– kungphu
Nov 13 '18 at 6:55
1
Nevermind- I figured it out. Thanks again!
– noel
Nov 13 '18 at 6:58
add a comment |
In your case, yes, it looks like a simple if
should do the trick. You'll still want to render the column itself, just not the contents, so your HTML stays valid (browsers will often tolerate it if you don't, but it's still better to keep it as clean as possible).
Example:
<td class="greenones has-text-left">
% if dr.milb_Link %
<a href=" dr.milb_Link "> dr.milb_name </a>
% else %
% endif %
</td>
If you were just displaying a value and not an HTML element, Jinja2 has a built-in default
filter (true
here applies it to falsey values, not just undefined variables):
default(' ', true)
In your case, yes, it looks like a simple if
should do the trick. You'll still want to render the column itself, just not the contents, so your HTML stays valid (browsers will often tolerate it if you don't, but it's still better to keep it as clean as possible).
Example:
<td class="greenones has-text-left">
% if dr.milb_Link %
<a href=" dr.milb_Link "> dr.milb_name </a>
% else %
% endif %
</td>
If you were just displaying a value and not an HTML element, Jinja2 has a built-in default
filter (true
here applies it to falsey values, not just undefined variables):
default(' ', true)
answered Nov 13 '18 at 6:27
kungphukungphu
2,76011324
2,76011324
Thank you @kungphu. This is very close to what I am looking for, except it makes all the answers appear in a single column. I was looking for the 2 columns to continue to exist, but with blanks. I'll edit up above based on your answer. I am very close! Thank you!
– noel
Nov 13 '18 at 6:41
You're welcome. I called it an example because it's just one of the columns; you'll need to implement it for the other one. :) It's almost directly copy and paste from here.
– kungphu
Nov 13 '18 at 6:46
Please see my edit in my original question. It didn't quite work. Very close though! Thank you again for the help.
– noel
Nov 13 '18 at 6:49
You've put theif
outside thetd
; it needs to be inside, otherwise as you can see, thetd
itself isn't rendered.
– kungphu
Nov 13 '18 at 6:55
1
Nevermind- I figured it out. Thanks again!
– noel
Nov 13 '18 at 6:58
add a comment |
Thank you @kungphu. This is very close to what I am looking for, except it makes all the answers appear in a single column. I was looking for the 2 columns to continue to exist, but with blanks. I'll edit up above based on your answer. I am very close! Thank you!
– noel
Nov 13 '18 at 6:41
You're welcome. I called it an example because it's just one of the columns; you'll need to implement it for the other one. :) It's almost directly copy and paste from here.
– kungphu
Nov 13 '18 at 6:46
Please see my edit in my original question. It didn't quite work. Very close though! Thank you again for the help.
– noel
Nov 13 '18 at 6:49
You've put theif
outside thetd
; it needs to be inside, otherwise as you can see, thetd
itself isn't rendered.
– kungphu
Nov 13 '18 at 6:55
1
Nevermind- I figured it out. Thanks again!
– noel
Nov 13 '18 at 6:58
Thank you @kungphu. This is very close to what I am looking for, except it makes all the answers appear in a single column. I was looking for the 2 columns to continue to exist, but with blanks. I'll edit up above based on your answer. I am very close! Thank you!
– noel
Nov 13 '18 at 6:41
Thank you @kungphu. This is very close to what I am looking for, except it makes all the answers appear in a single column. I was looking for the 2 columns to continue to exist, but with blanks. I'll edit up above based on your answer. I am very close! Thank you!
– noel
Nov 13 '18 at 6:41
You're welcome. I called it an example because it's just one of the columns; you'll need to implement it for the other one. :) It's almost directly copy and paste from here.
– kungphu
Nov 13 '18 at 6:46
You're welcome. I called it an example because it's just one of the columns; you'll need to implement it for the other one. :) It's almost directly copy and paste from here.
– kungphu
Nov 13 '18 at 6:46
Please see my edit in my original question. It didn't quite work. Very close though! Thank you again for the help.
– noel
Nov 13 '18 at 6:49
Please see my edit in my original question. It didn't quite work. Very close though! Thank you again for the help.
– noel
Nov 13 '18 at 6:49
You've put the
if
outside the td
; it needs to be inside, otherwise as you can see, the td
itself isn't rendered.– kungphu
Nov 13 '18 at 6:55
You've put the
if
outside the td
; it needs to be inside, otherwise as you can see, the td
itself isn't rendered.– kungphu
Nov 13 '18 at 6:55
1
1
Nevermind- I figured it out. Thanks again!
– noel
Nov 13 '18 at 6:58
Nevermind- I figured it out. Thanks again!
– noel
Nov 13 '18 at 6:58
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53273992%2fflask-how-to-suppress-none-from-a-query%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown