fields.py 文件源码

python
阅读 23 收藏 0 点赞 0 评论 0

项目:django-swapfield 作者: SRJ9 项目源码 文件源码
def contribute_to_class(self, cls, name, *args, **kwargs):
        super(SwapIntegerField, self).contribute_to_class(cls, name)
        for constraint in cls._meta.unique_together:
            if self.name in constraint:
                raise TypeError("%s can't be part of a unique constraint." % self.__class__.__name__)
        pre_save.connect(self.get_swap_objects, sender=cls)
        post_save.connect(self.save_swap_objects, sender=cls)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号