Django 反向生成 从数据库生成Model
使用Django生成Model
python manage.py inspectdb
或
python manage.py inspectdb > models.py
就可以生成了
自动产生Django model
class DjangoModel(models.Model): id = models.IntegerField(primary_key=True) action_time = models.DateTimeField() user_id = models.IntegerField() content_type_id = models.IntegerField(null=True, blank=True) object_id = models.TextField(blank=True) object_repr = models.CharField(maxlength=200) action_flag = models.TextField() # This field type is a guess. change_message = models.TextField() class Meta: db_table = 'django_admin_log'
暂无评论