I am developing a courier management service using Django. So far, I have made three models,
- Customer
- DelveryAgent
- Parcels.
Here is the Parcel model:
class Parcel(models.Model):
type = models.CharField(max_length=20)
city = models.CharField(max_length=20)
street = models.CharField(max_length=100)
zip = models.CharField(max_length=100)
email = models.CharField(max_length=100)
phone = models.CharField(max_length=100)
status = models.CharField(max_length=100, choices=STATUS, default='pending')
booked_by = models.ForeignKey(Customer, on_delete=models.CASCADE)
delivery_agent = models.ForeignKey(DeliveryAgent)
Customers can place new parcels. Initially, the parcel status is pending, and no delivery agent is assigned. When the admin assigns a new delivery agent to the parcel from the admin site, I want the relative customer to get notified with the details of the delivery agent. How can I do that?