Django study notes

Another week later, it's time to sum up.... After creating a new project and application, I can't understand the function of each file. I created a new project and application folder structure as follows: C:\Users\Administrator\Documents\jiaoben\DJIANGO_TEST\second>django-admin startapp second_app C:\Users\Administrator\Documents\jiaoben\ ...

Added by speedyslow on Fri, 14 Jan 2022 16:18:43 +0200

Django project creation and life process

1, Creation of Django project 1. Project creation and operation Install Django module Open pycharm and install the Django module in the Terminal interactive interface Note: different versions may be slightly different in the use of the framework. Select the version as needed. pip install django==2.0 Import the module in the python co ...

Added by blufish on Tue, 11 Jan 2022 10:38:40 +0200

Django training project - library management system

1, Create a Django project - Library 2, Complete basic configuration 1. Configuration database information In the configuration file settings Configure database information in py (note that the password should be changed to your own database password) 2. Data migration (1) Create database ----- Lirbrary (2) Set up database connect ...

Added by Xyox on Fri, 07 Jan 2022 11:32:22 +0200

Student Management System-Django

Catalog Preface 1. What is Django? 2. Steps for use 1. Create a Django project (1)mkdir Django (2) cd MyDjango\dir   (3) Folder display (4) Enter pyCharm interface (5) Run the project after configuring (6) Click http://127.0.0.1:8000/ Check to see if the project ran successfully 2. Create application models and file migration (1) ...

Added by mnuzum on Thu, 06 Jan 2022 19:33:16 +0200

Django add cross domain header

django add cross domain header 1, Introduction 1. What is cross domain When a browser requests the resources of another domain name from the web page of one domain name, the domain name, port and protocol are all cross domain 2. Browser homology policy The same origin policy limits how documents or scripts loaded from the same source i ...

Added by ranjita on Thu, 06 Jan 2022 02:49:52 +0200

Django defines model classes

Define model classes Model classes are defined in the "application / models.py" file.The Model class must inherit from the Model class, located in the package Django db. In models 1 . definition Create the application booktest in models Py file. from django.db import models #Define book model class BookInfo class BookInfo(models ...

Added by Gho on Tue, 04 Jan 2022 13:41:13 +0200

Django admin realizes the normal display of TextField field, changelist page line feed and spaces

Problem background After binding the model with admin view in Django background, you can easily add, delete, query and modify the underlying data table through the web page. In practice, some data fields will store json or other text contents containing line breaks and spaces. These text contents can normally display line breaks and spaces on t ...

Added by sabien on Mon, 03 Jan 2022 19:47:46 +0200

Django class view and Middleware

Class view 1. Class view import The view defined by function is called function view, which is easy to understand. However, when the path corresponding to a view provides support for many different HTTP request modes, you need to write different business logic in a function, and the code readability and reusability are poor. def register(req ...

Added by yashvant on Mon, 03 Jan 2022 14:01:00 +0200

Saving image data for image management

Save picture data Before saving the data, we need to obtain the id of the sku associated with the picture 1. Get sku table id Interface analysis Request method: GET / meiduo_admin/skus/simple/ # -------Get the id of sku-------- url(r'skus/simple/$', images.ImageView.as_view({'get': 'simple'})), Request parameters: pass jwt token dat ...

Added by SirChick on Mon, 03 Jan 2022 12:59:45 +0200

Django ORM data addition, deletion, modification and query interface

Django's object relational mapper (ORM) provides rich data query interfaces, so that you can add, delete, modify and query the data in the database through simple operation of the model without using native SQL statements. The result of query is called queryset, so this interface is called QuerySet API. Today, we will take the blog as an exampl ...

Added by Pavlos1316 on Mon, 03 Jan 2022 03:57:37 +0200