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>

<p>If you have an instance of your object, you can quite easily get the app_label from _meta</p>

<pre><code>o = Option.objects.all()[0]
print o._meta.app_label
</code></pre>

<p>There is a host of other usefull information in there. In the shell type help(a._meta) to see them all</p>

python django