Django-4. Model foundation section I

1, Database configuration 1.ORM concept Definition: Object Relational Mapping (ORM) Advantages: you don't need to write SQL code directly, just operate data from the database like an operation object. 2. Model mapping relationship All model classes must be written in models under app Py fileIf the model needs to be mapped to the da ...

Posted by yashvant on Mon, 20 Dec 2021 10:43:53 +0100

Django REST Framework——5. View and routing

A key benefit of class based views is that they allow you to combine some reusable behaviors. DRF takes advantage of this by providing a large number of pre built views, which provides us with some common patterns. What we need to do is to select the appropriate view class for inheritance. 1, APIView class The APIView class provided by DR ...

Posted by mmonaco on Sun, 19 Dec 2021 02:59:35 +0100

Python crawler's scripy framework Spider class

Spider What is it? Spider Is a basic class provided by scripy, and other basic classes contained in scripy (such as CrawlSpider )And custom spider s must inherit this class. Spider Is a class that defines how to crawl a website, including how to crawl and how to extract structured data from its web pages. The source code is as follows: The ...

Posted by rnewman on Thu, 16 Dec 2021 15:49:02 +0100

Write Django project - incomplete

Demand analysis 1.3 The attachment seems unable to generate a template, because the uid of each target should be added to the attachment to identify the recruiter. The idea of the first two versions is to generate an attachment template, and then import the attachment when creating the template, so that the attachment can be directly sent ...

Posted by kurtis on Wed, 15 Dec 2021 13:28:55 +0100

Knowledge summary of open source web framework django

Knowledge summary of open source web framework django (12) User center interface (I) Define model class base class In order to supplement the two fields of creation time and update time for the model class data in the project, we need to define the model class base class. New aerf_mall.utils/BaseModel.py file to create a model class base ...

Posted by Kilgore Trout on Tue, 14 Dec 2021 02:42:17 +0100

Some records on Python docx operating excel

backgroundRecently, I was working on improving the performance of the client performance test. I would compare the performance data of the current version with the performance data of the previous version, and then put the comparison conclusion and data on the docx document to automatically generate a performance report. I learned the relevant ...

Posted by Neotropic on Sat, 11 Dec 2021 04:49:00 +0100

django development common problems and solutions record (continuously updated)

1, If the a tag's href or form submission will trigger page refresh, the back-end function can directly redirect the user. However, if it is an asynchronous request $. get(), it cannot** The first case is href+HttpResponseRedirect Welcome: <span>{{ username }}</span>&nbsp;<a href="/logout/" style="color: #b097b5; Text ...

Posted by nvee on Wed, 01 Dec 2021 03:42:37 +0100

django development common problems and solutions record (continuously updated)

1, If the a tag's href or form submission will trigger page refresh, the back-end function can directly redirect the user. However, if it is an asynchronous request $. get(), it cannot** The first case is href+HttpResponseRedirect Welcome: <span>{{ username }}</span>&nbsp;<a href="/logout/" style="color: #b097b5; Text decor ...

Posted by vaska on Tue, 30 Nov 2021 18:17:31 +0100

Cookie s and sessions in Django framework

preface Over the past few years, I have been struggling in the it industry. Along the way, many have summarized some high-frequency interviews in the python industry. I see most of the new blood in the industry, and I still have all kinds of difficult questions for the answers to all kinds of interview questions or collection Therefore, I dev ...

Posted by SOL-ion on Thu, 18 Nov 2021 11:46:32 +0100

Django project exercise - user table development & video table structure development

User related development, client table structure development 1, User table development Create a new model package in the app to store database related files, and then create an auth py file in it. Under the auth file in the model, we create a clientUser, user table: # coding:utf-8 import hashlib # Used to encrypt passwords from django.db ...

Posted by skbanta on Wed, 17 Nov 2021 08:08:16 +0100