<s> from django import forms <EOL> from multiupload . fields import MultiFileField <EOL> from . models import Message , Attachment <EOL> class ContactForm ( forms . ModelForm ) : <EOL> class Meta : <EOL> model = Message <EOL> fields = [ '<STR_LIT>' , '<STR_LIT>' , '<STR_LIT:content>' ] <EOL> files = MultiFileField ( min_num = <NUM_LIT:1> , max_num = <NUM_LIT:3> , max_file_size = <NUM_LIT> * <NUM_LIT> * <NUM_LIT:5> ) <EOL> def save ( self , commit = True ) : <EOL> instance = super ( ContactForm , self ) . save ( commit ) <EOL> for each in self . cleaned_data [ '<STR_LIT>' ] : <EOL> Attachment . objects . create ( file = each , message = instance ) <EOL> return instance </s>
