本文整理汇总了Python中rapidsms.webui.utils.paginated函数的典型用法代码示例。如果您正苦于以下问题:Python paginated函数的具体用法?Python paginated怎么用?Python paginated使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了paginated函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。
示例1: site
def site(request, pk, template="weltel/site.html"):
context = {}
site = get_object_or_404(Site, id=pk)
patients = Patient.objects.filter(site=site)
nurses = Nurse.objects.filter(sites=site)
context['site'] = site
context['patients'] = paginated(request, patients)
context['nurses'] = paginated(request, nurses)
return render_to_response(request, template, context)
开发者ID:ITIDO,项目名称:rapidsms,代码行数:9,代码来源:views.py
示例2: index
def index(request, template="weltel/index.html"):
context = {}
sites = Site.objects.all().order_by('name')
start_of_week = datetime.now()
# set to monday 00:00
start_of_week = start_of_week - timedelta(days=start_of_week.weekday(),
hours=start_of_week.hour,
minutes=start_of_week.minute)
for site in sites:
patients = Patient.objects.filter(site=site)
site.patient_count = patients.count()
site.nurse_count = Nurse.objects.filter(sites=site).count()
sawa_patients = patients.filter(state__code=SAWA_CODE)
shida_patients = patients.filter(state__code=SHIDA_CODE)
site.sawa_count = sawa_patients.count()
site.shida_count = shida_patients.count()
sawa_patients_this_week = sawa_patients.filter(active=True).filter(subscribed=True)
sawa_patients_this_week = sawa_patients_this_week.filter(eventlog__date__gte=start_of_week)
site.sawa_count_this_week = sawa_patients_this_week.distinct().count()
shida_patients_this_week = shida_patients.filter(active=True).filter(subscribed=True)
shida_patients_this_week = shida_patients_this_week.filter(eventlog__date__gte=start_of_week)
site.shida_count_this_week = shida_patients_this_week.distinct().count()
context['sites'] = paginated(request, sites)
#messages = EventLog.objects.select_related().order_by('-received')
#context.update( format_events_in_context(request, context, messages) )
return render_to_response(request, template, context)
开发者ID:ITIDO,项目名称:rapidsms,代码行数:28,代码来源:views.py
示例3: patient_messages
def patient_messages(request, pk, template="weltel/patient.html"):
patient = get_object_or_404(Patient, id=pk)
context = {}
context['patient'] = patient
logs = get_messages_for_patient(patient)
context['messages'] = paginated(request, logs)
return render_to_response(request, template, context )
开发者ID:jonathandick,项目名称:rapidsms,代码行数:7,代码来源:views.py
示例4: index
def index(req):
template_name = "childhealth/index.html"
surveyentries = SurveyEntry.objects.order_by("survey_date")
all = []
[all.append(entry) for entry in surveyentries]
# sort by date, descending
all.sort(lambda x, y: cmp(y.survey_date, x.survey_date))
assessments = ass_dicts_for_display()
# sort by date, descending
assessments.sort(lambda x, y: cmp(y["date"], x["date"]))
context = {}
context["entries"] = paginated(req, all, per_page=50)
context["assessments"] = paginated(req, assessments, per_page=50)
return render_to_response(req, template_name, context)
开发者ID:ewheeler,项目名称:rapidsms-community-apps,代码行数:16,代码来源:views.py
示例5: index
def index(req):
columns = (("name", "Point Name"),
("wqmarea", "Area"),
)
sort_column, sort_descending = _get_sort_info(req, default_sort_column="name",
default_sort_descending=False)
sort_desc_string = "-" if sort_descending else ""
search_string = req.REQUEST.get("q", "")
query = SamplingPoint.objects.order_by("%s%s" % (sort_desc_string, sort_column))
if search_string == "":
query = query.all()
else:
district = WqmAuthority.objects.get(id = search_string)
query = query.filter(
Q(wqmarea__wqmauthority__id=district.id ))
search_string = district
points = paginated(req, query)
return render_to_response(req,
"index.html", {
"columns": columns,
"points": points,
"districts": WqmAuthority.objects.all(),
"sort_column": sort_column,
"sort_descending": sort_descending,
"search_string": search_string,
})
开发者ID:aquaya,项目名称:wqmanager,代码行数:30,代码来源:views.py
示例6: index
def index(req):
# reporters = get_tester(req.user)
template_name = "testers/index.html"
columns = (("last_name", "Surname"),
("first_name", "Firstname"),
)
sort_column, sort_descending = _get_sort_info(req, default_sort_column="last_name",
default_sort_descending=False)
sort_desc_string = "-" if sort_descending else ""
search_string = req.REQUEST.get("q", "")
query = Reporter.objects.order_by("%s%s" % (sort_desc_string, sort_column))
if search_string == "":
query = query.all()
else:
query = query.filter(
Q(first_name__icontains=search_string) |
Q(last_name__icontains=search_string))
reporters = paginated(req, query)
# TODO: get the facility from the reporter profile
# and make if sortable.
profiles = ReporterProfile.objects.filter(domain=req.user.selected_domain)
return render_to_response(req, template_name, {"columns": columns,
"reporters": reporters,
"profiles": profiles,
"sort_column": sort_column,
"sort_descending": sort_descending,
"search_string": search_string})
开发者ID:commtrack,项目名称:commtrack-core,代码行数:35,代码来源:views.py
示例7: get
def get(req):
# pre-populate the "connections" field
# with a connection object to convert into a
# reporter, if provided in the query string
connections = []
if "connection" in req.GET:
connections.append(
get_object_or_404(
PersistantConnection,
pk=req.GET["connection"]))
reporters = get_tester(req.user)
return render_to_response(req,
"testers/testers.html", {
# display paginated reporters in the left panel
"reporters": paginated(req, reporters),
# pre-populate connections
"connections": connections,
# list all groups + backends in the edit form
"all_groups": ReporterGroup.objects.flatten(),
"facilities": Facility.objects.filter(domain = req.user.selected_domain),
"all_backends": PersistantBackend.objects.all() })
开发者ID:commtrack,项目名称:commtrack-core,代码行数:25,代码来源:views.py
示例8: index
def index(req):
template_name = "facilities/index_flat.html"
columns = (("added_date", "Date Added"), ("name", "Name"), ("location", "Location"), ("description", "Description"))
sort_column, sort_descending = _get_sort_info(req, default_sort_column="added_date", default_sort_descending=True)
sort_desc_string = "-" if sort_descending else ""
search_string = req.REQUEST.get("q", "")
query = Facility.objects.order_by("%s%s" % (sort_desc_string, sort_column))
if search_string == "":
query = query.all()
else:
query = query.filter(Q(name__icontains=search_string))
# Q(location__icontains=search_string))
facilities = paginated(req, query)
return render_to_response(
req,
template_name,
{
"columns": columns,
"facilities": facilities,
"sort_column": sort_column,
"sort_descending": sort_descending,
"search_string": search_string,
},
)
开发者ID:fredwilliam,项目名称:PMO,代码行数:28,代码来源:views.py
示例9: resource_history
def resource_history(req):
"""
display resources' history
"""
template_name = "resources/history.html"
columns = (("date", "Date Of Request"), ("name", "Name"), ("code", "Code"), ("Facility", "Current Location"))
# ("New", "Prev Location")) #previous location
sort_column, sort_descending = _get_sort_info(req, default_sort_column="date", default_sort_descending=True)
sort_desc_string = "-" if sort_descending else ""
search_string = req.REQUEST.get("q", "")
query = Resource.objects.order_by("%s%s" % (sort_desc_string, sort_column))
if search_string == "":
query = query.all()
else:
query = query.filter(Q(status__icontains=search_string) | Q(user__first_name__icontains=search_string))
history = paginated(req, query)
return render_to_response(
req,
template_name,
{
"columns": columns,
"history": history,
"sort_column": sort_column,
"sort_descending": sort_descending,
"search_string": search_string,
},
)
开发者ID:fredwilliam,项目名称:PMO,代码行数:32,代码来源:views.py
示例10: index
def index(req):
template_name="logger/index_flat.html"
columns = (("date", "Date"),
("connection__identity", "From/To"),
("connection__backend", "Backend"),
("is_incoming", "Direction"),
("text", "Message"))
sort_column, sort_descending = _get_sort_info(req, default_sort_column="date",
default_sort_descending=True)
sort_desc_string = "-" if sort_descending else ""
search_string = req.REQUEST.get("q", "")
query = Message.objects.select_related("connection", "connection__backend"
).order_by("%s%s" % (sort_desc_string, sort_column))
if search_string == "":
query = query.all()
else:
query = query.filter(
Q(text__icontains=search_string) |
Q(connection__identity__icontains=search_string))
messages = paginated(req, query)
return render_to_response(req, template_name, {"columns": columns,
"messages": messages,
"sort_column": sort_column,
"sort_descending": sort_descending,
"search_string": search_string})
开发者ID:zimrapid,项目名称:rapidsms,代码行数:29,代码来源:views.py
示例11: index
def index(request):
template_name = "index.html"
notifications = SmsNotification.objects.all().order_by("-authorised_personnel")
return render_to_response(
request, template_name, {"notifications": paginated(request, notifications, prefix="smsnotice")}
)
开发者ID:commtrack,项目名称:commtrack-core,代码行数:8,代码来源:views.py
示例12: patient
def patient(request, pk, template="weltel/patient.html"):
patient = get_object_or_404(Patient, id=pk)
context = {}
context['patient'] = patient
logs = get_history_for_patient(patient)
context['history'] = paginated(request, logs)
context['phone_numbers'] = [c.identity for c in patient.connections.all()]
return render_to_response(request, template, context )
开发者ID:ITIDO,项目名称:rapidsms,代码行数:8,代码来源:views.py
示例13: get
def get(req):
template_name = "facilities/index.html"
facilities = Facility.objects.all().filter(domain=req.user.selected_domain)
locations = Location.objects.all()
return render_to_response(
req, template_name, {"facilities": paginated(req, facilities, prefix="facility"), "locations": locations}
)
开发者ID:fredwilliam,项目名称:PMO,代码行数:8,代码来源:views.py
示例14: location_type
def location_type(req, location_type_pk):
loc_type = get_object_or_404(
LocationType, pk=location_type_pk)
return render_to_response(req,
"locations/location-type.html", {
"active_location_type_tab": loc_type.pk,
"locations": paginated(req, loc_type.locations.all(), prefix="loc"),
"location_type": loc_type })
开发者ID:lengani,项目名称:rapidsms_legacy,代码行数:9,代码来源:views.py
示例15: nurse
def nurse(request, pk, template="weltel/nurse.html"):
context = {}
nurse = get_object_or_404(Nurse, id=pk)
context['nurse'] = nurse
logs = nurse.messages(order_by='-received')
if logs:
context['logs'] = paginated(request, logs)
context['phone_numbers'] = [c.identity for c in nurse.connections.all()]
return render_to_response(request, template, context )
开发者ID:ITIDO,项目名称:rapidsms,代码行数:9,代码来源:views.py
示例16: index
def index(request, template="contacts/index.html"):
context = {}
contacts = Contact.objects.all()
for contact in contacts:
connections = PersistantConnection.objects.filter(reporter=contact.reporter)
if connections:
contact.phone_number = connections[0].identity
context['contacts'] = paginated(request, contacts)
return render_to_response(request, template, context)
开发者ID:GunioRobot,项目名称:rapidsms-tostan,代码行数:9,代码来源:views.py
示例17: dataPaginatev2
def dataPaginatev2(req,value,kfilter={},paginate=True,*args,**kwargs):
try:
cmd = "%s.objects" % value.klass
if len(kfilter) == 0:
cmd = cmd+".all()"
else:
cmd = cmd+".filter(**%s)" % kfilter
if value.exclude : cmd = cmd+".exclude(**%s)" % kwargs["exclude"]
if value.filterorder : cmd = cmd+".order_by(\"%s\")" % value.filterorder
data = eval(cmd)
p = paginated(req,data)
#THANKS ADAM FOR SUPPORTING AGGREGATION
if paginate :
return {"paginate":paginated(req,data,prefix="%d" % value.id),"cmd":cmd}
else:
return {"paginate":data,"cmd":cmd}
except Exception,e:
return "%s e %s" % (e,cmd)
开发者ID:ewheeler,项目名称:rapidsms-community-apps,代码行数:21,代码来源:utils.py
示例18: bylocation
def bylocation(req,location):
type_id = LocationType.objects.get(slug=location).id
locations = Location.objects.filter(type=type_id).order_by("name")
rapidsms_locations =[]
other_locations = []
status_location = [l.location.id for l in LocationStatus.objects.all()]
rapidsms_loctions = Location.objects.filter(type=type_id,id__in=status_location).order_by("name")
other_locations = Location.objects.filter(type=type_id)#.exclude(id__in=status_location).order_by("name")
header,data = statsoverview([l for l in locations])
#header,data = statsoverview(rapidsms) #replace with this
title = "Data on a %s Level" % location
locations = Location.objects.filter(type=type_id).order_by("name")
return render_to_response(req,
"infsss/locations.html", {
"rapidsms_locations": paginated(req,rapidsms_locations,prefix="rapidsms"),
"other_locations": paginated(req,other_locations,prefix="other"),
"title": title,
"header":header,
"data": data })
开发者ID:ewheeler,项目名称:rapidsms-community-apps,代码行数:22,代码来源:views.py
示例19: dataPaginate
def dataPaginate(req,value,*args,**kwargs):
try:
if value.params == "" or value.params == "0": #remove 0 temp f#$k up
cmd = "%s.objects.all()" % (value.klass)
else:
cmd = "%s.objects.filter(%s)" % (value.klass,value.params) % kwargs
if value.filterorder: cmd = "%s.order_by(\"%s\")" % (cmd,value.filterorder)
data = eval(cmd)
return {"paginate":paginated(req,data,prefix="%d" % value.id),"cmd":cmd}
except Exception,e:
return "%s" % e
开发者ID:ewheeler,项目名称:rapidsms-community-apps,代码行数:13,代码来源:utils.py
示例20: index
def index(request):
template_name = 'sindex.html'
notifications = SmsNotification.objects.all().order_by("-authorised_sampler")
points = SamplingPoint.objects.all().order_by("name")
districts = WqmAuthority.objects.all()
return render_to_response(request,
template_name, {
"notifications": paginated(request, notifications, prefix="smsnotice"),
"points" : points,
"districts": districts,
})
开发者ID:commtrack,项目名称:commcare-hq,代码行数:13,代码来源:views.py
注:本文中的rapidsms.webui.utils.paginated函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论