<s> from django . forms import ImageField <EOL> from . . specs import SpecHost <EOL> from . . utils import generate <EOL> class ProcessedImageField ( ImageField , SpecHost ) : <EOL> def __init__ ( self , processors = None , format = None , options = None , <EOL> autoconvert = True , spec_id = None , spec = None , * args , ** kwargs ) : <EOL> if spec_id is None : <EOL> raise TypeError ( '<STR_LIT>' ) <EOL> SpecHost . __init__ ( self , processors = processors , format = format , <EOL> options = options , autoconvert = autoconvert , spec = spec , <EOL> spec_id = spec_id ) <EOL> super ( ProcessedImageField , self ) . __init__ ( * args , ** kwargs ) <EOL> def clean ( self , data , initial = None ) : <EOL> data = super ( ProcessedImageField , self ) . clean ( data , initial ) <EOL> if data and data != initial : <EOL> spec = self . get_spec ( source = data ) <EOL> data = generate ( spec ) <EOL> return data </s>
