Opened 8 years ago

Last modified 8 years ago

#27259 closed Bug

ManyToOneRel.name uses relatemodelname instead of relatedmodelname_set — at Initial Version

Reported by: Maxim Syabro Owned by: nobody
Component: Database layer (models, ORM) Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

F.e.

class MainModel(models.Model):
    pass

class RelatedModel(models.Model):
    main = models.ForeignKey(MainModel)

ManyToOneRel.name should be relatedmodel_set, not relatedmodel

>>> from testmodels.models import MainModel
>>> fieldname = MainModel._meta.get_fields()[0].name
>>> print getattr(MainModel, fieldname, None)
None
>>> print getattr(MainModel, fieldname + '_set', None)
<django.db.models.fields.related_descriptors.ReverseManyToOneDescriptor object at 0x103dc1510>}}}

Change History (0)

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