Django e-commerce function
1, Order
Order logic
Login users can browse products
The product details page purchases immediately and generates an order. The order status is unpaid
Add goods to the shopping cart, view the shopping cart, select the specified goods, purchase immediately and generate an order. The order status is unpaid
Settle the ...
Posted by akkad on Sat, 21 May 2022 18:27:21 +0300
1. Commodity details
Interface address: http://127.0.0.1:8000/goods/1/
Compared with the previous product list, there is only one more ID of a single product, so you only need to add a RetrieveModelMixin to the GoodsListViewSet to obtain the product details:
class GoodsListViewSet(mixins.ListModelMixin, mixins.RetrieveModelMixin, viewsets.Gener ...
Posted by kaspari22 on Wed, 18 May 2022 07:46:59 +0300
Some recent tossing insights.
Personal blog things
In fact, I started the construction of personal blog website from a very early time, which initially benefited from GitHub Opening of IO domain names. In general, the history of building my blog is mainly divided into three stages.
Phase I
The first stage belongs to simplicity supremacy. Us ...
Posted by ngu_tri on Mon, 16 May 2022 15:58:17 +0300
Take Flask as an example: Source code analysis (1): WSGI From: https://www.csdn.net/tags/MtTaEgzsNTYyNzcyLWJsb2cO0O0O.html
2022-03-26 18:35:03
To understand the source code of Flask, you must have a certain Python foundation and be familiar with the concepts and usage of decorator s, magic method s, iterator s, and generator s. Another po ...
Posted by reaper7861 on Mon, 16 May 2022 13:42:56 +0300
django basic case and explanation
django basic content
1. Django's command to create a project: Django admin startproject project project name python manage.py startapp app name After 2Django creates the project, what are the components under the project folder (understanding of mvt)? manage.py is the entry of project operation, specifying th ...
Posted by zytex on Sun, 15 May 2022 17:31:10 +0300
Field options
Each field accepts a set of field-related parameters (documented at Model Field Reference middle). E.g, CharField (and its derived classes) require max_length parameter to specify the size of the VARCHAR database field.
Common parameters for all fields
null If True, Django will store empty values as NULL in the database ...
Posted by Installer on Tue, 10 May 2022 23:08:10 +0300
View of DRF
APIView
When we write CBV in django, we inherit View and rest_ The framework inherits APIView, so what's the difference between them~~~
urlpatterns = [
url(r'^book$', BookView.as_view()),
url(r'^book/(?P<id>\d+)$', BookEditView.as_view()),
]
We can see that both view and APIView call as at the beginning ...
Posted by matfish on Tue, 10 May 2022 01:53:42 +0300
The main role of the views provided by Django REST framwork:
1. Control the execution of the serializer (check, save, transform data)
2. Control the execution of database queries
One, two view base classes
Conclusion first:
APIView: if followed by models No relationship (no database related operations), just inherit it
GenericAPIView: For datab ...
Posted by rpanning on Thu, 05 May 2022 04:41:18 +0300
preface
For example, open the time classification tab of the blog Garden
https://www.cnblogs.com/canglongdao/archive/2020/07.html , the time parameters are dynamic. If I want to obtain the time parameters 2020 and 07, it involves the acquisition of url parameters.
Get url parameters
First use path to match a url address, similar to: Archive / 2 ...
Posted by Andy-H on Tue, 03 May 2022 22:19:00 +0300