Hi Django Forum I'm working on a web application that has a page with form set that requires file upload. When I upload the files I get:
Django Version:1.9.1Exception Type:ValueErrorException Value: invalid literal for int() with base 10: '' Exception Location:C:\desarrollo\Python27\lib\site-packages\django\db\models\fields\__init__.py in get_prep_value, line 976Python Executable: C:\desarrollo\Python27\python.exePython Version:2.7.3 On this line of code: study_form_set = DiagnosticStudyFormSet(request.POST, request.FILES, prefix='studies', queryset=DiagnosticStudy.objects.filter(diagnostic__id=pk)) My model: class DiagnosticStudy(models.Model): id = models.AutoField(primary_key=True) name = models.CharField(verbose_name='Name', max_length=255) link = models.CharField(verbose_name='Link', max_length=255, blank=True, null=True) path = models.FileField(upload_to='files', max_length=255, blank=True, null=True) diagnostic = models.ForeignKey(Diagnostic, blank=True, null=True) study_type = models.ForeignKey(StudyType, blank=True, null=True) class Meta: managed = False db_table = 't_udm_diagnostic_study' My forms: class DiagnosticStudyForm(ModelForm): class Meta(object): model = DiagnosticStudy fields = [ 'id', 'name', 'link', 'path', 'study_type' ] widgets = { 'id': HiddenInput(attrs={ 'class': 'campo' }), 'name': TextInput(attrs={ 'class': 'campo', 'size': '40', 'onchange': 'validate(this)' }), 'link': TextInput(attrs={ 'class': 'campo', 'size': '40', 'onchange': 'validate(this)' }), 'path': FileInput(attrs={ 'class': 'campo', 'size': '40', 'accept': 'image/gif,image/jpeg,image/pjpeg,image/png,image/tiff,image/x-tiff,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-powerpoint,application/vnd.openxmlformats-officedocument.presentationml.presentation', 'onchange': 'validate(this)' }), 'study_type': HiddenInput(attrs={ 'class': 'campo', 'size': '40', 'onchange': 'validate(this)' }), } DiagnosticStudyFormSet = modelformset_factory(DiagnosticStudy, form=DiagnosticStudyForm, extra=5, can_delete=True) The Form does not have a IntegerField only CharFields and ForeignKeys. Any ideas on how to know which field is generating the error? Regards, Néstor -- You received this message because you are subscribed to the Google Groups "Django users" group. To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscr...@googlegroups.com. To post to this group, send email to django-users@googlegroups.com. Visit this group at https://groups.google.com/group/django-users. To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/00b3ccfa-d092-4027-97fe-31fd6a828129%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.