# How represent \_ \_str\_ \_() from models at HTML?

**URL:** <https://forum.djangoproject.com/t/how-represent-str-from-models-at-html/9744>\
**Category:** Using Django\
**Created:** [September 18, 2021, 11:06am UTC](https://forum.djangoproject.com/t/how-represent-str-from-models-at-html/9744 "2021-09-18T11:06:26Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![woojci](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/woojci/32/6649_2.png) [@woojci](https://forum.djangoproject.com/u/woojci)\
**Post date:** [September 18, 2021, 11:06am UTC](https://forum.djangoproject.com/t/how-represent-str-from-models-at-html/9744/1 "2021-09-18T11:06:26Z")

</div>

Hello everyone!  
Today I have a problem with \_ _str_ \_() from models at HTML. Below I attached screen which I think tell much more than any sentence:

 ![_ str _ () represention in HTML](https://us1.discourse-cdn.com/flex026/uploads/djangoproject/original/2X/8/8a6be1101eef0e0228f7e3fa04083d7745dbb7b0.png)

Should I leave my solution with PisitiveSmallInteger and use CharField like below?

```auto
from django.db import models

class Student(models.Model):
    FRESHMAN = 'FR'
    SOPHOMORE = 'SO'
    JUNIOR = 'JR'
    SENIOR = 'SR'
    GRADUATE = 'GR'
    YEAR_IN_SCHOOL_CHOICES = [
        (FRESHMAN, 'Freshman'),
        (SOPHOMORE, 'Sophomore'),
        (JUNIOR, 'Junior'),
        (SENIOR, 'Senior'),
        (GRADUATE, 'Graduate'),
    ]
    year_in_school = models.CharField(
        max_length=2,
        choices=YEAR_IN_SCHOOL_CHOICES,
        default=FRESHMAN,
    )

```

Thank a lot for your help! Please remember that I am a beginner 😃

---

<div class="post-metadata">

**Author:** ![KenWhitesell](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/kenwhitesell/32/280_2.png) [@KenWhitesell](https://forum.djangoproject.com/u/KenWhitesell)\
**Post date:** [September 18, 2021, 12:13pm UTC](https://forum.djangoproject.com/t/how-represent-str-from-models-at-html/9744/2 "2021-09-18T12:13:15Z")

</div>

Please do not post images of code here. The code can’t be quoted in replies to be commented on. (They’re also not readable on every device.)

From what I can see, you’re using the value of a specific field in your template - that’s not going to call the _model’s_ ` __str__ ` function. What you might want to do is create a function for that field to return the string you want printed, and the use that function in the template rather than the field.
