1
Instead of trying to get the type and then displaying the class name in the template why don’t you just add a static attribute to the classes?
class Pc(models.Model):
product_display_name = 'PC'
class Monitor(models.Model):
product_display_name = 'Monitor'
Then in the template
{% for p in pr %}
<td>
{{ p.product_display_name }}
</td>
<td>
{{ p.number }}
</td>
{% endfor %}
If you would really like to get the name from the type then you can use the following
type(instance).__name__
Source:stackexchange.com