I wanna make patient information register form. I did model.py and form.py but, when i come to use, i couldn't pass the form without filling. Forexample, in this image evlilik tarihi means marriage date, evlilik tarihi 2 means second marriage date, when i filling the form i want to leave empty the evlilik tarihi 2 field. But always i took this error "TypeError: init() got an unexpected keyword argument 'blank'" I used null=True, blank=True, but nothing. How can i pass the form field without filling.
And second question is, i made three form field for multiple marriage but is there any way how can i add button to this marriage field, and someone had second or third marriage, he can easily add button and give marriage date to me. How can i do this?
Form.py
class HastaBilgiForm(forms.ModelForm):
class Meta:
model = HastaBilgi
fields = '__all__'
widgets = {
'hasta_ad_soyad' : forms.TextInput(attrs={'class': 'form-control'}),
'hasta_dogum_tarihi' : forms.TextInput(attrs={'class': 'form-control'}),
'hasta_dogum_yeri' : forms.TextInput(attrs={'class': 'form-control'}),
'evlilik_tarihi_1' : forms.TextInput(attrs={'class': 'form-control'}),
'evlilik_tarihi_2' : forms.TextInput(attrs={'class': 'form-control'}),
'evlilik_tarihi_3' : forms.TextInput(attrs={'class': 'form-control'}),
'bosanma_tarihi_1' : forms.TextInput(attrs={'class': 'form-control'}),
'bosanma_tarihi_2' : forms.TextInput(attrs={'class': 'form-control'}),
'bosanma_tarihi_3' : forms.TextInput(attrs={'class': 'form-control'}),
'ogrenim_durumu' : forms.Select(choices=choices2, attrs={'class': 'form-control'}),
'meslek' : forms.TextInput(attrs={'class': 'form-control'}),
'kan_grubu' : forms.Select(choices=choices1, attrs={'class': 'form-control'}),
'boy' : forms.TextInput(attrs={'class': 'form-control'}),
'kilo' : forms.TextInput(attrs={'class': 'form-control'}),
'max_kilo' : forms.TextInput(attrs={'class': 'form-control'}),
'max_kilo_tarih' : forms.TextInput(attrs={'class': 'form-control'}),
'nereden_geldi' : forms.Textarea(attrs={'class': 'form-control'}),
'onceki_homeopati_tedavisi' : forms.Textarea(attrs={'class': 'form-control'}),
'gelis_sikayeti' : forms.Textarea(attrs={'class': 'form-control'}),
}
Model.py
class HastaBilgi(models.Model):
hasta_ad_soyad = models.CharField(max_length=255)
hasta_dogum_tarihi = models.CharField(max_length=255)
hasta_dogum_yeri = models.CharField(max_length=255)
evlilik_tarihi_1 = models.CharField(max_length=255)
evlilik_tarihi_2 = models.DateField()
evlilik_tarihi_3 = models.DateField()
bosanma_tarihi_1 = models.DateField()
bosanma_tarihi_2 = models.DateField()
bosanma_tarihi_3 = models.DateField()
ogrenim_durumu = models.CharField(max_length=255)
meslek = models.CharField(max_length=255)
kan_grubu = models.CharField(max_length=255)
boy = models.CharField(max_length=255)
kilo = models.CharField(max_length=255)
max_kilo = models.CharField(max_length=255)
max_kilo_tarih = models.CharField(max_length=255)
nereden_geldi = models.CharField(max_length=255)
onceki_homeopati_tedavisi = models.CharField(max_length=255)
gelis_sikayeti = models.CharField(max_length=255)
def __str__(self):
return self.hasta_ad_soyad
