문제

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.

도움이 되었습니까?

해결책

Instead of placeholder, use value.

'constitucional_64': forms.TextInput(attrs={'value': 'negado'}),
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top