Django: how to update order tracker model using Django?

I am trying to build an order tracker using django, to track the delivery status and location of a order made by a buyer.
i have a model that look like this

class OrderTracker(models.Model):
    order_item = models.ForeignKey('store.CartOrderItem', on_delete=models.SET_NULL, null=True, related_name="cartorderitem_tracker")
    status = models.CharField(max_length=5000, null=True, blank=True)
    location = models.CharField(max_length=5000, null=True, blank=True)
    activity = models.CharField(max_length=5000, null=True, blank=True)
    date= models.DateField(auto_now_add=True)

def __str__(self):
    return self.order_item

When an order gets placed, the status of the OrderTracker changes to shipping.
How do i update the location with the current location where the order is crrently and also the activity (activity is something like: “Left Warehouse”)

Should this is updated manully by the vendor in the dashboard, or do i need like an API to implement this feature

That’s a decision for you to make in coordination with your vendor(s).

If you create an API, then it’s up to them to build something allowing their staff to submit the updates.

If you give them a link to update the status of an order, then it’s up to you to provide the necessary views and templates.

Or you can do both - create an API and a page that submits through that API.
if you’re working with multiple vendors, they may have an existing system that they wish to integrate with your system. Or, if they’re a small vendor, they may not have the staffing to do that work and would prefer regular page they can update.

There’s no technical reason to choose one over the other, it’s a business decision.

Thanks for your response Mr. Ken

Right now, there are small vendors, and i already have a simple view and template where they can update only the delivery_status of the product.

But, is it okay if i allow them to also update the location and activity of the current product (they may get this information from the shipping company there are using to ship the item to the buyer then update it in the using the form i have provided)??

Again, that’s a business decision, not a technical decision.

You can allow those vendors to update whatever you want them to update.

It’s your decision to make regarding what they’re allowed to change. You need to figure out what’s going to work best for your business.

Now, you might want to do things like define buttons or use select fields instead of using a text input field for some values, but that’s all really up to you.

1 Like

Okay, thank you very much for your time.