Question

I was using a default value in the model

constitucional_64 = models.CharField(max_length=500, null=True,blank=True,default='negado')

The problem is the I need to delete the value from the input when I click on it, I'm using placeholders in my ModelForm

class ExpedienteInicialform(ModelForm):
  class Meta:
    model = ExpedienteConsultaInicial
    widgets = {
        'constitucional_64': forms.TextInput(attrs={'placeholder': 'negado'}),
    }

But I need to get the value 'negado' to send the to the database, the placeholder works fine, the problem is that I don't get the value in the POST.

Was it helpful?

Solution

Instead of placeholder, use value.

'constitucional_64': forms.TextInput(attrs={'value': 'negado'}),
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top