django-fields icon indicating copy to clipboard operation
django-fields copied to clipboard

EncryptedDateField Still Broken

Open PeterCat12 opened this issue 7 years ago • 0 comments

Similar to (and maybe a result of whatever fix was implemented for) issue 4.

django 1.8 python 2.7

My relevant form code:

class PatientInformationForm(forms.ModelForm):
    date_of_birth = forms.DateField(
         widget=TriSelectDateWidget(required=False, years=input_choices.DOB_YEAR_RANGE))

My relevant model:

class PatientInformation(models.Model):
     date_of_birth = enc_fields.EncryptedDateTimeField()

Upon form submission django_fields produces the error: AttributeError at /registration/patient/ 'datetime.date' object has no attribute 'split'

If I cast the date_of_birth to a string in my form's clean method I encounter the same error described in issue 4.

I have a temporary work around but I think it should ultimately be resolved by django_fields:

def clean_date_of_birth(self):
        # hackish workaround...
        data = self.cleaned_data['date_of_birth']
        data = str(data)
        data = data.replace('-', ':')
        return data

PeterCat12 avatar Jun 02 '17 16:06 PeterCat12