Ticket #7908: note1.py

File note1.py, 402 bytes (added by rock@…, 7 years ago)
Line 
1            # the following can replace line 605 of related.py
2            # but this is not a proper fix...
3            to_field = to_field
4            if to_field == None:
5                if to._meta.pk is None:
6                    raise ValueError("The %s model does not have a primary key and therefore a ForeignKey cannot relate to it." % to_name)
7                to_field = to._meta.pk.name
Back to Top