Models.model Update value on change

Hi, I want to update the value of Status if num_serie isn’t null

num_serie = models.CharField(max_length=10, verbose_name='número de série',blank=True)
status = models.CharField(choices=STATUS, max_length=10, default='Orçamento', verbose_name='status')

On clean works (see the console)

def clean(self):
        print(f'status:{self.status}, ')
        if self.num_serie:
            self.status = 'Liberado'
            self.valida = 1

        if self.valida == 1:
            self.libera_producao = 1
        print(f'status:{self.status}, ')
server-1  | [06/Mar/2024 12:56:42] "GET /admin/jsi18n/ HTTP/1.1" 200 8876
server-1  | status:Orçamento, 
server-1  | status:Liberado, 
server-1  | [06/Mar/2024 12:56:48] "POST /admin/rotinas/fichadados/add/ HTTP/1.1" 200 39473
server-1  | [06/Mar/2024 12:56:49] "GET /admin/jsi18n/ HTTP/1.1" 200 8876

but when the page refreshes, the value dosn’t update

Is there a way to make this change happens live, while I type “Número de série:”?
The value of ‘status’ should change depending if “Número de série:” is blank or not.
If blank 'Orçamento", else ‘Liberado’

It’s correct to use clean metod for this?

Django runs on the server. Django has no control over what happens in the browser. If you want this to be changed while you are typing in that field, you would need to use some JavaScript to do that. There’s nothing that Django can do for you until the form is submitted.

Side note: If this is a designed constraint on that field - if that setting is always required to match what you’ve defined, then that field is redundant data and doesn’t need to be kept as a separate field in the database.

So the way to go is to run validations and create a view with the interations I want

Thank you sir!

I think we may have a language or translation issue here, because this is not what I’m saying - at least not based upon the terminology you are using here. If you provide more details about exactly what you mean by this, I may or may not agree