from django.shortcuts import render
from zigview.models import tank_system
def index(request):
return render(request,'FrounterWeb/includes.html')
def login(requset):
return render(requset, 'FrounterWeb/login.html')
def timedex(requset):
tank = tank_system.object.get(id(5))
print(tank)
return render(requset, "FrounterWeb/body.html",tank)
from django.db import models
class user(models.Model):
username = models.CharField(max_length=50)
password = models.CharField(max_length=50)
class tank_system(models.Model):
Ph = models.DecimalField(max_digits=2, decimal_places=1)
EC = models.DecimalField(max_digits=2, decimal_places=1)
temp = models.DecimalField(max_digits=2, decimal_places=0)
level = models.IntegerField(primary_key=True, default=0)
data = models.DateTimeField(auto_now=True)
<table align="right" style="width:80%">
<tr>
<th>Time</th>
<th>Tank level</th>
<th>EC</th>
<th>pH</th>
<th>room temptures</th>
<th>Water temptrure</th>
</tr>
<tr>
<td>22.30</td>
<td>900 lits</td>
<td>{{tank}}</td>
<td>7.3</td>
<td>{{tank}}</td>
<td>24</td>
</tr></table>
Web
├── templates │ ├── index.hmtl │ │ └── includes │ ├── body.hml │ ├── header.html
from django.contrib import admin
from django.urls import include, path
from django.views.generic.base import TemplateView
urlpatterns = [
path(r'^admin/$', admin.site.urls),
path('account', include('django.contrib.auth.urls')),
path('', include('zigview.urls')),
path(r'', TemplateView.as_view(template_name='index.html'), name = 'myapp'),
]
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/8123c3d9-e972-426f-9b1f-46a463b98548%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/0ccdcf5d-1d90-41e4-be33-f3684dace2b1%40googlegroups.com.
The content for the `render` method is supposed to be a dictionary: https://docs.djangoproject.com/en/2.1/topics/http/shortcuts/#optional-argumentsSo change it to this render(requset, "FrounterWeb/body.html",{'tank': tank})Also in the template file you want to display the properties of the ORM (tank_system) object I guess, change them to <td>{{tank.EC}}</td>, <td>{{tank. temp}}</td>, respectively.Hope it helps!
Cuneyt Mertayak |
--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To post to this group, send email to django...@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/45d9f4af-4807-4692-8d6e-dcc7ab14818a%40googlegroups.com.