How do I get Django to display what, I want in database





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







1















Thanks for helping. I'm sorry I'm bad at programming.



Ok, I'm trying to take data out my database (SQLite 3) and display all at once.



This my code for views



def index(request):
tank = tank_system.objects.all()
args = {'tank':tank}
return render(request,'FrounterWeb/includes.html',args)


and here are my HTML that place



{% block content %}
<div class ="table-responsive-sm">
<!-- tables tiles -->
<table class ="table table-bordered table-responsive-sm">
<tr>
<th>Time</th>
<th>EC</th>
<th>pH</th>
<th>Tank level</th>
<th>room temptures</th>
<th>Water temptrure</th>
</tr>
{% for tank_system in tank %}
<tr>
<td>time</td>
<td>{{tank.EC}}</td>
<td>{{tank.PH}}</td>
<td>{{tank.WaterLevel}} lites</td>
<td>{{tank.TempRoom}} C</td>
<td>{{tank.TempWater}} C</td>
</tr>

{%endfor%}
</table>
</div>
{% endblock %}


the end result objects.all() result



But if I would to modified to with objects.get(id=x)



Here modified views;



    def index(request):
tank = tank_system.objects.get(id=1)
args = {'tank':tank}
return render(request,'FrounterWeb/includes.html',args)

and adjustment made in HTML;

{% block content %}
<div class ="table-responsive-sm">
<!-- tables tiles -->
<table class ="table table-bordered table-responsive-sm">
<tr>
<th>Time</th>
<th>EC</th>
<th>pH</th>
<th>Tank level</th>
<th>room temptures</th>
<th>Water temptrure</th>
</tr>

<tr>
<td>time</td>
<td>{{tank.EC}}</td>
<td>{{tank.PH}}</td>
<td>{{tank.WaterLevel}} lites</td>
<td>{{tank.TempRoom}} C</td>
<td>{{tank.TempWater}} C</td>
</tr>


</table>
</div>
{% endblock %}


and end result for this is objects.get(id=) result



I guarantee that the database pass jQuery data/object into my html, but now I'm stumped on how to fix this....



please help it should be simply fix










share|improve this question

























  • What is your question? What is wrong in those screenshots?

    – Daniel Roseman
    Nov 22 '18 at 8:46


















1















Thanks for helping. I'm sorry I'm bad at programming.



Ok, I'm trying to take data out my database (SQLite 3) and display all at once.



This my code for views



def index(request):
tank = tank_system.objects.all()
args = {'tank':tank}
return render(request,'FrounterWeb/includes.html',args)


and here are my HTML that place



{% block content %}
<div class ="table-responsive-sm">
<!-- tables tiles -->
<table class ="table table-bordered table-responsive-sm">
<tr>
<th>Time</th>
<th>EC</th>
<th>pH</th>
<th>Tank level</th>
<th>room temptures</th>
<th>Water temptrure</th>
</tr>
{% for tank_system in tank %}
<tr>
<td>time</td>
<td>{{tank.EC}}</td>
<td>{{tank.PH}}</td>
<td>{{tank.WaterLevel}} lites</td>
<td>{{tank.TempRoom}} C</td>
<td>{{tank.TempWater}} C</td>
</tr>

{%endfor%}
</table>
</div>
{% endblock %}


the end result objects.all() result



But if I would to modified to with objects.get(id=x)



Here modified views;



    def index(request):
tank = tank_system.objects.get(id=1)
args = {'tank':tank}
return render(request,'FrounterWeb/includes.html',args)

and adjustment made in HTML;

{% block content %}
<div class ="table-responsive-sm">
<!-- tables tiles -->
<table class ="table table-bordered table-responsive-sm">
<tr>
<th>Time</th>
<th>EC</th>
<th>pH</th>
<th>Tank level</th>
<th>room temptures</th>
<th>Water temptrure</th>
</tr>

<tr>
<td>time</td>
<td>{{tank.EC}}</td>
<td>{{tank.PH}}</td>
<td>{{tank.WaterLevel}} lites</td>
<td>{{tank.TempRoom}} C</td>
<td>{{tank.TempWater}} C</td>
</tr>


</table>
</div>
{% endblock %}


and end result for this is objects.get(id=) result



I guarantee that the database pass jQuery data/object into my html, but now I'm stumped on how to fix this....



please help it should be simply fix










share|improve this question

























  • What is your question? What is wrong in those screenshots?

    – Daniel Roseman
    Nov 22 '18 at 8:46














1












1








1








Thanks for helping. I'm sorry I'm bad at programming.



Ok, I'm trying to take data out my database (SQLite 3) and display all at once.



This my code for views



def index(request):
tank = tank_system.objects.all()
args = {'tank':tank}
return render(request,'FrounterWeb/includes.html',args)


and here are my HTML that place



