当前位置:网站首页>Favorite tips link
Favorite tips link
2022-04-22 02:54:00 【The_ Caibe】
Django Self contained filter() Inquire about model Table skills
1.filter The screening criteria for
2.filter Multi criteria query of
3. Yes model Foreign key query
In fact, it's equivalent to model Set the foreign key name ( F_modelname ) It points to Ben model Another link to the foreign key mode, So the usage is : Foreign key name F_modelname__ Foreign keys model Field __ filter = ”xxxxx“
BootStraptable Using skills
Basic use
BootStraptable Parameters
Parameters are basically used
JS string manipulation
JS Complete collection of string processing
Django View function of view
Django Improve rendering speed
There is a project , once filter Out of Queryset Yes 4000 Multiple data , Every piece of data 7、8 A field
So much data is used {%for%} Iterative rendering to the front end takes 20s many , Too slow
Searched for ways to improve rendering speed for half a day , I don't know what to say
And then I wonder if it could be Queryset The problem of data structure , Iterative access is too slow
And search for it , There is really this problem , Then the solution is to use values_list(), Dictionary ( Key value pair ) Structure into tuples ( Pure value )
Final 4000 It takes a few seconds to render the data ,1000 Less than... Pieces of data 1 second
Use as follows :
data = StudentCgg.objects.filter((Q(id__icontains=q) | Q(name__icontains=q)) & Q(age__icontains=q)).values_list()
data = StudentCgg.objects.all().values_list()
The rendering uses the following :
{% for val in data %}
{
{ val.id }} ==> {
{ val.0 }}
{
{ val.name }} ==> {
{ val.1 }}
{
{ val.age }} ==> {
{ val.2 }}
{% endfor %}
Subscript order is in the order of table fields
This is the website that provides my ideas
版权声明
本文为[The_ Caibe]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204220248300236.html
边栏推荐
- How to restrict the unity of code
- Excel tips - vlookup automatic matching
- [※ leetcode refers to the path in offer 12. Matrix (simple)]
- 刷题计划——动态规划dynamic programming(一)
- Analysis on the development status of meta universe
- Flutter04 widget initial experience
- Will you "sell" SQL?
- 致文明的生活方式和环境污染
- Delphi自动适应屏幕大小
- After the asynchronous operation, let the subsequent code of await continue to execute
猜你喜欢

外包干了四年,废了

I'm going to start learning canvas

牛客网C语言入门刷题记录

Will you "sell" SQL?

Creation of circular linked list and controllable output

C language character classification and conversion
![[※ leetcode sword finger offer 13. Motion range of robot (simple)]](/img/b6/16d99754284dd7f17081651b3cb354.png)
[※ leetcode sword finger offer 13. Motion range of robot (simple)]

顺序表实现栈的操作

Financial information security training - 22 / 4 / 19 (Part I)

Text processing - sed
随机推荐
Buy a Tencent cloud server to play
Why does MySQL index use B + tree instead of jump table?
Performance test and comparison of oceanbase and MariaDB using dbt-3
收藏的技巧链接
UE4 obtains the complete map path according to the map name
Possible reasons for slow response of Web site access
Translation of yolov3 papers
Will you "sell" SQL?
To civilized lifestyle and environmental pollution
(Advanced) C function call
C指针和数组深度汇总
Type of water tunnel
Stackoverflow:IActionContextAccessor Is Null
IIS prompt: the solution of "this website requires you to log in".
遇到个奇怪的问题,同时开启本地和远程两个事务,远程事务是sql2000没问题,是sql2008的不报错,但是写不上数据
Modem dial-up playback, originally written in the millionaire, summarized.
闭包是什么?闭包造成的内存泄漏又怎么解决?
Apple watch theme picture crawl!
824. Goat Latin (string segmentation + string substitution)
Kerberos authentication protocol