0

I'm writing a custom date field for Credit Card Expiration Fields. I've noticed that in custom field examples, there are two major part that we need to override, clean and compress methods.

I know that we can validate and change return values of the field value in clean method. But what about compress method ? Why do we need that and what's the difference in between of clean and compress method ?

iva123
  • 3,395
  • 10
  • 47
  • 68

1 Answers1

2

compress only exists for subclasses of MultiValueField. As the documentation there explains, you use it in place of clean to convert the multiple values (one for each field) into a single value.

For every other type of field, you use clean.

Daniel Roseman
  • 588,541
  • 66
  • 880
  • 895