0Pricing
Django Academy · Lesson

values, values_list, and count

Pull lightweight data and aggregates.

Why Go Lightweight

Full model objects carry every field. When you only need a column or two, lighter tools fetch less data and run faster.

values() Returns Dicts

Call values() and each row comes back as a dictionary instead of a model instance. Handy for JSON and quick reads.

Book.objects.values("title", "year")

All lessons in this course

  1. all(), get(), and filter()
  2. Field Lookups and exclude()
  3. order_by, Slicing, and Lazy Evaluation
  4. values, values_list, and count
← Back to Django Academy