Search code examples
djangodjango-modelsdjango-contenttypes

Is ContenType name field always a 1:1 match with Model._meta.verbose_name?


Is ContenType name field always a 1:1 match with Model._meta.verbose_name ?

I know the possibility of using ContentType.objects.get_for_model(instance_of_some_class) for getting instance of ContenType, but I have to do it for whole model, so I would like to have some reliable way of doing it.


Solution

  • get_for_model can take an instance or a class, so you can also do the following:

    ContentType.objects.get_for_model(Blog)