Sugree

Main menu

  • About
    • Self
  • Project
    • GT200
    • GeoPin
    • Mitter
    • Red Mob
    • Thairath Breaking News
    • jibjib
    • microblog-purple
    • English
    • Thai

MVC in Django

Submitted by sugree on Fri, 09/12/2008 - 09:21
  • Django
  • Python
  • Thai

@chanwit ถามไว้เรื่อง MVC อ่านแล้วชะงัก ความเชื่อเริ่มง่อนแง่น เรื่องพวกนี้ผมไม่แม่น แบบว่าไม่เคยสนใจ MVC รู้แค่ว่า model view control แล้วไอ้ views.py ใน Django มันก็ไม่ได้ใกล้เคียงกับ view ที่ควรจะเป็นซักนิด ต้องลำบากนั่งสมาธิ สงบจิตใจ แล้วก็ Satori!

ผมอยู่กับสภาพแวดล้อมแบบ MVC ที่ไม่ใช่ MVC มามากเกินไป และด้วยสาเหตุใดไม่รู้ Django ก็เป็นแบบเดียวกัน มันไม่เรียก MVC ซะอย่างงั้น กลายเป็นแบบนี้แทน

  • Model -> Model
  • View -> Template
  • Control -> View

ซึ่งผมเข้าใจทันที เพราะ View จะถูกจับคู่กับ URL แบบอิสระ ไม่จำเป็นต้องทำคลาสที่เป็น Control แบบเห็นจะๆ

ยังไม่แน่ใจว่าแบบไหนดีกว่ากันในระยะยาว ดูเหมือน Django จะไม่เหมือนชาวบ้าน ดูไม่เป็นระบบ แต่มันง่ายดีนะ

Roti (alpha) thinks you may like these:
  • MVC in Django
  • Simple template in Django
  • Django - Hello, World!
  • Django 66 - Django Thailand
  • Loop in template
by chanwit (not verified) on Fri, 09/12/2008 - 14:03 #502

สัญชาตญาณผมก็ยังพอใช้ได้ เพราะกลายเป็นว่า views.py เอาไว้เก็บ controller

แล้วก็ถ้า template เป็น view จริง ๆ ตัว view ที่ได้น่าจะ clean มาก ๆ เลยนะนี่

  • reply
by เนาวัล (not verified) on Thu, 03/05/2009 - 12:15 #861

พอจะมี e-book หรือข้อมูลแบบเต็มๆ ของdjango บ้างไหมคะ พอดีกำลังจะทำโครงงาน ที่ใช้ django อยู่พอดี แต่หาข้อมูลได้น้อย ถ้ามีช่วยส่งมาทางอีเมล์นะคะ จะขอบคุณมากๆ เลยค่ะ

  • reply
by sugree on Thu, 03/05/2009 - 16:51 #862

http://www.djangobook.com/

  • reply
by Anonymous (not verified) on Sat, 10/24/2009 - 02:58 #1200

bedava mp3 indir mp3 indir film indir

  • reply

Post new comment

The content of this field is kept private and will not be shown publicly.
Input format
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <blockcode> <pre>
  • Lines and paragraphs break automatically.
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <html>. Beside the tag style "<foo>" it is also possible to use "[foo]".
  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <html>. Beside the tag style "<foo>" it is also possible to use "[foo]".
  • You can use Markdown syntax to format and style the text. Also see and Markdown Extra for tables, footnotes, and more.
  • Twitter-style @usersnames are linked to their Twitter account pages.
  • Twitter-style #hashtags are linked to search.twitter.com.

More information about formatting options

Popular Tags

Android BarCamp BarCampBangkok BarCampBangkok2 Book Django Drupal Education Family Google Hardware Hardy Health Interview Java jibjib Joke Life microblog-purple OpenOffice.org OpenSource Podcast Python Review SoC Social Network Trip Twitter Ubuntu Weekly Suki
more tags

Powered By

debian
apache
drupal
drupal.in.th
openfreehost
inox
feedburner

© 2007-2008 Sugree Phatanapherom. Creative Commons [Feed Content / Comment]
RoopleTheme