This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BigForeignKey(models.ForeignKey): | |
def db_type(self, connection): | |
""" Adds support for foreign keys to big integers as primary keys. | |
""" | |
rel_field = self.rel.get_related_field() | |
if (isinstance(rel_field, BigAutoField) or | |
(not connection.features.related_fields_match_type and | |
isinstance(rel_field, (BigIntegerField, )))): |