Hello all, I posted a while ago about some file upload issues, i figured out how to upload a file with my custom manipulator, but now I am running into an issue where if I do not include file in my form I get an error message that "list indexes must be integers" My custom manipulator is here, along with the update call.
class ParticipantManipulator(Manipulator): # define fields# fields =( forms.FileUploadField(field_name="photo_path", is_required=False), forms.IntegerField(field_name="birthyear", is_required=False), forms.TextField(field_name="gender", length=5, is_required=False), forms.TextField(field_name="adventurousness", length=20, is_required=False), forms.TextField(field_name="postal_code",length=15, maxlength=15, is_required=False), forms.TextField(field_name="geographical_location", length=20, is_required=False), forms.LargeTextField(field_name="bio", is_required=False), forms.LargeTextField(field_name="about_my_music", is_required=False), forms.TextField(field_name="how_did_you_find_goombah",length=20, is_required=False), forms.LargeTextField(field_name="fav_lyric", is_required=False), forms.TextField(field_name="best_song",length=20, is_required=False), forms.TextField(field_name="best_album",length=20, is_required=False), forms.TextField(field_name="best_band",length=20, is_required=False), forms.TextField(field_name="worst_song",length=20, is_required=False), forms.TextField(field_name="tags", length=25, is_required=False), ) def __init__(self,participant): self.participant = participant self.default = participant.__dict__ def complete(self, request, data): self.participant.photo_path = data['photo_path']['filename'] self.participant.birthyear = data['birthyear'] self.participant.gender = data['gender'] self.participant.adventurousness=data['adventurousness'] self.participant.postal_code =data['postal_code'] self.participant.geographical_location=data['geographical_location'] self.participant.bio=data['bio'] self.participant.about_my_music=data['about_my_music'] self.participant.how_did_you_find_goombah=data['how_did_you_find_goombah'] self.participant.fav_lyric=data['fav_lyric'] self.participant.best_song=data['best_song'] self.participant.best_album=data['best_album'] self.participant.best_band=data['best_band'] self.participant.worst_song=data['worst_song'] self.participant.tags =data['tags'] # call the custom save() method from the manipulator # image upload seperate from the data save- this can be refractored to be more generic # save_FOO_file is an included method with a filefield if data['photo_path']['filename']: if data['photo_path']['content']: self.participant.save_photo_path_file(data['photo_path']['filename'],data['photo_path']['content']) self.participant.save() else: self.participant.save() def update(request,name): participant = get_object_or_404(Participant, normal_nickname__exact=name) manipulator = ParticipantManipulator(participant) manipulator.process(request) if(manipulator.process(request)): return render_to_response('profiles/update.html', {'form': manipulator.form, 'participant': participant }) else: return HttpResponseRedirect("/profiles/%s" % participant.normal_nickname) in my form I have this: <dd><h3>About Me</h3> <label for ="id_bio">Bio</label><br/> {{form.bio}}<br/> Adventureousness: {{form.adventurousness}}<br/> <label for="id_photo_path"> My Pic.</label> <br/> Current: {{ form.photo_path }}<br/> Update: {{ form.photo_path_file }} </dd> when I render the form I do not get the current file listing... and I cannot update the form without putting in a new file.. Any thoughts... --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---