Django模型(四)

一、数据操作初始化

Django模型(四)_第1张图片

from django.db import models


# Create your models here.
class Place(models.Model):
  """
   位置信息
   """
  name = models.CharField(max_length=32,verbose_name='地名')
  address = models.CharField(max_length=64,null=True,verbose_name='地址')


  class Meta:
    db_table='t_place'


class Restaurant(models.Model):
  """
   餐厅
   """
  name = models.CharField(max_length=32,verbose_name='餐厅名')
  place = models.OneToOneField(Place,on_delete=models.CASCADE,verbose_name='所在位置',null=True)


  class Meta:
    db_table='t_restaurant'


class Waiter(models.Mod

你可能感兴趣的:(Django,django,数据库,sqlite)