Ticket #12742: file_upload.diff
File file_upload.diff, 2.3 KB (added by , 15 years ago) |
---|
-
django/contrib/comments/forms.py
22 22 timestamp = forms.IntegerField(widget=forms.HiddenInput) 23 23 security_hash = forms.CharField(min_length=40, max_length=40, widget=forms.HiddenInput) 24 24 25 def __init__(self, target_object, data=None, initial=None): 25 # use *args and **kwrgs as __init__args to allow super to work 26 # properly and handle e.g. request.FILES in post handler 27 def __init__(self, target_object, data=None, initial=None, *args, **kwargs): 26 28 self.target_object = target_object 27 29 if initial is None: 28 30 initial = {} 29 31 initial.update(self.generate_security_data()) 30 super(CommentSecurityForm, self).__init__(data=data, initial=initial) 32 # super did not use *arts, and **kwargs, 33 super(CommentSecurityForm, self).__init__(data=data, initial=initial, *args, **kwargs) 31 34 32 35 def security_errors(self): 33 36 """Return just those errors associated with security""" -
django/contrib/comments/views/comments.py
67 67 preview = "preview" in data 68 68 69 69 # Construct the comment form 70 form = comments.get_form()(target, data=data) 70 # NEW: added files=request.FILES support 71 form = comments.get_form()(target, data=data, files=request.FILES) 71 72 72 73 # Check security information 73 74 if form.security_errors(): -
django/contrib/comments/templates/comments/form.html
1 1 {% load comments i18n %} 2 <form action="{% comment_form_target %}" method="post">{% csrf_token %}2 <form {% if form.is_multipart %} enctype="multipart/form-data" {% endif %} action="{% comment_form_target %}" method="post">{% csrf_token %} 3 3 {% if next %}<input type="hidden" name="next" value="{{ next }}" />{% endif %} 4 4 {% for field in form %} 5 5 {% if field.is_hidden %}