Python django模型不返回主键,为什么主键是none

Python django模型不返回主键,为什么主键是none,python,django,django-models,django-orm,Python,Django,Django Models,Django Orm,我的代码: broadcast_obj = TblBroadcast.objects.using('broadcast_db').create( name=request.POST.get('name'), summary=request.POST.get('summary', ''), cover=req

我的代码:

broadcast_obj = TblBroadcast.objects.using('broadcast_db').create(
                                name=request.POST.get('name'),
                                summary=request.POST.get('summary', ''),
                                cover=request.POST.get('cover'),
                                status=int(request.POST.get('status')),
                                quality=int(request.POST.get('quality'))
                                )
print "========="
print broadcast_obj.name
print broadcast_obj.summary
print broadcast_obj.cover
print broadcast_obj.status
print broadcast_obj.pk
print broadcast_obj.quality
print "========="
输出:

=========
t
t
t
0
None
6
=========
为什么主键是none?当我检查数据库时,django已经创建了该项。
broadcast\u id
pk
,它是
auto\u increment

您的型号是否有主键

class TblBroadcast(models.Model)
    broadcast_id = models.AutoField(primary_key=True)
请参阅下文
您的型号是否有主键

class TblBroadcast(models.Model)
    broadcast_id = models.AutoField(primary_key=True)
请参阅下文
您的型号是否有主键

class TblBroadcast(models.Model)
    broadcast_id = models.AutoField(primary_key=True)
请参阅下文
您的型号是否有主键

class TblBroadcast(models.Model)
    broadcast_id = models.AutoField(primary_key=True)
请参阅下文

您是否在模型中定义了主键字段?使用TblBroadcast模型定义更新您的问题。您是否在模型中定义了主键字段?使用TblBroadcast模型定义更新您的问题。您是否在模型中定义了主键字段?使用TblBroadcast模型定义更新您的问题。您是否在模型中定义了主键字段?使用TblBroadcast模型定义更新您的问题。