Hello all, I have a slightly unusual requirement: I want to use a FileField in a form but with a TextField in the model. (The content being uploaded is a big bit of flat text, but I want to store it in the database, not as a file.)
The problem is that with the code that I have together the request.FILES parameter is empty, so the form fails validation, any suggestions as to where I'm going wrong, thanks. sparky the form: class SubmissionForm(forms.Form): title = forms.CharField(max_length=100) description = forms.CharField(widget=forms.Textarea) content = forms.FileField(widget=forms.FileInput) the model: class Submission(models.Model): """ Submission model """ creator = models.ForeignKey(User) created_datetime = models.DateTimeField(auto_now_add=True) title = models.CharField(max_length=100) description = models.TextField() content = models.TextField() The view code: if request.method == 'POST': form = SubmissionForm(request.POST, request.FILES) if form.is_valid(): s = Submission(creator=request.user, created_datetime=datetime.datetime.now(), title=form.cleaned_data['title'], description=form.cleaned_data['description'], content=form.cleaned_data['content']) the template: <form enctype="multipart/form-data" action="." method="POST"> <table> {{ form.as_p }} </table> <p><input type="submit" value="Submit"></p> </form> --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---