Opened 15 years ago

Closed 15 years ago

#1600 closed enhancement (fixed)

Omitting "Field" on ManyToManyField should throw an error

Reported by: pa-ching Owned by: Adrian Holovaty
Component: Metasystem Version: dev
Severity: minor Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no


If I write something like

class Post(models.Model):
    tags = models.ManyToMany(Tag)

instead of models.ManyToManyField, Django doesn't complain at all. However, any attempts to access (for example) tag_instance.post_set report that there is no such field, and there are probably other things that don't work. This is mainly due to my typing errors, but I've been bitten by this misspelling several times. I guess that I personally forget the Field suffix because ForeignKey doesn't have one. It isn't too big of a deal, but it might be nice for newbies like myself, and Django's error reporting has always been very helpful, either way. Thanks!

Change History (2)

comment:1 Changed 15 years ago by pa-ching

Version: magic-removalSVN

comment:2 Changed 15 years ago by Adrian Holovaty

Resolution: fixed
Status: newclosed

(In [2648]) Fixed #1600 -- Renamed ManyToMany to ManyToManyRel so people get a clearer error if they use ManyToMany instead of ManyToManyField

Note: See TracTickets for help on using tickets.
Back to Top