# Company with many different names

**URL:** <https://forum.djangoproject.com/t/company-with-many-different-names/41064>\
**Category:** Using the ORM\
**Created:** [May 23, 2025, 2:44pm UTC](https://forum.djangoproject.com/t/company-with-many-different-names/41064 "2025-05-23T14:44:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Lexe-Pl](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/lexe-pl/32/17723_2.png) [@Lexe-Pl](https://forum.djangoproject.com/u/Lexe-Pl)\
**Post date:** [May 23, 2025, 2:44pm UTC](https://forum.djangoproject.com/t/company-with-many-different-names/41064/1 "2025-05-23T14:44:29Z")

</div>

I have the following situation that looks simple, but I do not know how to make models for it ☹

Here is what I have.

Model **Company** that contains only description (field **note** )

```auto
class Company(models.Model):
    note = models.TextField(_('note'), blank=True, null=True)

    class Meta:
        verbose_name = _('Company')

    def __str__ (self):
        return f'{self.id}'

```

Each company can have many different names (Official Name, Short Name, Long Name, etc.) I have model **CompanyName** for it.

```auto
class CompanyName(models.Model):
    company = models.ForeignKey(Company, related_name='name_set')
    type = models.CharField(_('type'), max_length=4, choices=NameType.choices)
    name = models.CharField(_('name'), max_length=256)

    class Meta:
        verbose_name = _('Company name')

    def __str__ (self):
        return f'{self.type} {self.name}'

```

The issue I have:  
How inside **Company** model get ‘Official Name’ from **CompanyName** Model. I would like to use the official name instead of `f'{self.id}'` inside ` __str__ ` function.

Thank you so much for your help and time,