{% block content %}
<div class ="table-responsive-sm">
<!-- tables tiles -->
<table class ="table table-bordered table-responsive-sm">
<tr>
<th>Time</th>
<th>EC</th>
<th>pH</th>
<th>Tank level</th>
<th>room temptures</th>
<th>Water temptrure</th>
</tr>
{% for tank_system in tank %}
<tr>
<td>time</td>
<td>{{tank.EC}}</td>
<td>{{tank.PH}}</td>
<td>{{tank.WaterLevel}} lites</td>
<td>{{tank.TempRoom}} C</td>
<td>{{tank.TempWater}} C</td>
</tr>

{%endfor%}
</table>
</div>
{% endblock %}


the end result objects.all() result



But if I would to modified to with objects.get(id=x)



Here modified views;



    def index(request):
tank = tank_system.objects.get(id=1)
args = {'tank':tank}
return render(request,'FrounterWeb/includes.html',args)

and adjustment made in HTML;

{% block content %}
<div class ="table-responsive-sm">
<!-- tables tiles -->
<table class ="table table-bordered table-responsive-sm">
<tr>
<th>Time</th>
<th>EC</th>
<th>pH</th>
<th>Tank level</th>
<th>room temptures</th>
<th>Water temptrure</th>
</tr>

<tr>
<td>time</td>
<td>{{tank.EC}}</td>
<td>{{tank.PH}}</td>
<td>{{tank.WaterLevel}} lites</td>
<td>{{tank.TempRoom}} C</td>
<td>{{tank.TempWater}} C</td>
</tr>


</table>
</div>
{% endblock %}


and end result for this is objects.get(id=) result



I guarantee that the database pass jQuery data/object into my html, but now I'm stumped on how to fix this....



please help it should be simply fix










share|improve this question
















Thanks for helping. I'm sorry I'm bad at programming.



Ok, I'm trying to take data out my database (SQLite 3) and display all at once.



This my code for views



def index(request):
tank = tank_system.objects.all()
args = {'tank':tank}
return render(request,'FrounterWeb/includes.html',args)


and here are my HTML that place



{% block content %}
<div class ="table-responsive-sm">
<!-- tables tiles -->
<table class ="table table-bordered table-responsive-sm">
<tr>
<th>Time</th>
<th>EC</th>
<th>pH</th>
<th>Tank level</th>
<th>room temptures</th>
<th>Water temptrure</th>
</tr>
{% for tank_system in tank %}
<tr>
<td>time</td>
<td>{{tank.EC}}</td>
<td>{{tank.PH}}</td>
<td>{{tank.WaterLevel}} lites</td>
<td>{{tank.TempRoom}} C</td>
<td>{{tank.TempWater}} C</td>
</tr>

{%endfor%}
</table>
</div>
{% endblock %}


the end result objects.all() result



But if I would to modified to with objects.get(id=x)



Here modified views;



    def index(request):
tank = tank_system.objects.get(id=1)
args = {'tank':tank}
return render(request,'FrounterWeb/includes.html',args)

and adjustment made in HTML;

{% block content %}
<div class ="table-responsive-sm">
<!-- tables tiles -->
<table class ="table table-bordered table-responsive-sm">
<tr>
<th>Time</th>
<th>EC</th>
<th>pH</th>
<th>Tank level</th>
<th>room temptures</th>
<th>Water temptrure</th>
</tr>

<tr>
<td>time</td>
<td>{{tank.EC}}</td>
<td>{{tank.PH}}</td>
<td>{{tank.WaterLevel}} lites</td>
<td>{{tank.TempRoom}} C</td>
<td>{{tank.TempWater}} C</td>
</tr>


</table>
</div>
{% endblock %}


and end result for this is objects.get(id=) result



I guarantee that the database pass jQuery data/object into my html, but now I'm stumped on how to fix this....



please help it should be simply fix







html django database django-templates django-views






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 23 '18 at 14:25









marc_s

585k13011261272




585k13011261272










asked Nov 22 '18 at 8:42









Rookies DJRookies DJ

958




958













  • What is your question? What is wrong in those screenshots?

    – Daniel Roseman
    Nov 22 '18 at 8:46



















  • What is your question? What is wrong in those screenshots?

    – Daniel Roseman
    Nov 22 '18 at 8:46

















What is your question? What is wrong in those screenshots?

– Daniel Roseman
Nov 22 '18 at 8:46





What is your question? What is wrong in those screenshots?

– Daniel Roseman
Nov 22 '18 at 8:46












1 Answer
1






active

oldest

votes


















1














The problem is the for loop in your template. You're using a loop variable called tank_system, but then referring to a non-existent variable called tank when you output each attribute.



Using the correct variable name of tank_system should resolve, e.g.



{% for tank_system in tank %}
<tr>
<td>time</td>
<td>{{tank_system.EC}}</td>
<td>{{tank_system.PH}}</td>
<td>{{tank_system.WaterLevel}} lites</td>
<td>{{tank_system.TempRoom}} C</td>
<td>{{tank_system.TempWater}} C</td>
</tr>
{%endfor%}





