| 1 | | Okay, will do. Thanks |
| | 1 | F.e. |
| | 2 | {{{#!python |
| | 3 | class MainModel(models.Model): |
| | 4 | pass |
| | 5 | |
| | 6 | class RelatedModel(models.Model): |
| | 7 | main = models.ForeignKey(MainModel) |
| | 8 | }}} |
| | 9 | |
| | 10 | {{{ManyToOneRel.name}}} should be {{{relatedmodel_set}}}, not |
| | 11 | {{{relatedmodel}}} |
| | 12 | |
| | 13 | {{{#!python |
| | 14 | >>> from testmodels.models import MainModel |
| | 15 | >>> fieldname = MainModel._meta.get_fields()[0].name |
| | 16 | >>> print getattr(MainModel, fieldname, None) |
| | 17 | None |
| | 18 | >>> print getattr(MainModel, fieldname + '_set', None) |
| | 19 | object at 0x103dc1510>}}} |