Skip to content

EncryptedDateField Still Broken #54

@PeterCat12

Description

@PeterCat12

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions