get class name for empty queryset in django

前端 未结 4 396
梦如初夏
梦如初夏 2021-01-03 18:09

I have empty queryset of model Student

students = Students.objects.all()

If the above queryset is empty, then how can i get the mo

4条回答
  •  半阙折子戏
    2021-01-03 18:32

    students.model
    

    Querysets have a model attribute that can be used to retrieve the model they are associated with.

提交回复
热议问题