AttributeError on Django
<p>I'm stuck with (I think) a dummy error on Django that I can't find where it's the fault.</p>

<p>On "catalog/models.py" I have (it connects to a MySQL database):</p>

<pre><code>from django.db import models

class Application(models.Model):
    nameApp = models.CharField(max_length=50)
    tarification = models.ForeignKey(Tarification)
</code></pre>

<p>Then, I'm using <em>django-tables2</em> (<a href="https://django-tables2.readthedocs.io/en/latest/pages/table-data.html" rel="nofollow">Doc to fill tables</a>) to make tables on Django, so on my <em>tables.py</em> I have:</p>

<pre><code>import django_tables2 as tables
from catalog.models import AppCost, Application, Tarification


class BillTable(tables.Table):
    class Meta:
        appName = Application.nameApp
        userApp = AppCost.userApp
        tarifName = Tarification.nameTarif
        tarifCost = Tarification.cost
        startTime = AppCost.startTime
        finishTime = AppCost.finishTime
        totalCost = AppCost.totalCost
        # add class="paleblue" to &lt;table&gt; tag
        attrs = {'class': 'paleblue'}
</code></pre>

<p>And I get an error when I render my website:</p>

<pre><code>type object 'Application' has no attribute 'nameApp'
</code></pre>

<p>On the line <code>appName = Application.nameApp</code> from <em>BillTable</em></p>

<p>But, looking at "Database" window on <em>Pycharm</em> I see the table schema and it's:</p>

<ul>
<li>catalog_application

<ul>
<li>id</li>
<li>tarification_id</li>
<li>nameApp</li>
<li>other stuff</li>
</ul></li>
</ul>

<p>And looking with MySQL Workbench the schema looks the same. So, why I'm getting this error?</p>

<p>Regards.</p>

<p>You're very confused about how to use django-tables. You need to specify one model in the Meta class, then just the <code>fields</code> attribute to add a list of fields from that model, as strings, to display. You can't just specify fields from three arbitrary models.</p>

python mysql django