model IntegerField() to django-template with ordinal
<p>I have a model with IntegerField()</p>

<pre><code>class Room(models.Model):
    type = models.CharField(max_length=50)
    floor = models.IntegerField()
</code></pre>

<p>And i would like it to display in a template with ordinal suffix.</p>

<pre><code>{% for room in rooms %}
    &lt;div&gt;
        &lt;p&gt; {{ room.type }}&lt;/p&gt;
        &lt;p&gt; {{ room.floor }} &lt;/p&gt;
    &lt;/div&gt;
{% endfor %}
</code></pre>

<p>I would like the floor output like this.</p>

<p><code>1st, 2nd, 3rd, 4th... 10th.. 12th.. 13th.. 15th...</code></p>

<p>You can use <a href="https://docs.djangoproject.com/en/1.10/ref/contrib/humanize/#ordinal" rel="nofollow">ordinal</a> function from django.contrib.humanize package</p>

python django