王海庆的云笔记

Django多数据库配置及逆向生成model教程


命令

python manage.py inspectdb --database=license > 111.py


from django.db import models


class Current(models.Model):
    intime = models.CharField(max_length=30)
    vendor = models.CharField(max_length=30)
    feature = models.CharField(max_length=100)
    user = models.CharField(max_length=50)
    host = models.CharField(max_length=50)

    class Meta:
        managed = False
        db_table = 'current'


class Statistics(models.Model):
    intime = models.CharField(max_length=30)
    outtime = models.CharField(max_length=30)
    duration = models.CharField(max_length=100)
    vendor = models.CharField(max_length=25)
    feature = models.CharField(max_length=100)
    user = models.CharField(max_length=50)
    host = models.CharField(max_length=50)

    class Meta:
        managed = False
        db_table = 'statistics'


文章最后更新时间: 2021-12-16 14:20:28