Re: [Django] #27037: 'required' attribute on prefilled ClearableFileInput prevents valid form submissions

2016-08-12 Thread Django
#27037: 'required' attribute on prefilled ClearableFileInput prevents valid form
submissions
-+-
 Reporter:  gasman   |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Forms|  Version:  1.10
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-

Comment (by Tim Graham ):

 In [changeset:"d8cda352b11ece1070f4aaf4b7a9894908a6160c" d8cda35]:
 {{{
 #!CommitTicketReference repository=""
 revision="d8cda352b11ece1070f4aaf4b7a9894908a6160c"
 [1.10.x] Fixed #27037 -- Prevented required attribute on
 ClearableFileInput when initial data exists.

 Backport of fab46ce6f5a0a58c4e5e39c9e5e412702beb4a64 from master
 }}}

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.fc2449f38ca6c030a8337dbef0df0370%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27037: 'required' attribute on prefilled ClearableFileInput prevents valid form submissions

2016-08-12 Thread Django
#27037: 'required' attribute on prefilled ClearableFileInput prevents valid form
submissions
-+-
 Reporter:  gasman   |Owner:  nobody
 Type:  Bug  |   Status:  closed
Component:  Forms|  Version:  1.10
 Severity:  Release blocker  |   Resolution:  fixed
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by Tim Graham ):

 * status:  new => closed
 * resolution:   => fixed


Comment:

 In [changeset:"fab46ce6f5a0a58c4e5e39c9e5e412702beb4a64" fab46ce6]:
 {{{
 #!CommitTicketReference repository=""
 revision="fab46ce6f5a0a58c4e5e39c9e5e412702beb4a64"
 Fixed #27037 -- Prevented required attribute on ClearableFileInput when
 initial data exists.
 }}}

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.48ac6491084773fa2b6f3999fad47799%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27037: 'required' attribute on prefilled ClearableFileInput prevents valid form submissions

2016-08-09 Thread Django
#27037: 'required' attribute on prefilled ClearableFileInput prevents valid form
submissions
-+-
 Reporter:  gasman   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Forms|  Version:  1.10
 Severity:  Release blocker  |   Resolution:
 Keywords:   | Triage Stage:  Ready for
 |  checkin
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+-
Changes (by claudep):

 * stage:  Accepted => Ready for checkin


--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.046fa61a22e62574a7224cf4074e031a%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27037: 'required' attribute on prefilled ClearableFileInput prevents valid form submissions

2016-08-08 Thread Django
#27037: 'required' attribute on prefilled ClearableFileInput prevents valid form
submissions
-+
 Reporter:  gasman   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Forms|  Version:  1.10
 Severity:  Release blocker  |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  1|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+
Changes (by jdufresne):

 * has_patch:  0 => 1


--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.c724c6195ed4710119ace63c9d312267%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27037: 'required' attribute on prefilled ClearableFileInput prevents valid form submissions

2016-08-08 Thread Django
#27037: 'required' attribute on prefilled ClearableFileInput prevents valid form
submissions
-+
 Reporter:  gasman   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Forms|  Version:  1.10
 Severity:  Release blocker  |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+

Comment (by jdufresne):

 [https://github.com/django/django/pull/7049 PR]

 I took an approach that I hope is extendable for other widgets and custom
 widgets that need drop the `required` attribute.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.4642ff19fd268ec6fe1e122c3275318f%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Django] #27037: 'required' attribute on prefilled ClearableFileInput prevents valid form submissions

2016-08-08 Thread Django
#27037: 'required' attribute on prefilled ClearableFileInput prevents valid form
submissions
-+
 Reporter:  gasman   |Owner:  nobody
 Type:  Bug  |   Status:  new
Component:  Forms|  Version:  1.10
 Severity:  Release blocker  |   Resolution:
 Keywords:   | Triage Stage:  Accepted
Has patch:  0|  Needs documentation:  0
  Needs tests:  0|  Patch needs improvement:  0
Easy pickings:  0|UI/UX:  0
-+
Changes (by timgraham):

 * needs_better_patch:   => 0
 * needs_docs:   => 0
 * severity:  Normal => Release blocker
 * needs_tests:   => 0
 * stage:  Unreviewed => Accepted


--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/064.98afdfd5d686175e2670d4e2adf5140e%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.


[Django] #27037: 'required' attribute on prefilled ClearableFileInput prevents valid form submissions

2016-08-08 Thread Django
#27037: 'required' attribute on prefilled ClearableFileInput prevents valid form
submissions
+
 Reporter:  gasman  |  Owner:  nobody
 Type:  Bug | Status:  new
Component:  Forms   |Version:  1.10
 Severity:  Normal  |   Keywords:
 Triage Stage:  Unreviewed  |  Has patch:  0
Easy pickings:  0   |  UI/UX:  0
+
 The addition of the `required` HTML attribute on required form fields
 (#22383) does not handle the situation where a `ClearableFileInput` is
 pre-populated with an initial value (causing it to display the "Currently:
 foo.txt" text alongside an empty `` field) and
 submitted without selecting a new file. According to Django's validation
 logic this is a valid form submission, as the field is considered non-
 empty. However, the browser-side validation doesn't know about this nuance
 - at the HTML level, the `` element ''is'' an empty
 field, and has the `required` attribute set, causing it to fail
 validation.

 This breaks the conventional ModelForm-based 'edit' view pattern, on any
 model that has a required FileField. For example:

 {{{
 # models.py
 class Document(models.Model):
 title = models.CharField(max_length=255)
 file = models.FileField()

 # forms.py
 class DocumentForm(forms.ModelForm):
 class Meta:
 model = Document
 fields = ['title', 'file']

 # views.py
 def edit(request, document_id):
 document = Document.objects.get(id=document_id)

 if request.method == 'POST':
 # ...
 return HttpResponse("OK")
 else:
 form = DocumentForm(instance=document)
 return render(request, 'edit.html', {'document': document, 'form':
 form})

 # edit.html
 
 {{ form.as_p }}
 
 

 # renders as the following, which cannot be submitted as-is:
 File: Currently: hello.txt Change: 
 }}}

 I suggest that ClearableFileInput should discard the `required` attribute
 whenever an initial value exists, in much the same way that
 CheckboxSelectMultiple does:
 
https://github.com/django/django/blob/35225e2ade08ea32e36a994cd4ff90842c599e20/django/forms/widgets.py#L797-L799

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-updates+unsubscr...@googlegroups.com.
To post to this group, send email to django-updates@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/049.39fddcbf4230bc702d132b6bbc0780ff%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.