Posts

Showing posts from April, 2018

Mastering Django ORM Update Queries — From Basics to Pro Level

Updating data properly is just as important as selecting data. In this guide, you will learn how to update records correctly in Django ORM — from basic .save() usage to pro techniques like atomic updates, bulk updates, F expressions, and best practices! 📚 1. Basic Update Using .save() Fetch and modify a single object user = NewUser.objects.get(pk=1) user.email = 'newemail@example.com' user.save() ⚡ 2. Updating Specific Fields with .save(update_fields=[...]) user = NewUser.objects.get(pk=1) user.email = 'newemail@example.com' user.save(update_fields=['email']) 🎯 3. Updating Multiple Records at Once Using .update() NewUser.objects.filter(user_type=2).update(is_active=False) 🧠 4. .save() vs .update() — Key Differences Aspect .save() .update() Works on Single object QuerySet (multiple) Triggers signals? ✅ Yes ❌ No Auto-updates auto_now fields? ✅ Yes ❌ No Custom logic inside save() runs? ✅ Yes ❌ No Speed for bulk ❌ Slow ✅ Fast 🔥 5. Upda...

Highcharts: A 10 minutes overview.

Image
A Norway-based company 'Highsoft' offering charting library written in pure javascript. Its a major addon to web applications requires interactive charts. Currently they're supporting many chart types including line, area, column, bar, pie, scatter, bubble, gauge, spline, areaspline and polar etc. Already Highcharts is providing a descriptive demo page considering all examples ( Highcharts Demos ). The pupose of the article only to understand maximum aspects in a view. Features : Compatible with all major browsers, it also provides features like DateTime support, Export (PDF/ PNG/ JPG / SVG), Print and Zoomablity etc. Installation: Its a single file downloadable from (https://www.highcharts.com/). Also packages through npm and Bower are avalable. We may load file on our domain or use CDN version. Load files from your own domain (Insert in html head) <script src = "/js/highcharts.js"> CDN Version (Insert in html head) <script src = ...