# AttributeError: 'ManyToManyField' object has no attribute '\_m2m\_reverse\_name\_cache'. Did you mean: 'm2m\_reverse\_name'?

**URL:** <https://forum.djangoproject.com/t/attributeerror-manytomanyfield-object-has-no-attribute-m2m-reverse-name-cache-did-you-mean-m2m-reverse-name/46045>\
**Category:** Using the ORM\
**Created:** [September 18, 2026, 2:58am UTC](https://forum.djangoproject.com/t/attributeerror-manytomanyfield-object-has-no-attribute-m2m-reverse-name-cache-did-you-mean-m2m-reverse-name/46045 "2026-09-18T02:58:48Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![HimejoshiHeart](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/himejoshiheart/32/33329_2.png) [@HimejoshiHeart](https://forum.djangoproject.com/u/HimejoshiHeart)\
**Post date:** [September 18, 2026, 2:58am UTC](https://forum.djangoproject.com/t/attributeerror-manytomanyfield-object-has-no-attribute-m2m-reverse-name-cache-did-you-mean-m2m-reverse-name/46045/1 "2026-09-18T02:58:48Z")

</div>

```python
                                       currentmon.altforms.add(MonSpecies.objects.get(name=da,basepack=newpack))

```

^ running throws up a

`AttributeError: 'ManyToManyField' object has no attribute '_m2m_reverse_name_cache'. Did you mean: 'm2m_reverse_name'?`

(currentmon is a MonSpecies object, da is a string, newpack is an object)

models.py:

```python
class MonSpecies(models.Model):
[...]
    altforms = models.ManyToManyField("self",through="MonFormData")
[...]
class MonFormData(models.Model):
    MonForm = models.ForeignKey("MonSpecies", on_delete=models.CASCADE)
    FormChangeItem = models.ForeignKey("OtherMonItemTags", on_delete=models.CASCADE)
[...]
class OtherMonItemTags(models.Model):
    name = models.CharField(max_length=50)

```

help

---

<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, 2026, 4:02am UTC](https://forum.djangoproject.com/t/attributeerror-manytomanyfield-object-has-no-attribute-m2m-reverse-name-cache-did-you-mean-m2m-reverse-name/46045/2 "2026-09-18T04:02:47Z")

</div>

Welcome @HimejoshiHeart !

Please post the complete view containing this code along with the full error message and traceback. It may also be helpful to see the complete models - at least to see all the fields being referenced.

---

<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, 2026, 5:54pm UTC](https://forum.djangoproject.com/t/attributeerror-manytomanyfield-object-has-no-attribute-m2m-reverse-name-cache-did-you-mean-m2m-reverse-name/46045/3 "2026-09-18T17:54:18Z")

</div>

A follow-up: One of the reasons I’m asking for the full models is that what you are showing is an invalid definition of your `through` model.

A `through` model of a `ManyToManyField` where the relationship is defined by `"self"` consists of two `ForeignKey` fields - both referring to the same model. (See the second green “Note” box at [Model field reference | Django documentation | Django](https://docs.djangoproject.com/en/6.1/ref/models/fields/#django.db.models.ManyToManyField.through))

The portion of the definition you are showing here shows two `ForeignKey` fields referencing two different models, which is inconsistent with the `"self"` definition.

---

<div class="post-metadata">

**Author:** ![abhijeetmote](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.djangoproject.com/abhijeetmote/32/33345_2.png) [@abhijeetmote](https://forum.djangoproject.com/u/abhijeetmote)\
**Post date:** [September 20, 2026, 12:46am UTC](https://forum.djangoproject.com/t/attributeerror-manytomanyfield-object-has-no-attribute-m2m-reverse-name-cache-did-you-mean-m2m-reverse-name/46045/4 "2026-09-20T00:46:17Z")

</div>

The issue is with the definition of the intermediary model.

Because `altforms` is a self-referencing relationship:

```auto
altforms = models.ManyToManyField("self", through="MonFormData")

```

Django expects `MonFormData` to contain two foreign keys to `MonSpecies`: one for the source species and one for the alternate species.

`FormChangeItem` can remain as an additional field on the relationship:

```auto
class MonSpecies(models.Model):
    altforms = models.ManyToManyField(
        "self",
        through="MonFormData",
        through_fields=("base_species", "alt_species"),
        symmetrical=False,
        related_name="base_forms",
    )

class MonFormData(models.Model):
    base_species = models.ForeignKey(
        MonSpecies,
        on_delete=models.CASCADE,
        related_name="form_data_as_base",
    )
    alt_species = models.ForeignKey(
        MonSpecies,
        on_delete=models.CASCADE,
        related_name="form_data_as_alt",
    )
    form_change_item = models.ForeignKey(
        "OtherMonItemTags",
        on_delete=models.CASCADE,
    )

class OtherMonItemTags(models.Model):
    name = models.CharField(max_length=50)

```

The `through_fields` argument explicitly tells Django which foreign key is the source and which is the target. Without it, Django uses the first foreign key to `MonSpecies` as the source and the second as the target.

Then the relationship can be created like this:

```auto
target = MonSpecies.objects.get(
    name=da,
    basepack=newpack,
)

currentmon.altforms.add(
    target,
    through_defaults={
        "form_change_item": change_item,
    },
)

```

Or directly through the intermediary model:

```auto
MonFormData.objects.create(
    base_species=currentmon,
    alt_species=target,
    form_change_item=change_item,
)

```

`change_item` must be an instance of `OtherMonItemTags`.

If `FormChangeItem` is not actually needed as extra data, remove the `through` model and use a normal self-referencing many-to-many field:

```auto
altforms = models.ManyToManyField("self", symmetrical=False)

```

Then `currentmon.altforms.add(target)` will work directly.
