...
 
Commits (6)
# -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2018-08-09 11:41
from __future__ import unicode_literals
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django_jalali.db.models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('body', '0006_auto_20180529_1206'),
]
operations = [
migrations.CreateModel(
name='Gbw',
fields=[
('id', models.AutoField(primary_key=True, serialize=False)),
('gbw', models.FloatField(verbose_name=' وزن هدف')),
('date_created', django_jalali.db.models.jDateTimeField(blank=True, editable=False, verbose_name='تاریخ ایجاد')),
('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL)),
],
),
]
......@@ -32,6 +32,17 @@ class Drug(models.Model):
remarks = models.CharField(_("توضیحات"), max_length=255)
date = jmodels.jDateTimeField(_("تاریخ ایجاد"), null=True)
#goal body weight
class Gbw(models.Model):
id = models.AutoField(primary_key=True)
user = models.ForeignKey(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)
gbw = models.FloatField(_(' وزن هدف'))
date_created = jmodels.jDateTimeField(_("تاریخ ایجاد"), auto_now_add=True)
# add user activity level table to database
class UserActivity(models.Model):
ACTIVITY_CHOICES = (
......
from django import forms
from django.utils.translation import ugettext_lazy as _
from django.contrib.auth.forms import ReadOnlyPasswordHashField
from users.models import User
from django.conf import settings
from body.models import Weight
from body.models import Weight, Gbw, Drug
class UserCreationForm(forms.ModelForm):
email = forms.EmailField(label='ایمیل', max_length=255)
password1 = forms.CharField(label='گذرواژه', widget=forms.PasswordInput)
......@@ -37,6 +40,30 @@ class WeightCreateForm(forms.ModelForm):
# user will be set in views.ResumeNew
# other fields will be set as model default
class DrugCreateForm(forms.ModelForm):
"""
Use to create Weight
"""
salt = forms.CharField(label="ملح" , max_length=255, required=False)
dosage_form = forms.CharField(label= "شکل دارویی", max_length=255, required=False)
strengh = forms.CharField(label="مقدار دارو", max_length=255, required=False)
route_of_admin = forms.CharField(label="راه مصرف", max_length=255, required=False)
atcـcode = forms.CharField(label="دسته دارو", max_length=255, required=False)
ingredient = forms.CharField(label="ترکیبات", max_length=255, required=False)
remarks = forms.CharField(label="توضیحات", max_length=255, required=False)
class Meta(object):
model = Drug
fields = ('name', 'salt', 'dosage_form', 'strengh', 'route_of_admin', 'atcـcode', 'ingredient', 'remarks')
class GbwCreateForm(forms.ModelForm):
"""
Use to create Weight
"""
class Meta(object):
model = Gbw
fields = ('gbw',)
class UserAdminCreationForm(forms.ModelForm):
"""A form for creating new users. Includes all the required
......
from django.conf.urls import url
from sites import views
from body.models import Weight
from body.models import Weight, Drug
from users.models import User
......@@ -15,13 +15,16 @@ urlpatterns = [
# The home page
url(r'^$', views.index, name='index'),
url(r'^weight/list$', views.WeightList.as_view(), name='weights_list'),
# url(r'^food/list$', views.FoodList.as_view(), name='food_list'),
url(r'^users/list$', views.UserList.as_view(), name='users_list'),
url(r'^home/$', views.HomeView.as_view(), name='dashboard'),
url(r'^profile/(?P<pk>[\w]+)/$', views.ProfileView.as_view(), name='profile'),
url(r'^profile/edit/(?P<pk>[\w]+)/$', views.ProfileUpdate.as_view(), name='profile_edit'),
url(r'^rx/$', views.RxView.as_view(), name='rx'),
url(r'^goal/$', views.GoalView.as_view(), name='goal'),
url(r'^drug/$', views.DrugView.as_view(), name='drug'),
url(r'^goal/create$', views.GoalCreate.as_view(), name='gbw_create'),
url(r'^drug/$', views.DrugList.as_view(), name='drug'),
url(r'^drug/create$', views.CreateDrug.as_view(), name='drug_create'),
url(r'^weight/create$', views.WeightCreate.as_view(), name='weight_create'),
url(r'^weight/(?P<pk>[\w]+)/$', views.WeightShow.as_view(), name='weight_show'),
url(r'^weight/update/(?P<pk>[\w]+)/$', views.WeightUpdate.as_view(
......
......@@ -2,11 +2,11 @@ from django.shortcuts import render, redirect
from django.template import loader
from django.http import HttpResponse, HttpResponseRedirect
from django.views.generic import TemplateView, CreateView, DetailView, UpdateView, DeleteView, ListView
from .forms import UserCreationForm, WeightCreateForm, ProfileUpdateForm
from .forms import UserCreationForm, WeightCreateForm, ProfileUpdateForm, GbwCreateForm, DrugCreateForm
from django.contrib.auth import login
from django.contrib.auth import get_user_model
from django.contrib.auth.decorators import login_required
from body.models import Weight, Rx, Drug
from body.models import Weight, Rx, Drug, Gbw
from django.http import JsonResponse
from django.template.loader import render_to_string
from users.models import User
......@@ -17,7 +17,9 @@ from django.core.urlresolvers import reverse_lazy
from django.contrib.admin.views.decorators import staff_member_required
from pinax.messages.models import Thread
from pinax.messages.forms import Message
from django.core.paginator import EmptyPage, PageNotAnInteger, Paginator
# from usda_nutrition.models import FoodGroup, FoodDescription, NutrientDefinition, Weight
def index(request):
......@@ -108,15 +110,77 @@ class GoalView(TemplateView):
# Call the base implementation first to get a context
context = super().get_context_data(**kwargs)
weight = Weight.objects.filter(user= self.request.user).values('weight',)
last_weight = weight.reverse()[0]
person = User.objects.get(id= self.request.user.id)
gender = person.gender
born = person.birthday
last_weight = weight.order_by('-id')[0]
age = WeightList.age(self, born)
lastest_weight = last_weight["weight"]
height = Weight.objects.filter(user= self.request.user).values('height',)
lastest_height = height.order_by('-id')[0]["height"]
bmr = WeightList.bmr(self, lastest_weight, lastest_height, age, gender)
wibmr_one = bmr + 1000
wibmr_half = bmr +500
wlbmr_one = bmr - 1000
wlbmr_half = bmr -500
lhi = WeightList.toinch(self, lastest_height)
ibw = WeightList.ibw(self, gender, lhi)
goalw = Gbw.objects.filter(user= self.request.user).values('gbw',)
if goalw:
gbw = goalw.order_by('-id')[0]["gbw"]
diff = lastest_weight - gbw
else:
gbw = '_'
diff = '_'
context['lastest_weight'] = lastest_weight
context['ibw'] = ibw
context['gbw'] = gbw
context['diff'] = diff
context['wibmr_one'] = wibmr_one
context['wibmr_half'] = wibmr_half
context['wlbmr_one'] = wlbmr_one
context['wlbmr_half'] = wlbmr_half
return context
@method_decorator(login_required, name='dispatch')
class GoalCreate(CreateView):
model = Gbw
form_class = GbwCreateForm
success_url = reverse_lazy('goal')
def get_initial(self):
initial = super(GoalCreate, self).get_initial()
initial.update({'user': self.request.user.id})
return initial
def form_valid(self, form):
"""Force the user to request.user"""
self.object = form.save(commit=False)
self.object.user_id = self.request.user.id
self.object.save()
return super(GoalCreate, self).form_valid(form)
@method_decorator(staff_member_required, name='dispatch')
class DrugList(ListView):
model = Drug
context_object_name = 'drugs'
paginate_by = 10
@method_decorator(login_required, name='dispatch')
class DrugView(TemplateView):
template_name = 'sites/drug.html'
def get_context_data(self, **kwargs):
# Call the base implementation first to get a context
......@@ -129,6 +193,7 @@ class DrugView(TemplateView):
context['drug'] = drug
return context
@method_decorator(login_required, name='dispatch')
......@@ -151,9 +216,13 @@ class WeightCreate(CreateView):
return super(WeightCreate, self).form_valid(form)
@method_decorator(login_required, name='dispatch')
class WeightList(ListView):
model = Weight
paginate_by = 10
def toinch(self, height):
return round(height /2.54,2) #last height in inch
......@@ -181,15 +250,14 @@ class WeightList(ListView):
def get_context_data(self, **kwargs):
# Call the base implementation first to get a context
context = super().get_context_data(**kwargs)
weights = Weight.objects.filter(user = self.request.user)
weights = Weight.objects.filter(user = self.request.user).order_by('-date_created')
weight = weights.values('weight',)
if weight :
height = weights.values('height',)
person = User.objects.get(id= self.request.user.id)
# gender = User.objects.filter(id= self.request.user.id).values('gender',)[0]
lastest_weight = weight.order_by('-id')[0]["weight"]
lastest_height = height.order_by('-id')[0]["height"]
lastest_weight = weight.order_by('-date_created')[0]["weight"]
lastest_height = height.order_by('-date_created')[0]["height"]
bmi = self.bmi(lastest_weight, lastest_height)
lhi = self.toinch(lastest_height)
gender = person.gender
......@@ -239,6 +307,24 @@ class WeightList(ListView):
@method_decorator(login_required, name='dispatch')
class CreateDrug(CreateView):
model = Drug
form_class = DrugCreateForm
success_url = reverse_lazy('Drug_create')
def form_valid(self, form):
"""Force the user to request.user"""
self.object = form.save(commit=False)
self.object.save()
return super(CreateDrug, self).form_valid(form)
@method_decorator(login_required, name='dispatch')
class WeightShow(DetailView):
model = Weight
......@@ -309,6 +395,9 @@ class ProfileUpdate(UpdateView):
@method_decorator(staff_member_required, name='dispatch')
class UserList(ListView):
model = User
paginate_by = 10
\ No newline at end of file
# @method_decorator(login_required, name='dispatch')
# class FoodList(ListView):
# model = FoodDescription
\ No newline at end of file
......@@ -56,6 +56,7 @@ INSTALLED_APPS = [
'django_jalali',
"pinax.messages",
'bootstrap3',
'usda_nutrition',
]
JWT_AUTH = {
......
{% extends "sites/base_site.html" %}
{% block title %}
{% if object_list %}
ویرایش دارو
{% else %}
افزودن دارو
{% endif %}
{% endblock title %}
{% block stylesheets %}
{{ block.super }}
{% endblock stylesheets %}
{% if object_list %}
{% block location %}
{% if object_list %}
ویرایش دارو
{% else %}
افزودن دارو
{% endif %}
{% endblock location %}
{% endif %}
{% block content %}
<div class="row">
<div class="col-md-4 offset-sm-4">
<div class="card">
<div class="card-header">
{% if object_list %}
ویرایش <strong> دارو </strong>
{% else %}
افزودن <strong> دارو </strong>
{% endif %}
</div>
<div class="card-block">
<form action="" method="post" enctype="multipart/form-data" class="form-horizontal ">{% csrf_token %}
{% if form.errors %}
{% include "users/partials/errors.html" %}
{% endif %}
{% csrf_token %}
{% for field in form %}
<div class="input-group m-b-1">
{% include "users/partials/field.html" %}
</div>
{% endfor %}
<div class="card-footer">
<button type="submit" class="btn btn-sm btn-primary"><i class="fa fa-dot-circle-o"></i>
{% if object_list %}
ویرایش
{% else %}
افزودن
{% endif %}
</button>
<button type="reset" class="btn btn-sm btn-danger"><i class="fa fa-ban"></i> بازنشانی</button>
</div>
</div>
</div>
</div>
{% endblock content %}
{% block javascripts %}
{{ block.super }}
{% endblock javascripts %}
\ No newline at end of file
{% extends "sites/base_site.html" %}
{% load static %}
{% load jformat %}
{% block title %} لیست داروها {% endblock title %}
{% block stylesheets %}
{{ block.super }}
{% endblock stylesheets %}
{% block location %}
لیست داروها
{% endblock location %}
{% block content %}
<!-- Calculates user weight status according to bmi and show allerts -->
<!--/.container-fluid-->
<div class="container-fluid">
<div class="animated fadeIn">
<div class="row">
<div class="col-lg-12">
<div class="card">
<div class="card-header">
<i class="fa fa-align-justify"></i> لیست داروها
</div>
<div class="card-block">
<p>
<a class="btn btn-outline-primary" href="{% url 'drug_create' %}" role="button">
<span class="fas fa-plus"></span>
دارو جدید
</a>
</p>
<table class="table">
<thead>
<tr>
<th>#</th>
<th>نام</th>
<th>ملح</th>
<th>شکل دارویی</th>
<th>مقدار دارو</th>
<th>راه مصرف</th>
</tr>
</thead>
<tbody>
{% for drug in drugs %}
<tr>
<td>{{ drug.id }}</td>
<td>{{ drug.name }}</td>
<td>{{ drug.salt }}</td>
<td>{{ drug.dosage_form }}</td>
<td>{{ drug.strengh }}</td>
<td>{{ drug.route_of_admin }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% if is_paginated %}
<ul class="pagination">
{% if page_obj.has_previous %}
<li class="page-item"><a class="page-link" href="?page={{ page_obj.previous_page_number }}">&laquo; قبل</a></li>
{% else %}
<li class="disabled"><span>&laquo; قبل</span></li>
{% endif %}
{% for i in paginator.page_range %}
{% if page_obj.number == i %}
<li class="active"><span>{{ i }} <span class="sr-only">(current)</span></span></li>
{% else %}
<li class="page-item"><a class="page-link" href="?page={{ i }}">{{ i }}</a></li>
{% endif %}
{% endfor %}
{% if page_obj.has_next %}
<li class="page-item"><a class="page-link" href="?page={{ page_obj.next_page_number }}">&raquo; بعد</a></li>
{% else %}
<li class="disabled"><span>&raquo; بعد</span></li>
{% endif %}
</ul>
{% endif %}
</div>
</div>
</div>
<!--/col-->
</div>
<!-- /.conainer-fluid -->
{% endblock content %}
{% block javascripts %}
{{ block.super }}
{% endblock javascripts %}
{% extends "sites/base_site.html" %}
{% block title %}
{% if object_list %}
ویرایش قد و وزن
{% else %}
افزودن قد و وزن
{% endif %}
{% endblock title %}
{% block stylesheets %}
{{ block.super }}
{% endblock stylesheets %}
{% block location %}
افزودن هدف
{% endblock location %}
{% block content %}
<div class="row">
<div class="col-md-4 offset-sm-4">
<div class="card">
<div class="card-header">
افزودن <strong>هدف</strong>
</div>
<div class="card-block">
<form action="" method="post" enctype="multipart/form-data" class="form-horizontal ">{% csrf_token %}
{% if form.errors %}
{% include "users/partials/errors.html" %}
{% endif %}
{% csrf_token %}
{% for field in form %}
<div class="input-group m-b-1">
{% include "users/partials/field.html" %}
</div>
{% endfor %}
<div class="card-footer">
<button type="submit" class="btn btn-sm btn-primary"><i class="fa fa-dot-circle-o"></i>
افزودن
</button>
<button type="reset" class="btn btn-sm btn-danger"><i class="fa fa-ban"></i> بازنشانی</button>
</div>
</div>
</div>
</div>
{% endblock content %}
{% block javascripts %}
{{ block.super }}
{% endblock javascripts %}
\ No newline at end of file
......@@ -59,7 +59,7 @@
<div class="card card-inverse card-primary">
<div class="card-block p-b-0">
<h4 align='center' class="m-b-0">وزن فعلی</h4>
<h3 align='center'>{{ lastest_weight }}</h3>
<h3 align='center'>{{ lastest_weight|floatformat }}</h3>
</div>
</div>
</div>
......@@ -78,7 +78,7 @@
<div class="card card-inverse card-primary">
<div class="card-block p-b-0">
<h4 align='center' class="m-b-0">BMI</h4>
<h3 align='center'>{{ bmi }}</h3>
<h3 align='center'>{{ bmi|floatformat }}</h3>
</div>
</div>
</div>
......@@ -128,13 +128,13 @@
</tr>
</thead>
<tbody>
{% for weight in object_list %}
{% for weight in weights %}
<tr>
<td>{{ weight.id }}</td>
<td>{{ weight.date_created|jformat:"%A %d %B %Y %H:%M" }}</td>
<td>{{ weight.weight }}</td>
<td>{{ weight.height }}</td>
<td>{{ weight.date_created|jformat:"%d %B %Y" }}</td>
<td>{{ weight.weight|floatformat }}</td>
<td>{{ weight.height|floatformat }}</td>
<td>{{ weight.text }}</td>
<td><a href="{% url "weight_show" weight.id %}">مشاهده</a></td>
<td><a href="{% url "weight_update" weight.id %}">ویرایش</a></td>
......@@ -145,21 +145,28 @@
{% endfor %}
</tbody>
</table>
{% if is_paginated %}
<ul class="pagination">
<li class="page-item"><a class="page-link" href="#">Prev</a>
</li>
<li class="page-item active">
<a class="page-link" href="#">1</a>
</li>
<li class="page-item"><a class="page-link" href="#">2</a>
</li>
<li class="page-item"><a class="page-link" href="#">3</a>
</li>
<li class="page-item"><a class="page-link" href="#">4</a>
</li>
<li class="page-item"><a class="page-link" href="#">Next</a>
</li>
{% if page_obj.has_previous %}
<li class="page-item"><a class="page-link" href="?page={{ page_obj.previous_page_number }}">&laquo; قبل</a></li>
{% else %}
<li class="disabled"><span>&laquo; قبل</span></li>
{% endif %}
{% for i in paginator.page_range %}
{% if page_obj.number == i %}
<li class="page-item"><span>{{ i }} <span class="sr-only">(current)</span></span></li>
{% else %}
<li class="page-item"><a class="page-link" href="?page={{ i }}">{{ i }}</a></li>
{% endif %}
{% endfor %}
{% if page_obj.has_next %}
<li class="page-item"><a class="page-link" href="?page={{ page_obj.next_page_number }}">&raquo; بعد</a></li>
{% else %}
<li class="disabled"><span>&raquo; بعد</span></li>
{% endif %}
</ul>
{% endif %}
</div>
</div>
</div>
......
......@@ -27,7 +27,7 @@
plotOptions: {
line: {
dataLabels: {
enabled: true
enabled: true
},
// enableMouseTracking: false
}
......
......@@ -28,6 +28,7 @@
<div class="chart-wrapper">
{% include "sites/chart.html" %}
</div>
</div>
</div>
{% endif %}
......
......@@ -23,7 +23,7 @@
<div class="card card-inverse card-primary">
<div class="card-block p-b-0">
<h4 align='center' class="m-b-0">وزن فعلی</h4>
<h3 align='center'>{{ lastest_weight }}</h3>
<h3 align='center'>{{ lastest_weight|floatformat }}</h3>
</div>
</div>
</div>
......@@ -32,7 +32,7 @@
<div class="card card-inverse card-primary">
<div class="card-block p-b-0">
<h4 align='center' class="m-b-0">وزن مناسب شما</h4>
<h3 align='center'>{{ ibw }}</h3>
<h3 align='center'>{{ ibw|floatformat }}</h3>
</div>
</div>
</div>
......@@ -42,16 +42,28 @@
<div class="card card-inverse card-primary">
<div class="card-block p-b-0">
<h4 align='center' class="m-b-0">وزن هدف</h4>
<h3 align='center'>{{ bmi }}</h3>
<h3 align='center'>{{ gbw|floatformat }}</h3>
</div>
</div>
</div>
<div class="col-sm-6 col-lg-3">
{% if diff > 0 %}
<div class="card card-inverse card-danger">
<div class="card-block p-b-0">
<h4 align='center' class="m-b-0"> اضافه وزن</h4>
{% elif diff < 0 %}
<div class="card card-inverse card-warning">
<div class="card-block p-b-0">
<h4 align='center' class="m-b-0"> کمبود وزن</h4>
<div class="card card-inverse card-primary">
<h3 align='center'>{{ diff|floatformat|slice:"1:" }} </h3>
{% elif diff == 0 %}
<div class="card card-inverse card-success">
<div class="card-block p-b-0">
<h4 align='center' class="m-b-0"> اضافه یا کمبود وزن</h4>
<h3 align='center'>{{ bmr }} </h3>
<h4 align='center' class="m-b-0"> تبریک!</h4>
<h3 align='center'>به هدف رسیدید </h3>
{% endif %}
</div>
</div>
</div>
......@@ -59,6 +71,80 @@
<!--/row-->
</div>
</div>
<!--/.container-fluid-->
<div class="container-fluid">
<div class="animated fadeIn">
<div class="row">
<div class="col-lg">
<div class="card">
<div class="card-header">
<i class="fa fa-align-justify"></i> هدف شما
</div>
<div class="card-block">
<p>
<a class="btn btn-outline-primary" href="{% url 'gbw_create' %}" role="button">
<span class="fas fa-plus"></span>
هدف جدید
</a>
</p>
<h4>
{% if diff and diff == 0 %}
تبریک شما به هدف خود رسیده اید!
{% elif diff %}
شما
{% if diff < 0 %}
{{ diff|floatformat|slice:"1:" }}
{% elif diff < 0 %}
{{ diff|floatformat }}
{% endif %}
کیلوگرم
{% if diff > 0 %}
اضافه وزن دارید
{% elif diff < 0 %}
کمبود وزن دارید
{% endif %}
برای رسیدن به وزن هدف میبایست
{% if diff < 0 %}
{{ diff|floatformat|slice:"1:" }}
{% elif diff < 0 %}
{{ diff|floatformat }}
{% endif %}
هفته مطابق برنامه پیشنهادی تغذیه کنید.
</h4>
{% endif %}
<h4>
{% if diff and diff == 0 %}
رویه خود را حفظ نموده و توصیه ها را برای حفظ تناسب اندام خود دنبال کنید.
{% elif diff %}
پیشنهاد ما این است که هر روز به میزان
{% if diff < 0 %}
{{ wibmr_one }}
{% elif diff > 0 %}
{{ wlbmr_one }}
{% endif %}
کالری مصرف نمایید تا طی
{% if diff < 0 %}
{{ diff|floatformat|slice:"1:" }}
{% elif diff < 0 %}
{{ diff|floatformat }}
{% endif %}
هفته به هدف خود برسید
</br>
برای پیشنهاد برنامه غذایی مناسب هدفتان به بخش برنامه غذایی مراجعه کنید
</h4>
{% endif %}
</div>
</div>
</div>
<!--/col-->
</div>
<!-- /.conainer-fluid -->
<!--/row-->
</div>
{% endblock content %}
......
......@@ -26,7 +26,7 @@
<div class="card" style="width:400px">
<div class="card-img-top" style="width:100%">
{% avatar user 256 class="img-circle img-responsive" id="user_avatar"%} </br>
{% avatar user 128 class="img-circle img-responsive" id="user_avatar"%} </br>
{% if object == request.user and request.user.is_authenticated %}
<a href="{% url 'avatar_change' %}">نمایه خود را تغییر دهید</a>
{% endif %}
......
......@@ -18,20 +18,20 @@
</li>
<li class="nav-item">
<a class="nav-link" href="/rx/"><i class="fas fa-utensils"></i> لیست نسخه ها</a>
<a class="nav-link" href="/rxs/create"><i class="fas fa-plus"></i> افزودن نسخه </a>
<a class="nav-link" href="/rx/create"><i class="fas fa-plus"></i> افزودن نسخه </a>
</li>
<li class="nav-title">
دارو ها
</li>
<li class="nav-item">
<a class="nav-link" href="/drug/list"><i class="fas fa-pills"></i> لیست دارو ها</a>
<a class="nav-link" href="/drug/"><i class="fas fa-pills"></i> لیست دارو ها</a>
<a class="nav-link" href="/drug/create"><i class="fas fa-plus"></i> افزودن دارو </a>
</li>
<li class="nav-title">
برنامه غذایی
</li>
<li class="nav-item">
<a class="nav-link" href="/program/list"><i class="icon-docs"></i> لیست برنامه ها</a>
<a class="nav-link" href="/program/"><i class="icon-docs"></i> لیست برنامه ها</a>
<a class="nav-link" href="/program/create"><i class="fas fa-plus"></i> افزودن برنامه </a>
</li>
......
{% extends "sites/base_site.html" %}
{% load static %}
{% load jformat %}
{% block title %} غذا {% endblock title %}
{% block stylesheets %}
{{ block.super }}
{% endblock stylesheets %}
{% block location %}
غذا
{% endblock location %}
{% block content %}
<div class="container-fluid">
<div class="animated fadeIn">
<div class="row">
<div class="col-sm-6 col-lg-3">
<table class="table">
<thead>
<tr>
<th>گروه غذایی</th>
<th> توضیح کوتاه</th>
<th>توضیح</th>
</tr>
</thead>
<tbody>
{% for food in object_list %}
<tr>
<td>{{ food.food_group }}</td>
<td>{{ food.short_desc }}</td>
<td>{{ food.long_desc }}</td>
<td>{{ food.fat_factor }}</td>
<td>{{ food.cho_factor }}</td>
<td>{{ food.protein_factor }}</td>
<td>{{ food.nitrogen_factor }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<!--/row-->
</div>
</div>
<!--/row-->
</div>
{% endblock content %}
{% block javascripts %}
{{ block.super }}
{% endblock javascripts %}
{% extends "sites/base_site.html" %}
{% load static %}
{% load jformat %}
{% block title %} آنالیز وزن {% endblock title %}
{% block stylesheets %}
{{ block.super }}
{% endblock stylesheets %}
{% block location %}
آنالیز وزن
{% endblock location %}
{% block content %}
<div class="container-fluid">
<div class="animated fadeIn">
<div class="row">
<div class="col-sm-6 col-lg-3">
<table class="table">
<thead>
<tr>
<th>کد</th>
<th>توضیح</th>
</tr>
</thead>
<tbody>
{% for food in object_list %}
<tr>
<td>{{ food.code }}</td>
<td>{{ food.description }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<!--/row-->
</div>
</div>
<!--/row-->
</div>
{% endblock content %}
{% block javascripts %}
{{ block.super }}
{% endblock javascripts %}
{% extends "sites/base_site.html" %}
{% load static %}
{% load jformat %}
{% block title %} غذا {% endblock title %}
{% block stylesheets %}
{{ block.super }}
{% endblock stylesheets %}
{% block location %}
غذا
{% endblock location %}
{% block content %}
<div class="container-fluid">
<div class="animated fadeIn">
<div class="row">
<div class="col-sm-6 col-lg-3">
<table class="table">
<thead>
<tr>
<th>گروه غذایی</th>
<th> توضیح کوتاه</th>
<th>توضیح</th>
</tr>
</thead>
<tbody>
{% for food in object_list %}
<tr>
<td>{{ food.nutrient_description }}</td>
<td>{{ food.units }}</td>
<td>{{ food.nutrient_number }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<!--/row-->
</div>
</div>
<!--/row-->
</div>
{% endblock content %}
{% block javascripts %}
{{ block.super }}
{% endblock javascripts %}
{% extends "sites/base_site.html" %}
{% load static %}
{% load jformat %}
{% block title %} غذا {% endblock title %}
{% block stylesheets %}
{{ block.super }}
{% endblock stylesheets %}
{% block location %}
غذا
{% endblock location %}
{% block content %}
<div class="container-fluid">
<div class="animated fadeIn">
<div class="row">
<div class="col-sm-6 col-lg-3">
<table class="table">
<thead>
<tr>
<th>مقدار</th>
<th> واحد اندازه گیری</th>
<th>گروه غذایی</th>
<th>گرم</th>
</tr>
</thead>
<tbody>
{% for food in object_list %}
<tr>
<td>{{ food.amount }}</td>
<td>{{ food.measure_description }}</td>
<td>{{ food.food_description }}</td>
<td>{{ food.gram_weight }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<!--/row-->
</div>
</div>
<!--/row-->
</div>
{% endblock content %}
{% block javascripts %}
{{ block.super }}
{% endblock javascripts %}
......@@ -40,7 +40,8 @@
</tr>
</thead>
<tbody>
{% for user in object_list %}
{% for user in object_list %}
{% if user.is_patient is True %}
<tr>
<td>{{ user.id }}</td>
......@@ -50,24 +51,34 @@
</tr>
{% endfor %}
{% endif %}
{% endfor %}
</tbody>
</table>
{% if is_paginated %}
<ul class="pagination">
<li class="page-item"><a class="page-link" href="#">Prev</a>
</li>
<li class="page-item active">
<a class="page-link" href="#">1</a>
</li>
<li class="page-item"><a class="page-link" href="#">2</a>
</li>
<li class="page-item"><a class="page-link" href="#">3</a>
</li>
<li class="page-item"><a class="page-link" href="#">4</a>
</li>
<li class="page-item"><a class="page-link" href="#">Next</a>
</li>
{% if page_obj.has_previous %}
<li class="page-item"><a class="page-link" href="?page={{ page_obj.previous_page_number }}">&laquo; قبل</a></li>
{% else %}
<li class="disabled"><span>&laquo; قبل</span></li>
{% endif %}
{% for i in paginator.page_range %}
{% if page_obj.number == i %}
<li class="page-item"><span>{{ i }} <span class="sr-only">(current)</span></span></li>
{% else %}
<li class="page-item"><a class="page-link" href="?page={{ i }}">{{ i }}</a></li>
{% endif %}
{% endfor %}
{% if page_obj.has_next %}
<li class="page-item"><a class="page-link" href="?page={{ page_obj.next_page_number }}">&raquo; بعد</a></li>
{% else %}
<li class="disabled"><span>&raquo; بعد</span></li>
{% endif %}
</ul>
{% endif %}
</div>
</div>
</div>
......