How to get appname from model in django
<p>I have this code</p>

<pre><code>class Option(models.Model):
  option_text  = models.CharField(max_length=400)
  option_num   = models.IntegerField()
  # add field to hold image or a image url in future

  class Meta:
        app_label = 'myapp'
</code></pre>

<p>if i have <code>Options</code> model in my view i want to get the <code>appname</code> from it</p>

<pre><code>from django.contrib.contenttypes.models import ContentType

ct = ContentType.objects.get_for_model(option_instance)
print(ct.app_label)
</code></pre>

<p>or</p>

<pre><code>option_instance._meta.app_label
</code></pre>

python django