# HG changeset patch # User Shantanu # Date 1251979272 -19800 # Node ID 08a47999f316abdb0fca3e6757b878360fce95e9 # Parent a5bbfbe5feb1404bde0bfde6ade67f8b97a3e602 Added submissions page. diff -r a5bbfbe5feb1 -r 08a47999f316 template/submission.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/template/submission.html Thu Sep 03 17:31:12 2009 +0530 @@ -0,0 +1,68 @@ + + + + +OCR + + + + + + + + +
+ +
+

+ {% block content %} + + + + + + + + + + + {% for participant in participants %} + + + + + + + + + + {% endfor %} +
Name Email-id Language Age Phone Number Category File
{{ participant.name }}{{ participant.email }}{{ participant.language }}{{ participant.phonenumber }}{{ participant.age }}{{ participant.category }}{{ file }}
+ {% endblock %} +

+
+ +
 
+
+ + + + diff -r a5bbfbe5feb1 -r 08a47999f316 upload/form.py --- a/upload/form.py Thu Sep 03 00:17:30 2009 +0530 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,12 +0,0 @@ -from django import forms -from django.utils.translation import ugettext_lazy as _ - -attrs_dict = { 'class': 'required' } - -#form for file field, lets you upload file -class FileForm(forms.Form): - file = forms.FileField() - -#form for creating a editable box, out of the content of the file -class Uploaded_fileForm(forms.Form): - content = forms.CharField(widget=forms.Textarea(attrs=attrs_dict),label=_(u'content')) diff -r a5bbfbe5feb1 -r 08a47999f316 upload/forms.py --- a/upload/forms.py Thu Sep 03 00:17:30 2009 +0530 +++ b/upload/forms.py Thu Sep 03 17:31:12 2009 +0530 @@ -3,6 +3,18 @@ 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.') + class Meta: model = Participant diff -r a5bbfbe5feb1 -r 08a47999f316 upload/models.py --- a/upload/models.py Thu Sep 03 00:17:30 2009 +0530 +++ b/upload/models.py Thu Sep 03 17:31:12 2009 +0530 @@ -8,6 +8,7 @@ ('Bengali', 'Bengali'), ('Bodo', 'Bodo'), ('Dogri', 'Dogri'), + ('English', 'English') ('Gujarati', 'Gujarati'), ('Hindi', 'Hindi'), ('Kannada', 'Kannada'), @@ -26,19 +27,22 @@ ('Tamil', 'Tamil'), ('Telugu', 'Telugu'), ('Urdu', 'Urdu'), + ('Other', 'Other') ) CATEGORY_CHOICES = ( ('Student at IIT','Student at IIT'), - ('Staff and family','Staff and family'), - ('Faculty and family','Faculty and family'), - ('Others','Others'), - ) + ('Staff and family','Staff and family'), + ('Faculty and family','Faculty and family'), + ('Others','Others'), + ) name = models.CharField(max_length = 50) 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') phonenumber = models.CharField(max_length=15) age = models.IntegerField(max_length=3) - category = models.CharField(max_length = 80, choices=CATEGORY_CHOICES) + category = models.CharField(max_length = 80, choices=CATEGORY_CHOICES) + diff -r a5bbfbe5feb1 -r 08a47999f316 upload/views.py --- a/upload/views.py Thu Sep 03 00:17:30 2009 +0530 +++ b/upload/views.py Thu Sep 03 17:31:12 2009 +0530 @@ -26,3 +26,9 @@ c = Context() return render_to_response(template_name, {'form': ParticipantForm(), 'value': True,}) + +def submission(request, template_name='submission.html'): + ''' + view to return the submitted videos + ''' + pass diff -r a5bbfbe5feb1 -r 08a47999f316 urls.py --- a/urls.py Thu Sep 03 00:17:30 2009 +0530 +++ b/urls.py Thu Sep 03 17:31:12 2009 +0530 @@ -16,6 +16,6 @@ # Uncomment the next line to enable the admin: # (r'^admin/(.*)', admin.site.root), (r'^$','spoken_tut.upload.views.upload_file'), - (r'^download/$','spoken_tut.upload.views.file_archive'), + (r'^submission/$','spoken_tut.upload.views.submission'), (r'^(?P.*)$', 'django.views.static.serve', {'document_root': settings.MEDIA_ROOT}), )