[extensions-web/ui-cleanup: 3/12] upload: Make the source field required, and show validation error messages



commit 2a9afdb1472a5f0e082bf9a18f5c169a5d8432af
Author: Jasper St. Pierre <jstpierre mecheye net>
Date:   Thu Jan 5 15:33:56 2012 -0500

    upload: Make the source field required, and show validation error messages

 sweettooth/extensions/forms.py                     |    2 +-
 .../extensions/templates/extensions/upload.html    |    3 +++
 2 files changed, 4 insertions(+), 1 deletions(-)
---
diff --git a/sweettooth/extensions/forms.py b/sweettooth/extensions/forms.py
index a718b50..6b57e76 100644
--- a/sweettooth/extensions/forms.py
+++ b/sweettooth/extensions/forms.py
@@ -2,4 +2,4 @@
 from django import forms
 
 class UploadForm(forms.Form):
-    source = forms.FileField()
+    source = forms.FileField(required=True)
diff --git a/sweettooth/extensions/templates/extensions/upload.html b/sweettooth/extensions/templates/extensions/upload.html
index 4b7f43a..8c8bf4f 100644
--- a/sweettooth/extensions/templates/extensions/upload.html
+++ b/sweettooth/extensions/templates/extensions/upload.html
@@ -35,6 +35,9 @@
     {% csrf_token %}
 
     {{ form.source }}
+    {{ form.source.errors }}
+
+    <br>
     <input type="submit" value="Upload extension">
   </form>
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]