推荐学习书目
› Learn Python the Hard Way
Python Sites
› PyPI - Python Package Index
› http://diveintopython.org/toc/index.html
› Pocoo
值得关注的项目
› PyPy
› Celery
› Jinja2
› Read the Docs
› gevent
› pyenv
› virtualenv
› Stackless Python
› Beautiful Soup
› 结巴中文分词
› Green Unicorn
› Sentry
› Shovel
› Pyflakes
› pytest
Python 编程
› pep8 Checker
Styles
› PEP 8
› Google Python Style Guide
› Code Style from The Hitchhiker's Guide
xyok
V2EX  ›  Python

django model 扩展

  •  
  •   xyok · Mar 9, 2017 via iPhone · 1621 views
    This topic created in 3492 days ago, the information mentioned may be changed or developed.
    写了个 function ,如何让该方法成为所有 model 的成员函数,而不是每个 model 都写一遍
    2 replies  •  2017-03-09 22:56:37 +08:00
    jmc891205
        1
    jmc891205  
       Mar 9, 2017 via iPhone
    继承呀
    xujinkai
        2
    xujinkai  
       Mar 9, 2017 via Android
    把这个 function 放进一个 class 里 然后所有 model 都继承一下
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   966 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 18:31 · PVG 02:31 · LAX 11:31 · JFK 14:31
    ♥ Do have faith in what you're doing.