get class name for empty queryset in django

I have empty queryset of model Student

students = Students.objects.all()

If the above queryset is empty, then how can i get the model(class name)?

How can i get the model name for empty queryset?


How can i get the app name from the queryset?


>>> students = Students.objects.all()

# The queryset's model class:
>>> students.model

# Name of the model class:
>>> students.model.__name__

# Import path of the models module:
>>> students.model.__module__

# Django app name:
>>> students.model._meta.app_label


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

You can do:

>>> `Students`

Need Your Help

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.