Added CSS and I accept terms and condition.
authorMadhusudan.C.S <madhusudancs@gmail.com>
Thu, 03 Sep 2009 18:37:48 +0530
changeset 18 07408d1ced76
parent 17 08a47999f316
child 19 6af9056ccac9
Added CSS and I accept terms and condition.
site-content/style.css
template/index.html
upload/forms.py
upload/models.py
upload/views.py
--- a/site-content/style.css	Thu Sep 03 17:31:12 2009 +0530
+++ b/site-content/style.css	Thu Sep 03 18:37:48 2009 +0530
@@ -19,20 +19,48 @@
 }
 
 form {
+  margin:10px 15px; padding: 0;
+  border: 1px solid #f2f2f2; 
+  background-color: #FAFAFA;
+  padding-bottom: 20px; 
 }
 
-form br {
+label {
+  float: left;
+  width: 40%;
+  font-weight:bold;
+  margin:5px 0; 
+  text-align: right; 
+}
+
+label.accept {
 }
 
 input, textarea {
-	padding: 5px;
-	font: bold 1em Georgia, "Times New Roman", Times, serif;
-	color: #333333;
-	background: #F9F3DF;
-	border-top: 1px solid #CB960F;
-	border-right: 1px solid #CCCC99;
-	border-bottom: 1px solid #CCCC99;
-	border-left: 1px solid #CB960F;
+  padding: 3px;
+  margin-left: 1%;
+  width: 30%;
+  position: relative;
+  left: -13%;
+  border:1px solid #eee;
+  font: normal 1em "Trebuchet MS", Tahoma, sans-serif;
+  color:#777;
+}
+
+textarea {
+	background-color: white;
+}
+
+input.accept {
+	position: relative;
+	top: 6px;
+	left: -28%;
+}
+
+select {
+  width: 30%;
+  position: relative;
+  left: -13%;
 }
 
 h1, h2, h3 {
@@ -62,6 +90,14 @@
 	margin-left: 3em;
 }
 
+ul.errorlist {
+  width: auto;
+  color: #ff0000;
+  margin:5px 0;
+  margin-right: 1em;  
+  text-align: center;
+}
+
 blockquote {
 	margin-left: 3em;
 	margin-right: 3em;
@@ -181,6 +217,11 @@
 	color: #FFFFFF;
 }
 
+#submit {
+	width: auto;
+	position: relative;
+	left: -7%;
+}
 /* Footer */
 
 #footer {
--- a/template/index.html	Thu Sep 03 17:31:12 2009 +0530
+++ b/template/index.html	Thu Sep 03 18:37:48 2009 +0530
@@ -34,7 +34,17 @@
 		{% block content %}
 		{% if value %}						
 			<form class = "center" method="post" action="." enctype="multipart/form-data">			
-				{{form.as_p}}
+				{{form.as_p}}
+				<p>
+				<label for="id_terms">Terms and Conditions:</label>
+				<textarea rows="5" cols="30" disabled="disabled">I accept that the copyright ownership of the submitted spoken tutorials will rest with CDEEP, IIT Bombay. CDEEP reserves the right to release the tutorials into the public domain.
+				</textarea>
+				</p>
+				<p>
+				  <input type="checkbox" value="True" name="accept" class="accept"/>
+				  <label for="id_terms" class="accept">I accept the terms and condition:</label>
+				</p>
+				<br />
 				<input type="submit" value="Upload" id="submit"/>
 			</form>
 		{% else %}			
--- a/upload/forms.py	Thu Sep 03 17:31:12 2009 +0530
+++ b/upload/forms.py	Thu Sep 03 18:37:48 2009 +0530
@@ -2,19 +2,29 @@
 
 from spoken_tut.upload.models import Participant
 
+
 class ParticipantForm(forms.ModelForm):
-    def clean(self):
-        """Cleaner for validating Other language field.
-        """
-        cleaned_data = self.cleaned_data
-        lang = cleaned_data['language']
-        other_lang = cleaned_data['other_lang']
-        accept = cleaned_data['accept']
-        if lang == 'Other' and not other_lang:
-            raise forms.ValidationError('Please fill in the other language field.')
-        if accept:
-            raise forms.ValidationError('You need to accept the terms and condition for uploading the data.')
+  def clean_other_lang(self):
+    """Cleaner for validating Other language field.
+    """
+    cleaned_data = self.cleaned_data
+    lang = cleaned_data.get('language')
+    other_lang = cleaned_data.get('other_lang')
+    if lang == 'Other' and not other_lang:
+      raise forms.ValidationError('Please fill in the other language field.')
+
+    return other_lang
 
-	class Meta:
-		model = Participant
+  def clean(self):
+    """Form cleaner for accepting the terms and conditions.
+    """
+    cleaned_data = self.cleaned_data
+    accept = cleaned_data.get('accept')
+    if not accept:
+      raise forms.ValidationError(
+          'You need to accept the terms and condition for uploading the data.')
 
+    return cleaned_data
+
+  class Meta:
+    model = Participant
--- a/upload/models.py	Thu Sep 03 17:31:12 2009 +0530
+++ b/upload/models.py	Thu Sep 03 18:37:48 2009 +0530
@@ -8,7 +8,7 @@
     ('Bengali', 'Bengali'),
     ('Bodo', 'Bodo'),
     ('Dogri', 'Dogri'),
-    ('English', 'English')
+    ('English', 'English'),
     ('Gujarati', 'Gujarati'),
     ('Hindi', 'Hindi'),
     ('Kannada', 'Kannada'),
@@ -41,8 +41,9 @@
 	email = models.EmailField()
 	filename = models.FileField(upload_to='videos/%Y/%m/%d')
 	language = models.CharField(max_length = 20, choices=LANGUAGE_CHOICES)
-	other_lang = models.CharField(max_length = 256, verbose_name='If Others, specify')
+	other_lang = models.CharField(max_length = 256, 
+															  verbose_name='If Others, specify',
+															  blank=True, null=True)
 	phonenumber = models.CharField(max_length=15)
 	age = models.IntegerField(max_length=3)
 	category = models.CharField(max_length = 80, choices=CATEGORY_CHOICES)	
-
--- a/upload/views.py	Thu Sep 03 17:31:12 2009 +0530
+++ b/upload/views.py	Thu Sep 03 18:37:48 2009 +0530
@@ -2,9 +2,10 @@
 from django.http import HttpResponse
 from django.template import Context, Template
 from django.shortcuts import render_to_response
-from form import FileForm, Uploaded_fileForm
+
 from forms import ParticipantForm
-import tarfile
+from models import Participant
+
 
 #function to read the upoaded file and store it
 def handle_uploaded_file(f):
@@ -23,12 +24,14 @@
             return render_to_response(template_name, {'form': form, 'value': False,})
         else:
             return render_to_response(template_name, {'form': form, 'value': True,})
-    c = Context()
     return render_to_response(template_name,
-			  {'form': ParticipantForm(), 'value': True,})
+			  {'form': ParticipantForm(), 'value': True})
 			  
 def submission(request, template_name='submission.html'):
-    '''
-        view to return the submitted videos
-    '''
-    pass
+    """View to return the submitted videos
+    """
+    context = {
+        'participants': Participant.objects.all()
+        }
+
+    return render_to_response(template_name, context)