title: How to obtain content_type from a Django Model Class?
body: <p>I am trying to obtain the ContentType for a django models.Model.  Not trying to get the model from a ContentType, which is all I can find in the docs.  For example:</p>
  <pre><code>model_name = 'FooBar'
  MyModel = apps.get_model('app_xyz', model_name)
  MyModel
  &lt;class 'apps.app_xyz.models.FooBar'&gt;
  </code></pre>
  <p>How do I get the ContentType of MyModel?  The only thing I can figure out to do is set the model_name string to lower and directly query ContentTypes:</p>
  <pre><code>ct = ContentType.objects.get(model=model_name.lower())
  </code></pre>
  <p>That seems really fragile, and using lower() has a code smell I don't like.  I've looked through FooBar's methods, _methods, and __methods to no avail. Thanks!</p>