Add incrementing integer to queryset each time an object is touched in Django

I'm trying to add an incrementing integer, in this case a unique sequence number ranging from [1,n] where n is the number of sequences in the given schedule.

I'm trying to add an incrementing integer, in this case a unique sequence number ranging from [1,n] where n is the number of sequences in the given schedule.

As the sequences will get updated regularly I am wondering what would be the most efficient way to loop through the following

Sequence.objects.filter(schedule=schedule).order_by('start', 'id')

and assign the incrementing number to each sequence. Also, where would be the ideal place to implement this method if I want it to run every time a new sequence is created, deleted or a sequence is updating the start field. I've been thinking about the save() and delete() method, however I dont wish to update when only other fields in the sequence is updated.

This is my sequence model

class Sequence(models.Model):
number = models.PositiveIntegerField(
    verbose_name='sequence number',
    help_text='auto incrementing sequence number',
)
schedule = models.ForeignKey(
    to=Schedule,
    verbose_name='schedule',
    on_delete=models.CASCADE,
    related_name='sequences',
    help_text='schedule primary key',
)
start = models.DateTimeField(
    verbose_name='start date',
    help_text='sequence starting datetime',
)
end = models.DateTimeField(
    verbose_name='end date',
    help_text='sequence ending datetime',
)


Python Django Tutorial | Django Course

Python Django Tutorial | Django Course

🔥Intellipaat Django course: https://intellipaat.com/python-django-training/ 👉This Python Django tutorial will help you learn what is django web development &...

This Python Django tutorial will help you learn what is django web development & application, what is django and introduction to django framework, how to install django and start programming, how to create a django project and how to build django app. There is a short django project as well to master this python django framework.

Why should you watch this Django tutorial?

You can learn Django much faster than any other programming language and this Django tutorial helps you do just that. Our Django tutorial has been created with extensive inputs from the industry so that you can learn Django and apply it for real world scenarios.

Django

Well i used django ... i want to know after completing all the coding stuff, can i make all the codes online ?

Well i used django ... i want to know after completing all the coding stuff, can i make all the codes online ?

as Django give you a local host, i have a .com domain but can i integrate the codes to it so it works ?