Skip to main content

Django Models & Database (Complete Guide Telugu)

 



Django Models & Database (Complete Guide Telugu)


๐Ÿ“Œ Django Models ante enti?

Django lo Model ante database structure define cheyadaniki use chestam.

๐Ÿ‘‰ Simple ga:
๐Ÿ‘‰ Model = Table structure (database lo)

๐Ÿ‘‰ Example:

  • User data store cheyali
  • Blog posts save cheyali
    ๐Ÿ‘‰ Model use chestam ๐Ÿ”ฅ

๐Ÿ—️ Basic Model Example

๐Ÿ‘‡ Simple Blog model:


๐Ÿ‘‰ Explanation:

  • CharField → short text
  • TextField → long content
  • DateTimeField → date & time store

⚙️ Model create chesaka next step enti?

๐Ÿ‘‰ Database ki apply cheyali
๐Ÿ‘‰ Adi migrations ๐Ÿ”ฅ


๐Ÿ”„ Migrations ante enti?

๐Ÿ‘‰ Model changes ni database lo reflect cheyadam

๐Ÿ‘‰ Commands:

๐Ÿ‘‰ Ivi run chesthe:
๐Ÿ‘‰ Table database lo create avutundi ✔️


๐Ÿงฉ Admin lo register cheyadam

๐Ÿ‘‰ Admin panel lo data manage cheyali ante:


๐Ÿ‘‰ Ippudu:
๐Ÿ‘‰ /admin lo Blog data add cheyyochu ๐Ÿ”ฅ


๐Ÿ“ Data save cheyadam (Create)




๐Ÿ“– Data retrieve cheyadam (Read)


✏️ Data update cheyadam


❌ Data delete cheyadam



๐Ÿ”— Models → Views → Templates connection

๐Ÿ‘‰ Flow ila untundi:



๐Ÿ‘‰ Example:

  • Model lo data store
  • View lo fetch
  • Template lo display

๐Ÿ‘‰ Idi full Django power ๐Ÿ”ฅ


⚠️ Common mistakes

makemigrations run cheyyakapovadam
❌ Field type wrong ga use cheyadam
admin.py lo register cheyyakapovadam


๐ŸŽฏ Real-life Example

๐Ÿ‘‰ Blog website create chestunnav anukundam:

  • Model → Blog structure define
  • Admin → content add
  • View → fetch data
  • Template → show

๐Ÿ‘‰ Full system complete ✔️


๐Ÿš€ Conclusion

๐Ÿ‘‰ Django Models use chesi:

  • Data store cheyochu
  • Manage cheyochu
  • Dynamic website build cheyochu

Comments

Popular posts from this blog

Django ante enti? (Beginner Friendly Telugu Guide)

  Introduction Meeru web development start cheyyali anukuntunnara? Leka backend development nerchukovali anukuntunnara? Appudu meeru tappakunda vinnadi oka peru ๐Ÿ‘‰ Django Ee article lo manam simple ga, clear ga ardham ayyela chuddam — Django ante enti, enduku use chestaru, ela start cheyyali.

Python Day 5 – If Else Conditions

  ๐Ÿ Python Day 5 – If Else Conditions ๐Ÿง  Introduction ๐Ÿ Python Day 5 – If Else Conditions Ippati varaku manam operators nerchukunnam. I roju manam decision making (If-Else) nerchukundam. ๐Ÿ‘‰ Program lo condition base chesi decisions tiskovadaniki use avutundi ๐Ÿ’ก Example: Age 18 kanna ekkuva unte → eligible Lekapothe → not eligible ๐Ÿ”น Basic If Condition age = 20 if age > 18 : print ( "Eligible" ) ๐Ÿ”น If-Else Condition age = 16 if age >= 18 : print ( "Eligible" ) else : print ( "Not Eligible" ) ๐Ÿ”น If-Elif-Else marks = 75 if marks >= 90 : print ( "Grade A" ) elif marks >= 60 : print ( "Grade B" ) else : print ( "Grade C" ) ๐Ÿงช Real Example (User Input) age = int ( input ( "Enter your age: " )) if age >= 18 : print ( "You can vote ✅" ) else : print ( "You cannot vote ❌" ) ⚠️ Important Points ๐Ÿ‘‰ Indentation (space) very import...

Django Templates & HTML Rendering (Complete Guide Telugu)

  Introduction Previous article lo manam Views & URLs chusam. Ipudu next important concept ๐Ÿ‘‰ Templates & HTML Rendering Django lo dynamic HTML pages ela create cheyyalo ee article lo nerchukundam ๐Ÿ”ฅ ๐Ÿง  Templates ante enti? ๐Ÿ‘‰ Template ante HTML file "T emplate ante HTML file matrame kaadu, Django lo dynamic content ni display cheyadaniki use chestam. Example ga, database lo unna blog posts ni HTML page lo chupinchadaniki templates use avutayi. " But special enti ante: ๐Ÿ‘‰ Dynamic data display cheyyachu (Python data → HTML lo show) ๐Ÿ“ Templates folder create cheyyadam Mee app lo templates ane folder create cheyandi: myapp/ templates/ index.html ⚙️ settings.py lo config cheyyali settings.py open cheyandi: TEMPLATES = [ { 'DIRS': [], ... }, ] ๐Ÿ‘‰ Usually app templates automatic ga detect chestundi ๐Ÿ’ป Simple HTML Template index.html : <!DOCTYPE html> <html> <head> <title>Django Page</title> ...