from django.db import models class Student(models.Model): name = models.CharField(max_length=50) age = models.IntegerField() email = models.EmailField() # Retrieve only the name and email fields for all Student objects students = Student.objects.values('name', 'email')
from django.db import models class Order(models.Model): order_date = models.DateTimeField() customer_name = models.CharField(max_length=50) total_amount = models.DecimalField(max_digits=10, decimal_places=2) # Retrieve the total amount of all orders grouped by customer_name order_totals = Order.objects.values('customer_name').annotate(total=Sum('total_amount'))In both examples, the Django package/library being used is `django.db.models`.