Django 创建数据表不加APP前缀

[root@site main]# vi models.py
from django.db import models

# Create your models here.
class admin(models.Model):
    username = models.CharField(max_length=11)
    password = models.CharField(max_length=11)
    class Meta:
        db_table = 'admin'

以class Meta声明即可。

2018-02-28 15:41:55

点赞