Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #1179

Merged
merged 1 commit into from
Dec 9, 2024
Merged

fix #1179

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions docs/MatrixOne/Tutorial/django-python-crud-demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,11 @@ pip3 install pymysql -i https://pypi.tuna.tsinghua.edu.cn/simple
```python
from django.db import models
class Book(models.Model):
id = models.AutoField(primary_key=True) # id 会自动创建,可以手动写入
title = models.CharField(max_length=32) # 书籍名称
price = models.DecimalField(max_digits=5, decimal_places=2) # 书籍价格
publish = models.CharField(max_length=32) # 出版社名称
pub_date = models.DateField() # 出版时间
id = models.AutoField(primary_key=True) # id 会自动创建,可以手动写入
title = models.CharField(max_length=32) # 书籍名称
price = models.DecimalField(max_digits=5, decimal_places=2) # 书籍价格
publish = models.CharField(max_length=32) # 出版社名称
pub_date = models.DateField() # 出版时间
```

Django 模型使用自带的 ORM。以上的类名代表了数据库表名(*testmodel_book*),且继承了 models.Model,类里面的字段代表数据表中的字段,数据类型:AutoField(相当于 int)、CharField(相当于 varchar)、DecimalField (相当于 decimal)、DateField(相当于 date),max_length 参数限定长度。
Expand Down
Loading