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.

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> ...

Django Views & URLs (Complete Guide Telugu)

Introduction Previous article lo manam Django project create chesam. Ipudu chuddam 👉 user request vachinappudu Django ela respond avthundi? Django lo Views & URLs anevi chala important concepts 🔥 🧠 Simple ga ardham: 👉 URL = address 👉 View = action (logic) User URL enter chesthe → View execute avthundi 🔗 URLs ante enti? Example: http://127.0.0.1:8000/about/ http://127.0.0.1:8000/contact/ 👉 /about/ , /contact/ ni URLs antaru Django lo ee URLs ni urls.py file lo define chestam ⚙️ urls.py Example from django.urls import path from . import views urlpatterns = [ path('about/', views.about_view), ] 👉 Ikkada: 'about/' → URL about_view → View function ⚡ Views ante enti? 👉 View ante Python function User request vachinappudu: 👉 View function run avthundi 👉 Response return chestundi 💻 Simple View Example from django.http import HttpResponse def about_view(request): return HttpResponse("Hello from About Page") 👉 Browser lo /about/ open ches...