Tag:django

  • Three steps to realize Django Paginator paging

    Time:2019-11-22

    Django provides a new class to help manage paging data, which is stored in Django / core / pager.py. It can receive lists, tuples or other iteratable objects. This article will introduce the implementation steps of Django Paginator paging in three steps I. create subject through model Django models from django.db import models class Subject(models.Model): […]

  • @ cached_property in Django

    Time:2019-11-20

    Today, a search interface was made before modification. Although haystack is used, it needs to modify the request parameters and response data format, so we spent a lot of time debugging. The problem is that if you have a good idea, you can leave a message: The default request interface of haystack is … / […]

  • Django building personal blog: using Django allauth to realize third-party login

    Time:2019-11-19

    Now we have a userLocal loginThe blog system of. If someone appreciates your article, they may sign up as a local user and have a good exchange with you. But the headache is that users may browse a lot of great blogs on the Internet every day. If every blog has to register to comment, […]

  • Talk about print’s past life and present life

    Time:2019-11-18

    This article is original and first appeared in the public number.Python cat】, do not reprint without authorization. Original address: https://mp.weixin.qq.com/s/nu (1) Last week, I translated an article explaining why Python 3 changed print to a function There are several reasons: 1. Print is not suitable as an application level statement. 2. It can realize more […]

  • Model to Dict Of Django

    Time:2019-11-17

    def model_to_dict(instance, fields=None, exclude=None): “”” Returns a dict containing the data in “instance“ suitable for passing as a Form’s “initial“ keyword argument. “fields“ is an optional list of field names. If provided, only the named fields will be included in the returned dict. “exclude“ is an optional list of field names. If provided, the named […]

  • Django modify database table name

    Time:2019-11-15

    premise The table name of the database is automatically generated according to the appName + table name. However, due to the needs of the interface, the table name cannot be constructed in this way. It can only be the table name itself, and it cannot be prefixed. The following records the modification process and commands. […]

  • Programming language question: when to borrow, when to create?

    Time:2019-11-14

    This article is original and first appeared in the public number.Python cat】, do not reprint without authorization. Original address: https://mp.weixin.qq.com/s/oy On June 22, Guido, the father of python, tweeted a historical story about python, saying that elif was stolen from C language: Elif is the abbreviation of “else if”, which is used for conditional judgment. […]

  • Lessons learned from Django deployment

    Time:2019-11-13

    Modify the source of Pip The configuration file of PIP is in ~ /. PIP / pip.conf The contents of the document are as follows: [global] index-url = http://mirrors.tencentyun.com/pypi/simple trusted-host = mirrors.tencentyun.com Doubanyuan’s website is: http://pypi.doubanio.com/simple/ Just need to index-url = http://mirrors.tencentyun.com… trusted-host = mirrors.tencentyun.com Replaced by: Index-url =http://pypi.doubanio.com/simple/ trusted-host = pypi.doubanio.com Yes. Kill process […]

  • My understanding of the use of froms in Django

    Time:2019-11-12

    This article talks about my simple understanding of forms in Django, which is exactly like an explanation of code. I think the forms in Django is the code that view uses and renders into HTML language. To help us reduce the amount of HTML writing. The following code is the forms of the comments function […]

  • The use of queryset in Django (1)

    Time:2019-11-11

    Use of queryset Queryset is lazy to load, and part of it supports chain call. Interfaces that support chained calls: All interface: used to query all data Filter interface: filter according to conditions Exclude interface: the same logic as filter Reverse interface: reverse the results in queryset Distinct interface: used for de duplication query None […]

  • Bmplatform: a scheme to deploy nginx, tornado, Django, PHP and MySQL on MAC

    Time:2019-11-11

    Project address: https://github.com/yuyangit/bmproject The deployed schemes are all in the script, as follows: How to use bmplatform Version v0.2 1. Brief introduction Bmplatform is a service based on Python tornado framework, python Django framework and a PHP deployed in nginx forwarding operating system. The principle is to open four ports of tornado service, one port […]

  • Summary of Python — time datetime

    Time:2019-11-11

    [TOC] Summary of Python — time datetime time basic import time time.time() Out [3]: 1561107970.0175698 time stamp time.localtime() Out [4]: time. Struct time (TM year = 2019, TM mon = 6, TM mday = 21, TM hour = 17, TM min = 6, TM sec = 20, TM WDAY = 4, TM yday = 172, […]