share|improve this answer
























  • I guess this is the answer, although OP hasn't actually said what is wrong.

    – Daniel Roseman
    Nov 22 '18 at 10:29











  • Yes, Daniel that was the answer, I was actually printing out my list, I want the print out my object. That the problem. Thank you, Daniel and Will; I can't thank you enough.

    – Rookies DJ
    Nov 22 '18 at 13:23














Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53426897%2fhow-do-i-get-django-to-display-what-i-want-in-database%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









1














The problem is the for loop in your template. You're using a loop variable called tank_system, but then referring to a non-existent variable called tank when you output each attribute.



Using the correct variable name of tank_system should resolve, e.g.



{% for tank_system in tank %}
<tr>
<td>time</td>
<td>{{tank_system.EC}}</td>
<td>{{tank_system.PH}}</td>
<td>{{tank_system.WaterLevel}} lites</td>
<td>{{tank_system.TempRoom}} C</td>
<td>{{tank_system.TempWater}} C</td>
</tr>
{%endfor%}





share|improve this answer
























  • I guess this is the answer, although OP hasn't actually said what is wrong.

    – Daniel Roseman
    Nov 22 '18 at 10:29











  • Yes, Daniel that was the answer, I was actually printing out my list, I want the print out my object. That the problem. Thank you, Daniel and Will; I can't thank you enough.

    – Rookies DJ
    Nov 22 '18 at 13:23


















1














The problem is the for loop in your template. You're using a loop variable called tank_system, but then referring to a non-existent variable called tank when you output each attribute.



Using the correct variable name of tank_system should resolve, e.g.



{% for tank_system in tank %}
<tr>
<td>time</td>
<td>{{tank_system.EC}}</td>
<td>{{tank_system.PH}}</td>
<td>{{tank_system.WaterLevel}} lites</td>
<td>{{tank_system.TempRoom}} C</td>
<td>{{tank_system.TempWater}} C</td>
</tr>
{%endfor%}





share|improve this answer
























  • I guess this is the answer, although OP hasn't actually said what is wrong.

    – Daniel Roseman
    Nov 22 '18 at 10:29











  • Yes, Daniel that was the answer, I was actually printing out my list, I want the print out my object. That the problem. Thank you, Daniel and Will; I can't thank you enough.

    – Rookies DJ
    Nov 22 '18 at 13:23
















1












1








1







The problem is the for loop in your template. You're using a loop variable called tank_system, but then referring to a non-existent variable called tank when you output each attribute.



Using the correct variable name of tank_system should resolve, e.g.



{% for tank_system in tank %}
<tr>
<td>time</td>
<td>{{tank_system.EC}}</td>
<td>{{tank_system.PH}}</td>
<td>{{tank_system.WaterLevel}} lites</td>
<td>{{tank_system.TempRoom}} C</td>
<td>{{tank_system.TempWater}} C</td>
</tr>
{%endfor%}





share|improve this answer













The problem is the for loop in your template. You're using a loop variable called tank_system, but then referring to a non-existent variable called tank when you output each attribute.



Using the correct variable name of tank_system should resolve, e.g.



{% for tank_system in tank %}
<tr>
<td>time</td>
<td>{{tank_system.EC}}</td>
<td>{{tank_system.PH}}</td>
<td>{{tank_system.WaterLevel}} lites</td>
<td>{{tank_system.TempRoom}} C</td>
<td>{{tank_system.TempWater}} C</td>
</tr>
{%endfor%}






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 22 '18 at 10:29









Will KeelingWill Keeling

12.5k22736




12.5k22736













  • I guess this is the answer, although OP hasn't actually said what is wrong.

    – Daniel Roseman
    Nov 22 '18 at 10:29











  • Yes, Daniel that was the answer, I was actually printing out my list, I want the print out my object. That the problem. Thank you, Daniel and Will; I can't thank you enough.

    – Rookies DJ
    Nov 22 '18 at 13:23





















  • I guess this is the answer, although OP hasn't actually said what is wrong.

    – Daniel Roseman
    Nov 22 '18 at 10:29











  • Yes, Daniel that was the answer, I was actually printing out my list, I want the print out my object. That the problem. Thank you, Daniel and Will; I can't thank you enough.

    – Rookies DJ
    Nov 22 '18 at 13:23



















I guess this is the answer, although OP hasn't actually said what is wrong.

– Daniel Roseman
Nov 22 '18 at 10:29





I guess this is the answer, although OP hasn't actually said what is wrong.

– Daniel Roseman
Nov 22 '18 at 10:29













Yes, Daniel that was the answer, I was actually printing out my list, I want the print out my object. That the problem. Thank you, Daniel and Will; I can't thank you enough.

– Rookies DJ
Nov 22 '18 at 13:23







Yes, Daniel that was the answer, I was actually printing out my list, I want the print out my object. That the problem. Thank you, Daniel and Will; I can't thank you enough.

– Rookies DJ
Nov 22 '18 at 13:23






















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53426897%2fhow-do-i-get-django-to-display-what-i-want-in-database%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Guess what letter conforming each word

Port of Spain

Run scheduled task as local user group (not BUILTIN)