常规的模板渲染
from django.db import models # Create your models here. class ArticalType(models.Model): caption = models.CharField(max_length=16) class Category(models.Model): caption = models.CharField(max_length=16) class Artical(models.Model): title = models.CharField(max_length=32) content = models.CharField(max_length=255) category = models.ForeignKey(Category, on_delete=models.CASCADE) artical_type = models.ForeignKey(ArticalType, on_delete=models.CASCADE)
models.py
本站文章如无特殊说明,均为本站原创,如若转载,请注明出处:django中将views.py中的python方法传递给html模板文件 - Python技术站