Explanation of contribute_to_class

前端 未结 1 1818

I\'m attempted to extend code, and have come across an issue, I don\'t understand a line of code. I know the outcome of it - but I don\'t understand how it happens and am na

1条回答
  •  执笔经年
    2020-12-13 14:02

    Basically, for objects that have a contribute_to_class method, when adding them to a Model class, we call contribute_to_class instead of setattr: this allows objects to do additional book-keeping and/or modification of the class as they are added. Alex Gaynor has a good explanation here: http://lazypython.blogspot.com/2008/11/django-models-digging-little-deeper.html

    0 讨论(0)
提交回复
热议问题