From b485a13da3d1b41b9f9c83103b6e9e9299172a60 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 25 Jun 2013 11:36:14 +0200 Subject: [PATCH 01/51] Changed to string formatting and spacing around = - Changed string formatting in views.py and form.py - Removed spacing around = in registration.html and contact.html --- umonya/umonya/apps/main/forms.py | 8 ++++---- umonya/umonya/apps/main/views.py | 2 +- umonya/umonya/templates/contact.html | 2 +- umonya/umonya/templates/registration.html | 10 ++++++---- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/umonya/umonya/apps/main/forms.py b/umonya/umonya/apps/main/forms.py index 43783e1..e39c1ff 100644 --- a/umonya/umonya/apps/main/forms.py +++ b/umonya/umonya/apps/main/forms.py @@ -21,10 +21,10 @@ class RegistrationForm(forms.Form): required: "", "type": "email"})) elif item.field_type == "IntegerField": - vars()[item.name] = forms.IntegerField(label=item.text, - required=item.required, - widget=forms.TextInput(attrs={"class": required + - "digits", required: ""})) + vars()[item.name] = forms.CharField(label=item.text, + required=item.required, + widget=forms.TextInput(attrs={"class": "%s %s" % + (required, "digits"), required: ""})) elif item.field_type == "TextField": vars()[item.name] = forms.CharField(label=item.text, required=item.required, diff --git a/umonya/umonya/apps/main/views.py b/umonya/umonya/apps/main/views.py index 2a47cb6..47e3e67 100644 --- a/umonya/umonya/apps/main/views.py +++ b/umonya/umonya/apps/main/views.py @@ -139,7 +139,7 @@ def send_email_f(f): subject = "User Registration" message = '' for item in f.cleaned_data: - message = message + item.upper() + "\n" + str(f.cleaned_data[item]) + "\n\n" + message = "%s %s \n %s \n\n" % (message, item.upper(), str(f.cleaned_data[item])) sender = "umonya@admin.com" recipients = ["umonya@admin.com"] if send_mail(subject, message, sender, recipients): diff --git a/umonya/umonya/templates/contact.html b/umonya/umonya/templates/contact.html index 182d221..26e553d 100644 --- a/umonya/umonya/templates/contact.html +++ b/umonya/umonya/templates/contact.html @@ -19,7 +19,7 @@

{% endif %} {% endfor %}
- +
diff --git a/umonya/umonya/templates/registration.html b/umonya/umonya/templates/registration.html index 3efbde2..7ae27f4 100644 --- a/umonya/umonya/templates/registration.html +++ b/umonya/umonya/templates/registration.html @@ -4,8 +4,10 @@ {% block content %} {% if section.enabled %}

REGISTRATION

-
-
{% csrf_token %} + +
+ + {% csrf_token %} {% for field in form %}
{{ field.label_tag }} @@ -18,8 +20,8 @@

REGISTRATION

{% endfor %} -
- +
+
From 9265a877cd56abc9de8878cc6ccbbae3107750a4 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Wed, 26 Jun 2013 11:18:30 +0200 Subject: [PATCH 02/51] Did Suggested change (Many changes Sorry Jonathan ) - Made digits css class in RegistrationForm one word - Made changes to html indenting in contact.html and registration.html - Made changes to send_email_f() in views to have a key, value paring --- umonya/umonya/apps/main/forms.py | 4 +- umonya/umonya/apps/main/views.py | 7 +- umonya/umonya/templates/contact.html | 57 +++++++------- umonya/umonya/templates/registration.html | 91 +++++++++++------------ 4 files changed, 77 insertions(+), 82 deletions(-) diff --git a/umonya/umonya/apps/main/forms.py b/umonya/umonya/apps/main/forms.py index e39c1ff..41b4392 100644 --- a/umonya/umonya/apps/main/forms.py +++ b/umonya/umonya/apps/main/forms.py @@ -23,8 +23,8 @@ class RegistrationForm(forms.Form): elif item.field_type == "IntegerField": vars()[item.name] = forms.CharField(label=item.text, required=item.required, - widget=forms.TextInput(attrs={"class": "%s %s" % - (required, "digits"), required: ""})) + widget=forms.TextInput(attrs={"class": "digits", + required: ""})) elif item.field_type == "TextField": vars()[item.name] = forms.CharField(label=item.text, required=item.required, diff --git a/umonya/umonya/apps/main/views.py b/umonya/umonya/apps/main/views.py index 47e3e67..2829dd9 100644 --- a/umonya/umonya/apps/main/views.py +++ b/umonya/umonya/apps/main/views.py @@ -138,9 +138,12 @@ def send_email_f(f): from django.core.mail import send_mail subject = "User Registration" message = '' - for item in f.cleaned_data: - message = "%s %s \n %s \n\n" % (message, item.upper(), str(f.cleaned_data[item])) + + for key, value in f.cleaned_data.iteritems(): + message = "%s %s\n%s\n\n" % (message, key.upper(), str(value)) + sender = "umonya@admin.com" recipients = ["umonya@admin.com"] + if send_mail(subject, message, sender, recipients): return True diff --git a/umonya/umonya/templates/contact.html b/umonya/umonya/templates/contact.html index 26e553d..f36a0a4 100644 --- a/umonya/umonya/templates/contact.html +++ b/umonya/umonya/templates/contact.html @@ -1,35 +1,30 @@ {% extends "base.html" %} - {% block content %} - {% if success %} -

- Thank You we have recieved your response -

- - {% else %} -
-
{% csrf_token %} - {% for field in form %} - {{ field.label_tag }} - {{ field }} - {% if field.errors %} -
- {{ field.errors }} -
- {% endif %} - {% endfor %} -
- -
-
-
- - - +{% if success %} +

+ Thank You we have recieved your response +

+{% else %} +
+
{% csrf_token %} + {% for field in form %} + {{ field.label_tag }} + {{ field }} + {% if field.errors %} +
+ {{ field.errors }} +
{% endif %} - + {% endfor %} +
+ +
+
+
+ +{% endif %} {% endblock %} \ No newline at end of file diff --git a/umonya/umonya/templates/registration.html b/umonya/umonya/templates/registration.html index 7ae27f4..a991cda 100644 --- a/umonya/umonya/templates/registration.html +++ b/umonya/umonya/templates/registration.html @@ -1,51 +1,48 @@ {% extends "base.html" %} - - {% block content %} - {% if section.enabled %} -

REGISTRATION

- -
- -
{% csrf_token %} - {% for field in form %} -
- {{ field.label_tag }} - {{ field }} - {% if field.errors %} -
- {{ field.errors }} -
- {% endif %} -
- {% endfor %} - -
- -
-
- - - -
- - {% elif success %} -

- Thank you, we have recieved your application. -

- - {% else %} -

- Sorry but the registration has closed. -

- {% endif %} + }); + + +
+{% elif success %} +

+ Thank you, we have recieved your application. +

+{% else %} +

+ Sorry but the registration has closed. +

+{% endif %} {% endblock %} \ No newline at end of file From 3304a5f69001ac586f2335d15420632c9fc96c1a Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 9 Jul 2013 11:29:12 +0200 Subject: [PATCH 03/51] Adding captcha --- umonya/umonya/apps/main/forms.py | 3 +++ umonya/umonya/apps/main/urls.py | 1 + umonya/umonya/settings.py | 4 ++++ 3 files changed, 8 insertions(+) diff --git a/umonya/umonya/apps/main/forms.py b/umonya/umonya/apps/main/forms.py index 41b4392..682357e 100644 --- a/umonya/umonya/apps/main/forms.py +++ b/umonya/umonya/apps/main/forms.py @@ -1,5 +1,6 @@ from django import forms from models import Registration +from captcha.fields import CaptchaField class RegistrationForm(forms.Form): @@ -43,3 +44,5 @@ class ContactForm(forms.Form): text = forms.CharField(label="Talk to us", widget=forms.Textarea(attrs={})) + + captcha = CaptchaField() diff --git a/umonya/umonya/apps/main/urls.py b/umonya/umonya/apps/main/urls.py index 956a9e5..a4fc174 100644 --- a/umonya/umonya/apps/main/urls.py +++ b/umonya/umonya/apps/main/urls.py @@ -11,4 +11,5 @@ url(r'^blog/$', 'umonya.apps.main.views.blog'), url(r'^announcements/page(?P\d+)$', 'umonya.apps.main.views.home'), url(r'^announcements/(?P\d+)(?P[^\.]+)$', 'umonya.apps.main.views.view_announcement'), + url(r'^captcha/', include('captcha.urls')), ) diff --git a/umonya/umonya/settings.py b/umonya/umonya/settings.py index a1c2b9b..7676229 100644 --- a/umonya/umonya/settings.py +++ b/umonya/umonya/settings.py @@ -137,6 +137,7 @@ 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.admin', + 'captcha' # Uncomment the next line to enable admin documentation: # 'django.contrib.admindocs', ) @@ -183,3 +184,6 @@ # For development only if no mail server is present logs mail to console EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" + +# CAPTCHA STUFF +CAPTCHA_CHALLENGE_FUNCT = 'captcha.helpers.random_char_challenge' From aaa27718bf5bd60e52fd54b72d0efc8563b3b7b5 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 9 Jul 2013 12:52:15 +0200 Subject: [PATCH 04/51] Added django-recaptcha and updated requirements --- umonya/requirements.txt | 1 + umonya/umonya/settings.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/umonya/requirements.txt b/umonya/requirements.txt index 010d8be..03ce258 100644 --- a/umonya/requirements.txt +++ b/umonya/requirements.txt @@ -1,4 +1,5 @@ Django==1.5.1 +django-recaptcha==0.0.6 Pillow-PIL gdata==2.0.18 httplib2==0.8 diff --git a/umonya/umonya/settings.py b/umonya/umonya/settings.py index 7676229..44efb2b 100644 --- a/umonya/umonya/settings.py +++ b/umonya/umonya/settings.py @@ -186,4 +186,5 @@ EMAIL_BACKEND = "django.core.mail.backends.console.EmailBackend" # CAPTCHA STUFF -CAPTCHA_CHALLENGE_FUNCT = 'captcha.helpers.random_char_challenge' +RECAPTCHA_PUBLIC_KEY = "6Le5IuQSAAAAAGeTlu2uuj2AcOG-1eDB-qdtz8Xf" +RECAPTCHA_PRIVATE_KEY = "6Le5IuQSAAAAABqGjiSAhyEVgBM-X0xkJGpKrJCG" From f9262bd08e09be30b62e99ad3e0e187a78f5ea2d Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 9 Jul 2013 12:52:47 +0200 Subject: [PATCH 05/51] Added recapture to forms --- umonya/umonya/apps/main/forms.py | 7 +++++-- umonya/umonya/apps/main/urls.py | 3 +-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/umonya/umonya/apps/main/forms.py b/umonya/umonya/apps/main/forms.py index 682357e..0210c8f 100644 --- a/umonya/umonya/apps/main/forms.py +++ b/umonya/umonya/apps/main/forms.py @@ -1,6 +1,6 @@ from django import forms from models import Registration -from captcha.fields import CaptchaField +from captcha.fields import ReCaptchaField class RegistrationForm(forms.Form): @@ -45,4 +45,7 @@ class ContactForm(forms.Form): text = forms.CharField(label="Talk to us", widget=forms.Textarea(attrs={})) - captcha = CaptchaField() + captcha = ReCaptchaField( + public_key="6Le5IuQSAAAAAGeTlu2uuj2AcOG-1eDB-qdtz8Xf", + private_key="6Le5IuQSAAAAABqGjiSAhyEVgBM-X0xkJGpKrJCG" + ) diff --git a/umonya/umonya/apps/main/urls.py b/umonya/umonya/apps/main/urls.py index a4fc174..ba107c5 100644 --- a/umonya/umonya/apps/main/urls.py +++ b/umonya/umonya/apps/main/urls.py @@ -1,4 +1,4 @@ -from django.conf.urls import patterns, include, url +from django.conf.urls import patterns, url #~ Creating the App importable urlpatterns = patterns('', @@ -11,5 +11,4 @@ url(r'^blog/$', 'umonya.apps.main.views.blog'), url(r'^announcements/page(?P\d+)$', 'umonya.apps.main.views.home'), url(r'^announcements/(?P\d+)(?P[^\.]+)$', 'umonya.apps.main.views.view_announcement'), - url(r'^captcha/', include('captcha.urls')), ) From bb175fac5fba2f7040c1e9227e7a5e1a363fb58d Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 9 Jul 2013 12:56:16 +0200 Subject: [PATCH 06/51] Made indentation changes suggested by @ninas --- umonya/umonya/templates/contact.html | 48 ++++++++++++++-------------- 1 file changed, 24 insertions(+), 24 deletions(-) diff --git a/umonya/umonya/templates/contact.html b/umonya/umonya/templates/contact.html index f36a0a4..cc69182 100644 --- a/umonya/umonya/templates/contact.html +++ b/umonya/umonya/templates/contact.html @@ -1,30 +1,30 @@ {% extends "base.html" %} {% block content %} {% if success %} -

- Thank You we have recieved your response -

+

+ Thank You we have recieved your response +

{% else %} -
-
{% csrf_token %} - {% for field in form %} - {{ field.label_tag }} - {{ field }} - {% if field.errors %} -
- {{ field.errors }} -
- {% endif %} - {% endfor %} -
- -
-
-
- +
+
{% csrf_token %} + {% for field in form %} + {{ field.label_tag }} + {{ field }} + {% if field.errors %} +
+ {{ field.errors }} +
+ {% endif %} + {% endfor %} +
+ +
+
+
+ {% endif %} {% endblock %} \ No newline at end of file From 6f4c4784ba8631e7610477da694aa995c7c69a61 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 9 Jul 2013 12:58:31 +0200 Subject: [PATCH 07/51] Made changes suggested by @ninas --- umonya/umonya/templates/registration.html | 74 +++++++++++------------ 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/umonya/umonya/templates/registration.html b/umonya/umonya/templates/registration.html index a991cda..215502d 100644 --- a/umonya/umonya/templates/registration.html +++ b/umonya/umonya/templates/registration.html @@ -1,48 +1,48 @@ {% extends "base.html" %} {% block content %} {% if section.enabled %} -

- REGISTRATION -

-
+

+ REGISTRATION +

+
-
- {% csrf_token %} - {% for field in form %} -
- {{ field.label_tag }} {{ field }} - {% if field.errors %} -
- {{ field.errors }} -
- {% endif %} -
- {% endfor %} + + {% csrf_token %} + {% for field in form %} +
+ {{ field.label_tag }} {{ field }} + {% if field.errors %} +
+ {{ field.errors }} +
+ {% endif %} +
+ {% endfor %} -
- -
-
+
+ +
+ - + -
+
{% elif success %} -

- Thank you, we have recieved your application. -

+

+ Thank you, we have recieved your application. +

{% else %} -

- Sorry but the registration has closed. -

+

+ Sorry but the registration has closed. +

{% endif %} {% endblock %} \ No newline at end of file From 8de155505cc6af7294a6c736107b1c0b3ddeba81 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 9 Jul 2013 13:02:21 +0200 Subject: [PATCH 08/51] Moved javascript code to separate file --- umonya/umonya/static/js/umonya.js | 15 +++++++++++++++ umonya/umonya/templates/registration.html | 12 ------------ 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/umonya/umonya/static/js/umonya.js b/umonya/umonya/static/js/umonya.js index 665a502..1cc405a 100644 --- a/umonya/umonya/static/js/umonya.js +++ b/umonya/umonya/static/js/umonya.js @@ -17,4 +17,19 @@ $(function(){ $(this).parent().addClass('active'); } }); +}); + +/* Validating Registration Form */ +$().ready(function(){ + $("#registrationForm").validate() + $(".digits").validate({ + rules: { + digits: true, + } + }); +}); + +/* Validating Contact Form */ +$().ready(function(){ + $("#contactForm").validate() }); \ No newline at end of file diff --git a/umonya/umonya/templates/registration.html b/umonya/umonya/templates/registration.html index 215502d..0f78dd3 100644 --- a/umonya/umonya/templates/registration.html +++ b/umonya/umonya/templates/registration.html @@ -23,18 +23,6 @@

- - -
{% elif success %}

From 2712da1a9a5e289e11e869769328b31428ffd600 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Mon, 22 Jul 2013 12:07:55 +0200 Subject: [PATCH 09/51] Added google forms code to registration page --- umonya/umonya/templates/registration.html | 47 +++++++---------------- 1 file changed, 14 insertions(+), 33 deletions(-) diff --git a/umonya/umonya/templates/registration.html b/umonya/umonya/templates/registration.html index 0f78dd3..94d07ab 100644 --- a/umonya/umonya/templates/registration.html +++ b/umonya/umonya/templates/registration.html @@ -1,36 +1,17 @@ {% extends "base.html" %} -{% block content %} -{% if section.enabled %} -

- REGISTRATION -

-
+ {% block content %} + {% if section.enabled %} +

+ REGISTRATION +

+
-
- {% csrf_token %} - {% for field in form %} -
- {{ field.label_tag }} {{ field }} - {% if field.errors %} -
- {{ field.errors }} -
- {% endif %} -
- {% endfor %} - -
- -
-
-
-{% elif success %} -

- Thank you, we have recieved your application. -

-{% else %} -

- Sorry but the registration has closed. -

-{% endif %} + + +
+ {% else %} +

+ Sorry but the registration has closed. +

+ {% endif %} {% endblock %} \ No newline at end of file From 640dbce1801578af4fe43c737bd9f8ba3c957679 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Mon, 22 Jul 2013 12:08:12 +0200 Subject: [PATCH 10/51] deleted Registration Model --- umonya/umonya/apps/main/models.py | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/umonya/umonya/apps/main/models.py b/umonya/umonya/apps/main/models.py index b4bd3a2..ae55c72 100644 --- a/umonya/umonya/apps/main/models.py +++ b/umonya/umonya/apps/main/models.py @@ -79,23 +79,6 @@ def __unicode__(self): return self.page -class Registration(models.Model): - """ - Model that generates specific sections in the User Form - """ - TYPE_OF_Q = (("CharField", "CharField"), ("EmailField", "EmailField"), - ("IntegerField", "IntegerField"), ("TextField", "TextField")) - - name = models.CharField(max_length=200) - field_type = models.CharField(max_length=200, choices=TYPE_OF_Q) - text = models.CharField(max_length=200) - priority = models.IntegerField() - required = models.BooleanField() - - def __unicode__(self): - return self.name - - class Dynamic_Section(models.Model): """ Sections that can be enabled or disabled by admin such From 9eceb0c249bfb91f7b5cac79257e9625f6d21aee Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Mon, 22 Jul 2013 12:08:24 +0200 Subject: [PATCH 11/51] Removed registration from forms --- umonya/umonya/apps/main/forms.py | 31 ------------------------------- 1 file changed, 31 deletions(-) diff --git a/umonya/umonya/apps/main/forms.py b/umonya/umonya/apps/main/forms.py index 0210c8f..ccf2dad 100644 --- a/umonya/umonya/apps/main/forms.py +++ b/umonya/umonya/apps/main/forms.py @@ -1,38 +1,7 @@ from django import forms -from models import Registration from captcha.fields import ReCaptchaField -class RegistrationForm(forms.Form): - questions = Registration.objects.all().order_by("priority") - for item in questions: - required = "" - if item.required: - required = "required" - - if item.field_type == "CharField": - vars()[item.name] = forms.CharField(label=item.text, - required=item.required, - widget=forms.TextInput(attrs={"class": required, - required: ""})) - elif item.field_type == "EmailField": - vars()[item.name] = forms.EmailField(label=item.text, - required=item.required, - widget=forms.TextInput(attrs={"class": required, - required: "", - "type": "email"})) - elif item.field_type == "IntegerField": - vars()[item.name] = forms.CharField(label=item.text, - required=item.required, - widget=forms.TextInput(attrs={"class": "digits", - required: ""})) - elif item.field_type == "TextField": - vars()[item.name] = forms.CharField(label=item.text, - required=item.required, - widget=forms.Textarea(attrs={"class": required, - required: ""})) - - class ContactForm(forms.Form): required = "required" name = forms.CharField(label="Name", required=True, From 1c37b5d478c5165a6d52877c429470ecb0c45609 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Mon, 22 Jul 2013 12:08:33 +0200 Subject: [PATCH 12/51] Removed registration from admin --- umonya/umonya/apps/main/admin.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/umonya/umonya/apps/main/admin.py b/umonya/umonya/apps/main/admin.py index f032a91..7b00dfe 100644 --- a/umonya/umonya/apps/main/admin.py +++ b/umonya/umonya/apps/main/admin.py @@ -1,5 +1,5 @@ from django.contrib import admin -from models import Announcement, About, Page, Registration, Dynamic_Section +from models import Announcement, About, Page, Dynamic_Section #~ Ensuring that admin is aware of this class @@ -13,5 +13,4 @@ class AnnouncementAdmin(admin.ModelAdmin): admin.site.register(Announcement, AnnouncementAdmin) admin.site.register(About) admin.site.register(Page) -admin.site.register(Registration) admin.site.register(Dynamic_Section) From 263453fb5936d9f1c60d7c31085ba88208ebc135 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Mon, 22 Jul 2013 12:08:51 +0200 Subject: [PATCH 13/51] Edited Registration views rendering --- umonya/umonya/apps/main/views.py | 17 ++--------------- 1 file changed, 2 insertions(+), 15 deletions(-) diff --git a/umonya/umonya/apps/main/views.py b/umonya/umonya/apps/main/views.py index 2829dd9..0f7b984 100644 --- a/umonya/umonya/apps/main/views.py +++ b/umonya/umonya/apps/main/views.py @@ -1,10 +1,10 @@ from django.shortcuts import render_to_response, get_object_or_404 from models import About, Page, Dynamic_Section, Announcement -from forms import RegistrationForm, ContactForm -from django.http import HttpResponseRedirect +from forms import ContactForm from django.core.context_processors import csrf from django.template import RequestContext + def home(request, page_number=1): """ Renders the home.html view which is used as the index page i.e @@ -83,18 +83,6 @@ def resources(request): def registration(request): - if request.method == "POST": - f = RegistrationForm(request.POST) - - if f.is_valid(): - send_email_f(f) - success = {"success": "success"} - return render_to_response("registration.html", success, - context_instance=RequestContext(request)) - - else: - f = RegistrationForm() - try: section = Dynamic_Section.objects.get(section="registration") except Dynamic_Section.DoesNotExist: @@ -103,7 +91,6 @@ def registration(request): args = {} args.update(csrf(request)) args["section"] = section - args["form"] = f return render_to_response("registration.html", args, context_instance=RequestContext(request)) From 31ef7addb2e7d5b205547fd2ae7721d44b6371d1 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Mon, 22 Jul 2013 12:18:37 +0200 Subject: [PATCH 14/51] modifying the JS to account for registration --- umonya/umonya/static/js/umonya.js | 27 ++++++++------------------- 1 file changed, 8 insertions(+), 19 deletions(-) diff --git a/umonya/umonya/static/js/umonya.js b/umonya/umonya/static/js/umonya.js index 1cc405a..360512f 100644 --- a/umonya/umonya/static/js/umonya.js +++ b/umonya/umonya/static/js/umonya.js @@ -1,35 +1,24 @@ /* Adds .active class to the Menu Tabs for extra styling */ $(function(){ function stripTrailingSlash(str) { - if(str.substr(-1) == '/') { - return str.substr(0, str.length - 1); - } - return str; + if(str.substr(-1) == '/') { + return str.substr(0, str.length - 1); + } + return str; } var url = window.location.pathname; var activePage = stripTrailingSlash(url); $('.nav li a').each(function(){ - var currentPage = stripTrailingSlash($(this).attr('href')); + var currentPage = stripTrailingSlash($(this).attr('href')); - if (activePage == currentPage) { - $(this).parent().addClass('active'); - } + if (activePage == currentPage) { + $(this).parent().addClass('active'); + } }); }); -/* Validating Registration Form */ -$().ready(function(){ - $("#registrationForm").validate() - $(".digits").validate({ - rules: { - digits: true, - } - }); -}); - -/* Validating Contact Form */ $().ready(function(){ $("#contactForm").validate() }); \ No newline at end of file From ccc9e72161781055c1d2c5b0812fb45a633a801b Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Mon, 22 Jul 2013 12:20:52 +0200 Subject: [PATCH 15/51] modified json data for deleting registration --- umonya/umonya/apps/main/fixtures/main.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/umonya/umonya/apps/main/fixtures/main.json b/umonya/umonya/apps/main/fixtures/main.json index dbd96e9..41434dc 100644 --- a/umonya/umonya/apps/main/fixtures/main.json +++ b/umonya/umonya/apps/main/fixtures/main.json @@ -1 +1 @@ -[{"pk": 1, "model": "main.announcement", "fields": {"body": "Umonya will be having a course on 12-14 October 2012 wherewe will teach 100 High School children how to program in Python. It will be taking place during Cape Town's first ever Software week (http://www.softwareweek.co.za)\r\n\r\nIn association with Silicon Cape and Cape Peninsula University of Technology.\r\n\r\nApplications for the course can be submitted here.\r\nIf you would like to get involved, please contact us.", "title": "Upcoming Course in October!", "venue": "", "event_date": "2012-10-12T10:00:00Z", "pub_date": "2013-06-18", "slug": "Upcoming_Course_in_October!"}}, {"pk": 2, "model": "main.announcement", "fields": {"body": "Umonya is an official partner of PyconZa (http://za.pycon.org/) and has tickets available for Students to attend the conference.\r\n\r\nThis is an exciting opportunity as the conference will offer a wide variety of talks for everyone from novice to expert. \r\nUmonya students will be accompanied by a mentor who will at all times be available for questions and guidance, sothere will be no need for students to ever feel overwhelmed. \r\n\r\nIf you are interested, sign up for our course happening on 12 - 14 October and tell us you are also interested in the conference.\r\n\r\nPage 1 of 2", "title": "Umonya and PyconZA!", "venue": "PyconZA", "event_date": "2012-10-12T10:00:00Z", "pub_date": "2013-06-18", "slug": "Umonya_and_PyconZA!"}}, {"pk": 3, "model": "main.announcement", "fields": {"body": "We're all super excited about the course this weekend! Please take note that the venue is now set for UCT.\r\n\r\nPlease contact us if you have any inquiries about the weekend. Otherwise, see you there!", "title": "UCT confirmed as venue!", "venue": "UCT", "event_date": "2012-10-12T10:00:00Z", "pub_date": "2013-06-18", "slug": "UCT_confirmed_as_venue!"}}, {"pk": 4, "model": "main.announcement", "fields": {"body": "Umonya's second 3 day event is on the horizon. We will be hosting 50 High School children who are keen to learn to code. It will be taking place towards the end of March, although exact dates are yet to be finalized.\r\n\r\nOur first event was a great success and we are looking forward to an even better one this year. Read about our last event here.\r\n\r\nApplications for the course can be submitted here.\r\nIf you would like to get involved in any other way, please contact us.", "title": "Upcoming Course in March!", "venue": "", "event_date": "2013-04-05T10:00:00Z", "pub_date": "2013-06-18", "slug": "Upcoming_Course_in_March!"}}, {"pk": 5, "model": "main.announcement", "fields": {"body": "The new dates for the upcoming Umonya event are now set for 5-7 April. Spread the word and if you haven't yet, register now!\r\n\r\nIf you would like to stay up to date on everything Umonya, follow us on Twitter, Facebook and Google+", "title": "IMPORTANT: New Dates!", "venue": "", "event_date": "2013-04-05T10:00:00Z", "pub_date": "2013-06-18", "slug": "IMPORTANT:_New_Dates!"}}, {"pk": 6, "model": "main.announcement", "fields": {"body": "We're all set for next weekend's course. The venueis confirmed as Abbotts College in Century City.\r\n\r\nWe have sent out several emails to all applicants. If you haven't received anything, please let us know. info@umonya.com\r\nWe hope you're all as excited as we are. See you there!", "title": "April course all set!", "venue": "", "event_date": "2013-04-05T10:00:00Z", "pub_date": "2013-06-18", "slug": "April_course_all_set!"}}, {"pk": 1, "model": "main.about", "fields": {"bios": "Est tortor amet et! Parturient placerat porttitor urna est mid tortor turpis mattis montes ac ac augue auctor scelerisque tincidunt urna. Eu, augue, dolor, arcu tincidunt placerat mauris lacus hac magna velit proin et. Ac, enim? In turpis tortor lectus, enim lectus dictumst mus a ultricies mauris aenean. Aenean duis, sit turpis rhoncus etiam. Auctor auctor arcu! Amet porttitor porttitor, placerat velit sagittis lorem elementum, sed? Non sed a tincidunt et mus! Turpis lorem mauris nisi montes! Ac purus adipiscing cursus penatibus facilisis lorem nunc tristique enim nascetur ac habitasse, proin parturient? Vel odio rhoncus montes. Lorem a, elementum in.", "pub_date": "2013-06-11T18:39:54Z", "name": "Nina Schiff", "bios_photo": "img/pic/bios/1370975998_08_nina.jpg"}}, {"pk": 2, "model": "main.about", "fields": {"bios": "Tincidunt sagittis aliquet augue nunc porta augue! Augue nisi odio elit elit tristique, etiam, nunc natoque, ac urna elementum integer nec ac vut pulvinar integer. Mid ridiculus odio diam, nisi adipiscing! Tortor, et, ultrices augue augue tempor adipiscing elementum, dapibus porttitor porttitor ut? Enim velit nisi cras porta elit platea urna placerat? Et etiam dictumst egestas porttitor, dictumst, ac nec in in pid, nec turpis vel mid diam, placerat purus montes quis turpis, est a parturient, elit porta sagittis, sociis turpis pid scelerisque pulvinar urna cursus. Porttitor, nisi in sociis massa, nisi tristique placerat, odio porta mauris, elementum dignissim.", "pub_date": "2013-06-11T18:40:48Z", "name": "Lyndsay Lawrence", "bios_photo": "img/pic/bios/1370976050_61_BlankFemale.jpg"}}, {"pk": 3, "model": "main.about", "fields": {"bios": "Turpis? Sociis massa nascetur purus integer placerat eu cras, est dis auctor, et a eros, penatibus, massa? Pulvinar, nec, nisi parturient pid sit enim, amet lundium eu, pid dignissim enim et etiam nunc! Porttitor a turpis, urna turpis lacus, mid et dignissim integer, amet montes arcu vut! Quis tempor porta integer est urna risus scelerisque? Platea scelerisque nunc dapibus dictumst magna tincidunt a amet tincidunt ac non natoque pellentesque. Porttitor arcu lectus, tristique rhoncus lectus ac mus habitasse ac. Natoque arcu sociis montes ut? Tristique habitasse ac nunc augue, mid magnis cum tristique tortor. Turpis diam, pulvinar nec pid.", "pub_date": "2013-06-11T18:41:30Z", "name": "Rizmari Versfeld", "bios_photo": "img/pic/bios/1370976092_93_rizmari.png"}}, {"pk": 4, "model": "main.about", "fields": {"bios": "Diam odio turpis, tristique et rhoncus egestas rhoncus ut tincidunt placerat etiam, sed etiam. Nunc pulvinar ultricies urna, nunc proin pulvinar. Pulvinar et augue sociis nec est facilisis pid integer, nunc placerat, cursus massa, sociis sed lundium mauris pellentesque. Nisi vel turpis arcu, nascetur, sit porttitor platea pulvinar? Turpis placerat et parturient, purus facilisis pellentesque pid dictumst. Porttitor aliquam massa! Magnis lacus eros in, tincidunt mauris purus placerat! Ut sit penatibus in nec quis augue platea, pulvinar, lacus a augue elementum sociis in pid, adipiscing phasellus augue, adipiscing, turpis in dapibus augue in pulvinar aenean augue eros lectus diam diam.", "pub_date": "2013-06-11T18:42:12Z", "name": "Bradly Lawrence", "bios_photo": "img/pic/bios/1370976134_01_images.jpg"}}, {"pk": 1, "model": "main.page", "fields": {"content": "

Overview

\r\n\t\t
\r\n\t\t\t

\r\n\t\t\t\tThere are relatively few IT teachers in South Africa, where we face problems \r\n\t\t\t\tof low skills base in IT. With the many employment opportunities in the field, \r\n\t\t\t\tit is difficult to increase the pool. In addition, many existing IT teachers \r\n\t\t\t\tlack modern skills and training in Computer Science.\r\n\t\t\t

\r\n\t\t\t\r\n\t\t\t

\r\n\t\t\t\tUmonya is an initiative that primarily aims to expand the availability and \r\n\t\t\t\taccessibility of computer science in South Africa. Allowing children who would \r\n\t\t\t\tusually not have the opportunity, to discover and pursue an interest in computer \r\n\t\t\t\tscience and programming.\r\n\t\t\t

\r\n\t\t\r\n\t\t
\r\n\t\t

Objectives

\r\n\t\t
\r\n\t\t\r\n\t\t\t

\r\n\t\t\t\tUmonya's main objectives are to provide theoretic lectures and practical classes to \r\n\t\t\t\tteach high-school children how to program in Python as well as give them an environment \r\n\t\t\t\twhere they can be tutored and guided in their computer skills.\r\n\t\t\t

\r\n\t\t\t\r\n\t\t\t

\r\n\t\t\t\tUmonya will provide an online community where School children can teach themselves to program \r\n\t\t\t\tthrough a structured, easy to learn online course. It will provide forums and discussion groups \r\n\t\t\t\twhere they can freely seek help and guidance as well as find helpful information.\r\n\t\t\t

\r\n\t\t\t\r\n\t\t\t

\r\n\t\t\t\tUmonya's secondary objectives are to encourage children to enter the computer science field and educate \r\n\t\t\t\tthem in the importance and relevance of computers in today's world.\r\n\t\t\t

\r\n\t\t\r\n\t\t
\t\t\r\n\t\t

Why Python

\r\n\t\t
\r\n\t\t\r\n\t\t\t

\r\n\t\t\t\tPython is simple and emphasizes being explicit over implicit. It's open-source, has support locally and \r\n\t\t\t\ta strong, active and open online community. More than that, it's fun!\r\n\t\t\t

\r\n\t\t\t\r\n\t\t\t

\r\n\t\t\t\tFor a more thorough discussion, read our blog post.\r\n\t\t\t

", "page": "about"}}, {"pk": 1, "model": "main.registration", "fields": {"priority": 1, "field_type": "CharField", "required": true, "name": "name", "text": "Name"}}, {"pk": 2, "model": "main.registration", "fields": {"priority": 2, "field_type": "EmailField", "required": true, "name": "email", "text": "Email Address"}}, {"pk": 3, "model": "main.registration", "fields": {"priority": 3, "field_type": "CharField", "required": true, "name": "diet", "text": "Dietary Requirements"}}, {"pk": 4, "model": "main.registration", "fields": {"priority": 4, "field_type": "CharField", "required": false, "name": "phone", "text": "Phone Number"}}, {"pk": 5, "model": "main.registration", "fields": {"priority": 8, "field_type": "CharField", "required": false, "name": "t_shirt", "text": "What is your T-shirt size?"}}, {"pk": 6, "model": "main.registration", "fields": {"priority": 9, "field_type": "TextField", "required": false, "name": "heard", "text": "Where did you hear about us?"}}, {"pk": 7, "model": "main.registration", "fields": {"priority": 7, "field_type": "CharField", "required": false, "name": "age", "text": "What is your age?"}}, {"pk": 1, "model": "main.dynamic_section", "fields": {"section": "registration", "enabled": true}}, {"pk": 1, "model": "contenttypes.contenttype", "fields": {"model": "announcement", "name": "announcement", "app_label": "main"}}, {"pk": 2, "model": "contenttypes.contenttype", "fields": {"model": "about", "name": "about", "app_label": "main"}}, {"pk": 3, "model": "contenttypes.contenttype", "fields": {"model": "page", "name": "page", "app_label": "main"}}, {"pk": 4, "model": "contenttypes.contenttype", "fields": {"model": "registration", "name": "registration", "app_label": "main"}}, {"pk": 5, "model": "contenttypes.contenttype", "fields": {"model": "dynamic_section", "name": "dynamic_ section", "app_label": "main"}}, {"pk": 6, "model": "contenttypes.contenttype", "fields": {"model": "contact", "name": "contact", "app_label": "main"}}, {"pk": 7, "model": "contenttypes.contenttype", "fields": {"model": "permission", "name": "permission", "app_label": "auth"}}, {"pk": 8, "model": "contenttypes.contenttype", "fields": {"model": "group", "name": "group", "app_label": "auth"}}, {"pk": 9, "model": "contenttypes.contenttype", "fields": {"model": "user", "name": "user", "app_label": "auth"}}, {"pk": 10, "model": "contenttypes.contenttype", "fields": {"model": "contenttype", "name": "content type", "app_label": "contenttypes"}}, {"pk": 11, "model": "contenttypes.contenttype", "fields": {"model": "session", "name": "session", "app_label": "sessions"}}, {"pk": 12, "model": "contenttypes.contenttype", "fields": {"model": "site", "name": "site", "app_label": "sites"}}, {"pk": 13, "model": "contenttypes.contenttype", "fields": {"model": "logentry", "name": "log entry", "app_label": "admin"}}, {"pk": "vls1kjkg462qevyxi6zpb9xvnnjool0t", "model": "sessions.session", "fields": {"expire_date": "2013-07-04T10:12:30.230Z", "session_data": "NzEwYjBjOTU3NGYzNTY2YWY3ODkzNmU1ZDA2NTg1ZTU4MTE5NTliOTqAAn1xAShVEl9hdXRoX3VzZXJfYmFja2VuZHECVSlkamFuZ28uY29udHJpYi5hdXRoLmJhY2tlbmRzLk1vZGVsQmFja2VuZHEDVQ1fYXV0aF91c2VyX2lkcQRLAXUu"}}, {"pk": 1, "model": "sites.site", "fields": {"domain": "example.com", "name": "example.com"}}, {"pk": 1, "model": "auth.permission", "fields": {"codename": "add_announcement", "name": "Can add announcement", "content_type": 1}}, {"pk": 2, "model": "auth.permission", "fields": {"codename": "change_announcement", "name": "Can change announcement", "content_type": 1}}, {"pk": 3, "model": "auth.permission", "fields": {"codename": "delete_announcement", "name": "Can delete announcement", "content_type": 1}}, {"pk": 4, "model": "auth.permission", "fields": {"codename": "add_about", "name": "Can add about", "content_type": 2}}, {"pk": 5, "model": "auth.permission", "fields": {"codename": "change_about", "name": "Can change about", "content_type": 2}}, {"pk": 6, "model": "auth.permission", "fields": {"codename": "delete_about", "name": "Can delete about", "content_type": 2}}, {"pk": 7, "model": "auth.permission", "fields": {"codename": "add_page", "name": "Can add page", "content_type": 3}}, {"pk": 8, "model": "auth.permission", "fields": {"codename": "change_page", "name": "Can change page", "content_type": 3}}, {"pk": 9, "model": "auth.permission", "fields": {"codename": "delete_page", "name": "Can delete page", "content_type": 3}}, {"pk": 10, "model": "auth.permission", "fields": {"codename": "add_registration", "name": "Can add registration", "content_type": 4}}, {"pk": 11, "model": "auth.permission", "fields": {"codename": "change_registration", "name": "Can change registration", "content_type": 4}}, {"pk": 12, "model": "auth.permission", "fields": {"codename": "delete_registration", "name": "Can delete registration", "content_type": 4}}, {"pk": 13, "model": "auth.permission", "fields": {"codename": "add_dynamic_section", "name": "Can add dynamic_ section", "content_type": 5}}, {"pk": 14, "model": "auth.permission", "fields": {"codename": "change_dynamic_section", "name": "Can change dynamic_ section", "content_type": 5}}, {"pk": 15, "model": "auth.permission", "fields": {"codename": "delete_dynamic_section", "name": "Can delete dynamic_ section", "content_type": 5}}, {"pk": 16, "model": "auth.permission", "fields": {"codename": "add_contact", "name": "Can add contact", "content_type": 6}}, {"pk": 17, "model": "auth.permission", "fields": {"codename": "change_contact", "name": "Can change contact", "content_type": 6}}, {"pk": 18, "model": "auth.permission", "fields": {"codename": "delete_contact", "name": "Can delete contact", "content_type": 6}}, {"pk": 19, "model": "auth.permission", "fields": {"codename": "add_permission", "name": "Can add permission", "content_type": 7}}, {"pk": 20, "model": "auth.permission", "fields": {"codename": "change_permission", "name": "Can change permission", "content_type": 7}}, {"pk": 21, "model": "auth.permission", "fields": {"codename": "delete_permission", "name": "Can delete permission", "content_type": 7}}, {"pk": 22, "model": "auth.permission", "fields": {"codename": "add_group", "name": "Can add group", "content_type": 8}}, {"pk": 23, "model": "auth.permission", "fields": {"codename": "change_group", "name": "Can change group", "content_type": 8}}, {"pk": 24, "model": "auth.permission", "fields": {"codename": "delete_group", "name": "Can delete group", "content_type": 8}}, {"pk": 25, "model": "auth.permission", "fields": {"codename": "add_user", "name": "Can add user", "content_type": 9}}, {"pk": 26, "model": "auth.permission", "fields": {"codename": "change_user", "name": "Can change user", "content_type": 9}}, {"pk": 27, "model": "auth.permission", "fields": {"codename": "delete_user", "name": "Can delete user", "content_type": 9}}, {"pk": 28, "model": "auth.permission", "fields": {"codename": "add_contenttype", "name": "Can add content type", "content_type": 10}}, {"pk": 29, "model": "auth.permission", "fields": {"codename": "change_contenttype", "name": "Can change content type", "content_type": 10}}, {"pk": 30, "model": "auth.permission", "fields": {"codename": "delete_contenttype", "name": "Can delete content type", "content_type": 10}}, {"pk": 31, "model": "auth.permission", "fields": {"codename": "add_session", "name": "Can add session", "content_type": 11}}, {"pk": 32, "model": "auth.permission", "fields": {"codename": "change_session", "name": "Can change session", "content_type": 11}}, {"pk": 33, "model": "auth.permission", "fields": {"codename": "delete_session", "name": "Can delete session", "content_type": 11}}, {"pk": 34, "model": "auth.permission", "fields": {"codename": "add_site", "name": "Can add site", "content_type": 12}}, {"pk": 35, "model": "auth.permission", "fields": {"codename": "change_site", "name": "Can change site", "content_type": 12}}, {"pk": 36, "model": "auth.permission", "fields": {"codename": "delete_site", "name": "Can delete site", "content_type": 12}}, {"pk": 37, "model": "auth.permission", "fields": {"codename": "add_logentry", "name": "Can add log entry", "content_type": 13}}, {"pk": 38, "model": "auth.permission", "fields": {"codename": "change_logentry", "name": "Can change log entry", "content_type": 13}}, {"pk": 39, "model": "auth.permission", "fields": {"codename": "delete_logentry", "name": "Can delete log entry", "content_type": 13}}, {"pk": 1, "model": "auth.user", "fields": {"username": "umonya", "first_name": "", "last_name": "", "is_active": true, "is_superuser": true, "is_staff": true, "last_login": "2013-06-20T10:12:30.128Z", "groups": [], "user_permissions": [], "password": "pbkdf2_sha256$10000$brk9UZ2n0Sy1$dVxb6TN5sELt6sRVFKrNWxHn+J0f6KbEx5arkjvO1qQ=", "email": "", "date_joined": "2013-06-20T10:11:49.173Z"}}, {"pk": 1, "model": "admin.logentry", "fields": {"action_flag": 2, "action_time": "2013-06-21T08:43:54.204Z", "object_repr": "registration", "object_id": "1", "change_message": "Changed enabled.", "user": 1, "content_type": 5}}, {"pk": 2, "model": "admin.logentry", "fields": {"action_flag": 2, "action_time": "2013-06-21T12:20:45.371Z", "object_repr": "registration", "object_id": "1", "change_message": "Changed enabled.", "user": 1, "content_type": 5}}] +[{"pk": 1, "model": "main.announcement", "fields": {"body": "Umonya will be having a course on 12-14 October 2012 wherewe will teach 100 High School children how to program in Python. It will be taking place during Cape Town's first ever Software week (http://www.softwareweek.co.za)\r\n\r\nIn association with Silicon Cape and Cape Peninsula University of Technology.\r\n\r\nApplications for the course can be submitted here.\r\nIf you would like to get involved, please contact us.", "title": "Upcoming Course in October!", "venue": "", "event_date": "2012-10-12T10:00:00Z", "pub_date": "2013-06-18", "slug": "Upcoming_Course_in_October!"}}, {"pk": 2, "model": "main.announcement", "fields": {"body": "Umonya is an official partner of PyconZa (http://za.pycon.org/) and has tickets available for Students to attend the conference.\r\n\r\nThis is an exciting opportunity as the conference will offer a wide variety of talks for everyone from novice to expert. \r\nUmonya students will be accompanied by a mentor who will at all times be available for questions and guidance, sothere will be no need for students to ever feel overwhelmed. \r\n\r\nIf you are interested, sign up for our course happening on 12 - 14 October and tell us you are also interested in the conference.\r\n\r\nPage 1 of 2", "title": "Umonya and PyconZA!", "venue": "PyconZA", "event_date": "2012-10-12T10:00:00Z", "pub_date": "2013-06-18", "slug": "Umonya_and_PyconZA!"}}, {"pk": 3, "model": "main.announcement", "fields": {"body": "We're all super excited about the course this weekend! Please take note that the venue is now set for UCT.\r\n\r\nPlease contact us if you have any inquiries about the weekend. Otherwise, see you there!", "title": "UCT confirmed as venue!", "venue": "UCT", "event_date": "2012-10-12T10:00:00Z", "pub_date": "2013-06-18", "slug": "UCT_confirmed_as_venue!"}}, {"pk": 4, "model": "main.announcement", "fields": {"body": "Umonya's second 3 day event is on the horizon. We will be hosting 50 High School children who are keen to learn to code. It will be taking place towards the end of March, although exact dates are yet to be finalized.\r\n\r\nOur first event was a great success and we are looking forward to an even better one this year. Read about our last event here.\r\n\r\nApplications for the course can be submitted here.\r\nIf you would like to get involved in any other way, please contact us.", "title": "Upcoming Course in March!", "venue": "", "event_date": "2013-04-05T10:00:00Z", "pub_date": "2013-06-18", "slug": "Upcoming_Course_in_March!"}}, {"pk": 5, "model": "main.announcement", "fields": {"body": "The new dates for the upcoming Umonya event are now set for 5-7 April. Spread the word and if you haven't yet, register now!\r\n\r\nIf you would like to stay up to date on everything Umonya, follow us on Twitter, Facebook and Google+", "title": "IMPORTANT: New Dates!", "venue": "", "event_date": "2013-04-05T10:00:00Z", "pub_date": "2013-06-18", "slug": "IMPORTANT:_New_Dates!"}}, {"pk": 6, "model": "main.announcement", "fields": {"body": "We're all set for next weekend's course. The venueis confirmed as Abbotts College in Century City.\r\n\r\nWe have sent out several emails to all applicants. If you haven't received anything, please let us know. info@umonya.com\r\nWe hope you're all as excited as we are. See you there!", "title": "April course all set!", "venue": "", "event_date": "2013-04-05T10:00:00Z", "pub_date": "2013-06-18", "slug": "April_course_all_set!"}}, {"pk": 1, "model": "main.about", "fields": {"bios": "Est tortor amet et! Parturient placerat porttitor urna est mid tortor turpis mattis montes ac ac augue auctor scelerisque tincidunt urna. Eu, augue, dolor, arcu tincidunt placerat mauris lacus hac magna velit proin et. Ac, enim? In turpis tortor lectus, enim lectus dictumst mus a ultricies mauris aenean. Aenean duis, sit turpis rhoncus etiam. Auctor auctor arcu! Amet porttitor porttitor, placerat velit sagittis lorem elementum, sed? Non sed a tincidunt et mus! Turpis lorem mauris nisi montes! Ac purus adipiscing cursus penatibus facilisis lorem nunc tristique enim nascetur ac habitasse, proin parturient? Vel odio rhoncus montes. Lorem a, elementum in.", "pub_date": "2013-06-11T18:39:54Z", "name": "Nina Schiff", "bios_photo": "img/pic/bios/1370975998_08_nina.jpg"}}, {"pk": 2, "model": "main.about", "fields": {"bios": "Tincidunt sagittis aliquet augue nunc porta augue! Augue nisi odio elit elit tristique, etiam, nunc natoque, ac urna elementum integer nec ac vut pulvinar integer. Mid ridiculus odio diam, nisi adipiscing! Tortor, et, ultrices augue augue tempor adipiscing elementum, dapibus porttitor porttitor ut? Enim velit nisi cras porta elit platea urna placerat? Et etiam dictumst egestas porttitor, dictumst, ac nec in in pid, nec turpis vel mid diam, placerat purus montes quis turpis, est a parturient, elit porta sagittis, sociis turpis pid scelerisque pulvinar urna cursus. Porttitor, nisi in sociis massa, nisi tristique placerat, odio porta mauris, elementum dignissim.", "pub_date": "2013-06-11T18:40:48Z", "name": "Lyndsay Lawrence", "bios_photo": "img/pic/bios/1370976050_61_BlankFemale.jpg"}}, {"pk": 3, "model": "main.about", "fields": {"bios": "Turpis? Sociis massa nascetur purus integer placerat eu cras, est dis auctor, et a eros, penatibus, massa? Pulvinar, nec, nisi parturient pid sit enim, amet lundium eu, pid dignissim enim et etiam nunc! Porttitor a turpis, urna turpis lacus, mid et dignissim integer, amet montes arcu vut! Quis tempor porta integer est urna risus scelerisque? Platea scelerisque nunc dapibus dictumst magna tincidunt a amet tincidunt ac non natoque pellentesque. Porttitor arcu lectus, tristique rhoncus lectus ac mus habitasse ac. Natoque arcu sociis montes ut? Tristique habitasse ac nunc augue, mid magnis cum tristique tortor. Turpis diam, pulvinar nec pid.", "pub_date": "2013-06-11T18:41:30Z", "name": "Rizmari Versfeld", "bios_photo": "img/pic/bios/1370976092_93_rizmari.png"}}, {"pk": 4, "model": "main.about", "fields": {"bios": "Diam odio turpis, tristique et rhoncus egestas rhoncus ut tincidunt placerat etiam, sed etiam. Nunc pulvinar ultricies urna, nunc proin pulvinar. Pulvinar et augue sociis nec est facilisis pid integer, nunc placerat, cursus massa, sociis sed lundium mauris pellentesque. Nisi vel turpis arcu, nascetur, sit porttitor platea pulvinar? Turpis placerat et parturient, purus facilisis pellentesque pid dictumst. Porttitor aliquam massa! Magnis lacus eros in, tincidunt mauris purus placerat! Ut sit penatibus in nec quis augue platea, pulvinar, lacus a augue elementum sociis in pid, adipiscing phasellus augue, adipiscing, turpis in dapibus augue in pulvinar aenean augue eros lectus diam diam.", "pub_date": "2013-06-11T18:42:12Z", "name": "Bradly Lawrence", "bios_photo": "img/pic/bios/1370976134_01_images.jpg"}}, {"pk": 1, "model": "main.page", "fields": {"content": "

Overview

\r\n\t\t
\r\n\t\t\t

\r\n\t\t\t\tThere are relatively few IT teachers in South Africa, where we face problems \r\n\t\t\t\tof low skills base in IT. With the many employment opportunities in the field, \r\n\t\t\t\tit is difficult to increase the pool. In addition, many existing IT teachers \r\n\t\t\t\tlack modern skills and training in Computer Science.\r\n\t\t\t

\r\n\t\t\t\r\n\t\t\t

\r\n\t\t\t\tUmonya is an initiative that primarily aims to expand the availability and \r\n\t\t\t\taccessibility of computer science in South Africa. Allowing children who would \r\n\t\t\t\tusually not have the opportunity, to discover and pursue an interest in computer \r\n\t\t\t\tscience and programming.\r\n\t\t\t

\r\n\t\t\r\n\t\t
\r\n\t\t

Objectives

\r\n\t\t
\r\n\t\t\r\n\t\t\t

\r\n\t\t\t\tUmonya's main objectives are to provide theoretic lectures and practical classes to \r\n\t\t\t\tteach high-school children how to program in Python as well as give them an environment \r\n\t\t\t\twhere they can be tutored and guided in their computer skills.\r\n\t\t\t

\r\n\t\t\t\r\n\t\t\t

\r\n\t\t\t\tUmonya will provide an online community where School children can teach themselves to program \r\n\t\t\t\tthrough a structured, easy to learn online course. It will provide forums and discussion groups \r\n\t\t\t\twhere they can freely seek help and guidance as well as find helpful information.\r\n\t\t\t

\r\n\t\t\t\r\n\t\t\t

\r\n\t\t\t\tUmonya's secondary objectives are to encourage children to enter the computer science field and educate \r\n\t\t\t\tthem in the importance and relevance of computers in today's world.\r\n\t\t\t

\r\n\t\t\r\n\t\t
\t\t\r\n\t\t

Why Python

\r\n\t\t
\r\n\t\t\r\n\t\t\t

\r\n\t\t\t\tPython is simple and emphasizes being explicit over implicit. It's open-source, has support locally and \r\n\t\t\t\ta strong, active and open online community. More than that, it's fun!\r\n\t\t\t

\r\n\t\t\t\r\n\t\t\t

\r\n\t\t\t\tFor a more thorough discussion, read our blog post.\r\n\t\t\t

", "page": "about"}}, {"pk": 1, "model": "main.dynamic_section", "fields": {"section": "registration", "enabled": true}}, {"pk": 1, "model": "contenttypes.contenttype", "fields": {"model": "announcement", "name": "announcement", "app_label": "main"}}, {"pk": 2, "model": "contenttypes.contenttype", "fields": {"model": "about", "name": "about", "app_label": "main"}}, {"pk": 3, "model": "contenttypes.contenttype", "fields": {"model": "page", "name": "page", "app_label": "main"}}, {"pk": 4, "model": "contenttypes.contenttype", "fields": {"model": "registration", "name": "registration", "app_label": "main"}}, {"pk": 5, "model": "contenttypes.contenttype", "fields": {"model": "dynamic_section", "name": "dynamic_ section", "app_label": "main"}}, {"pk": 6, "model": "contenttypes.contenttype", "fields": {"model": "contact", "name": "contact", "app_label": "main"}}, {"pk": 7, "model": "contenttypes.contenttype", "fields": {"model": "permission", "name": "permission", "app_label": "auth"}}, {"pk": 8, "model": "contenttypes.contenttype", "fields": {"model": "group", "name": "group", "app_label": "auth"}}, {"pk": 9, "model": "contenttypes.contenttype", "fields": {"model": "user", "name": "user", "app_label": "auth"}}, {"pk": 10, "model": "contenttypes.contenttype", "fields": {"model": "contenttype", "name": "content type", "app_label": "contenttypes"}}, {"pk": 11, "model": "contenttypes.contenttype", "fields": {"model": "session", "name": "session", "app_label": "sessions"}}, {"pk": 12, "model": "contenttypes.contenttype", "fields": {"model": "site", "name": "site", "app_label": "sites"}}, {"pk": 13, "model": "contenttypes.contenttype", "fields": {"model": "logentry", "name": "log entry", "app_label": "admin"}}, {"pk": "vls1kjkg462qevyxi6zpb9xvnnjool0t", "model": "sessions.session", "fields": {"expire_date": "2013-07-04T10:12:30.230Z", "session_data": "NzEwYjBjOTU3NGYzNTY2YWY3ODkzNmU1ZDA2NTg1ZTU4MTE5NTliOTqAAn1xAShVEl9hdXRoX3VzZXJfYmFja2VuZHECVSlkamFuZ28uY29udHJpYi5hdXRoLmJhY2tlbmRzLk1vZGVsQmFja2VuZHEDVQ1fYXV0aF91c2VyX2lkcQRLAXUu"}}, {"pk": 1, "model": "sites.site", "fields": {"domain": "example.com", "name": "example.com"}}, {"pk": 1, "model": "auth.permission", "fields": {"codename": "add_announcement", "name": "Can add announcement", "content_type": 1}}, {"pk": 2, "model": "auth.permission", "fields": {"codename": "change_announcement", "name": "Can change announcement", "content_type": 1}}, {"pk": 3, "model": "auth.permission", "fields": {"codename": "delete_announcement", "name": "Can delete announcement", "content_type": 1}}, {"pk": 4, "model": "auth.permission", "fields": {"codename": "add_about", "name": "Can add about", "content_type": 2}}, {"pk": 5, "model": "auth.permission", "fields": {"codename": "change_about", "name": "Can change about", "content_type": 2}}, {"pk": 6, "model": "auth.permission", "fields": {"codename": "delete_about", "name": "Can delete about", "content_type": 2}}, {"pk": 7, "model": "auth.permission", "fields": {"codename": "add_page", "name": "Can add page", "content_type": 3}}, {"pk": 8, "model": "auth.permission", "fields": {"codename": "change_page", "name": "Can change page", "content_type": 3}}, {"pk": 9, "model": "auth.permission", "fields": {"codename": "delete_page", "name": "Can delete page", "content_type": 3}}, {"pk": 10, "model": "auth.permission", "fields": {"codename": "add_registration", "name": "Can add registration", "content_type": 4}}, {"pk": 11, "model": "auth.permission", "fields": {"codename": "change_registration", "name": "Can change registration", "content_type": 4}}, {"pk": 12, "model": "auth.permission", "fields": {"codename": "delete_registration", "name": "Can delete registration", "content_type": 4}}, {"pk": 13, "model": "auth.permission", "fields": {"codename": "add_dynamic_section", "name": "Can add dynamic_ section", "content_type": 5}}, {"pk": 14, "model": "auth.permission", "fields": {"codename": "change_dynamic_section", "name": "Can change dynamic_ section", "content_type": 5}}, {"pk": 15, "model": "auth.permission", "fields": {"codename": "delete_dynamic_section", "name": "Can delete dynamic_ section", "content_type": 5}}, {"pk": 16, "model": "auth.permission", "fields": {"codename": "add_contact", "name": "Can add contact", "content_type": 6}}, {"pk": 17, "model": "auth.permission", "fields": {"codename": "change_contact", "name": "Can change contact", "content_type": 6}}, {"pk": 18, "model": "auth.permission", "fields": {"codename": "delete_contact", "name": "Can delete contact", "content_type": 6}}, {"pk": 19, "model": "auth.permission", "fields": {"codename": "add_permission", "name": "Can add permission", "content_type": 7}}, {"pk": 20, "model": "auth.permission", "fields": {"codename": "change_permission", "name": "Can change permission", "content_type": 7}}, {"pk": 21, "model": "auth.permission", "fields": {"codename": "delete_permission", "name": "Can delete permission", "content_type": 7}}, {"pk": 22, "model": "auth.permission", "fields": {"codename": "add_group", "name": "Can add group", "content_type": 8}}, {"pk": 23, "model": "auth.permission", "fields": {"codename": "change_group", "name": "Can change group", "content_type": 8}}, {"pk": 24, "model": "auth.permission", "fields": {"codename": "delete_group", "name": "Can delete group", "content_type": 8}}, {"pk": 25, "model": "auth.permission", "fields": {"codename": "add_user", "name": "Can add user", "content_type": 9}}, {"pk": 26, "model": "auth.permission", "fields": {"codename": "change_user", "name": "Can change user", "content_type": 9}}, {"pk": 27, "model": "auth.permission", "fields": {"codename": "delete_user", "name": "Can delete user", "content_type": 9}}, {"pk": 28, "model": "auth.permission", "fields": {"codename": "add_contenttype", "name": "Can add content type", "content_type": 10}}, {"pk": 29, "model": "auth.permission", "fields": {"codename": "change_contenttype", "name": "Can change content type", "content_type": 10}}, {"pk": 30, "model": "auth.permission", "fields": {"codename": "delete_contenttype", "name": "Can delete content type", "content_type": 10}}, {"pk": 31, "model": "auth.permission", "fields": {"codename": "add_session", "name": "Can add session", "content_type": 11}}, {"pk": 32, "model": "auth.permission", "fields": {"codename": "change_session", "name": "Can change session", "content_type": 11}}, {"pk": 33, "model": "auth.permission", "fields": {"codename": "delete_session", "name": "Can delete session", "content_type": 11}}, {"pk": 34, "model": "auth.permission", "fields": {"codename": "add_site", "name": "Can add site", "content_type": 12}}, {"pk": 35, "model": "auth.permission", "fields": {"codename": "change_site", "name": "Can change site", "content_type": 12}}, {"pk": 36, "model": "auth.permission", "fields": {"codename": "delete_site", "name": "Can delete site", "content_type": 12}}, {"pk": 37, "model": "auth.permission", "fields": {"codename": "add_logentry", "name": "Can add log entry", "content_type": 13}}, {"pk": 38, "model": "auth.permission", "fields": {"codename": "change_logentry", "name": "Can change log entry", "content_type": 13}}, {"pk": 39, "model": "auth.permission", "fields": {"codename": "delete_logentry", "name": "Can delete log entry", "content_type": 13}}, {"pk": 1, "model": "auth.user", "fields": {"username": "umonya", "first_name": "", "last_name": "", "is_active": true, "is_superuser": true, "is_staff": true, "last_login": "2013-06-20T10:12:30.128Z", "groups": [], "user_permissions": [], "password": "pbkdf2_sha256$10000$brk9UZ2n0Sy1$dVxb6TN5sELt6sRVFKrNWxHn+J0f6KbEx5arkjvO1qQ=", "email": "", "date_joined": "2013-06-20T10:11:49.173Z"}}, {"pk": 1, "model": "admin.logentry", "fields": {"action_flag": 2, "action_time": "2013-06-21T08:43:54.204Z", "object_repr": "registration", "object_id": "1", "change_message": "Changed enabled.", "user": 1, "content_type": 5}}, {"pk": 2, "model": "admin.logentry", "fields": {"action_flag": 2, "action_time": "2013-06-21T12:20:45.371Z", "object_repr": "registration", "object_id": "1", "change_message": "Changed enabled.", "user": 1, "content_type": 5}}] From ae2ac92d48c7de56c33a18c430a57dbdc272ff69 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Mon, 22 Jul 2013 12:32:11 +0200 Subject: [PATCH 16/51] Modifying unittests. --- umonya/umonya/apps/main/tests/test_forms.py | 33 ++++----------------- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/umonya/umonya/apps/main/tests/test_forms.py b/umonya/umonya/apps/main/tests/test_forms.py index 6459016..f14ebc0 100644 --- a/umonya/umonya/apps/main/tests/test_forms.py +++ b/umonya/umonya/apps/main/tests/test_forms.py @@ -1,31 +1,9 @@ -from umonya.apps.main.forms import RegistrationForm, ContactForm +from umonya.apps.main.forms import ContactForm from django.test import TestCase -from umonya.apps.main.models import Registration, Dynamic_Section from umonya.apps.main.views import send_email_f class TestForms(TestCase): - """ - The tests below are failing, commenting them out for now - """ - # def test_form_rendering(self): - # Dynamic_Section.objects.create(section="registration", enabled=True) - # Registration.objects.create(name="name", field_type="CharField", text="What is Your Name?", priority=1, required=True) - # Registration.objects.create(name="age", field_type="IntegerField", text="How Old are you", priority=5, required=False) - # response = self.client.get("/registration/") - # self.assertTrue('form' in response.context) - # self.assertContains(response, "What is Your Name?") - - # def test_empty_registration_form(self): - # # Testing the processing of the registration form in the views functionRegistration_Question.objects.create(name="name", field_type="CharField", text="What is Your Name?", priority=1, required=True) - # Registration.objects.create(name="name", field_type="CharField", text="What is Your Name?", priority=1, required=True) - # Registration.objects.create(name="age", field_type="IntegerField", - # text="How Old are you", priority=5, required=False) - # data = {"name": "", "age": ""} - # form = RegistrationForm(data=data) - # self.assertEqual(form["name"].errors, [u'This field is required.']) - # self.assertEqual(form["age"].errors, [u'This field is required.']) - def test_contactform_good_fields(self): form_data = {"name": "Mark Gituma", "email": "Email@mail.com", "text": "Hello World"} form = ContactForm(data=form_data) @@ -46,7 +24,8 @@ def test_contactform_bad_fields(self): form = ContactForm(data=form_data) self.assertEqual(form["email"].errors, [u'Enter a valid email address.']) - def test_contact_form_post(self): - form_data = {"name": "Mark Gituma", "email": "Email@mail.com", "text": "Hello World"} - response = self.client.post("/contact/", form_data) - self.assertIn("success", response.context) + # Can't test this due to Captcha + # def test_contact_form_post(self): + # form_data = {"name": "Mark Gituma", "email": "Email@mail.com", "text": "Hello World"} + # response = self.client.post("/contact/", form_data) + # self.assertIn("success", response.context) From c005570ff9ea03f32dbd5bb818a3e1447ff4d0f9 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Mon, 22 Jul 2013 12:33:31 +0200 Subject: [PATCH 17/51] adding comma to captcha --- umonya/umonya/settings.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/umonya/umonya/settings.py b/umonya/umonya/settings.py index 44efb2b..e3c0aa8 100644 --- a/umonya/umonya/settings.py +++ b/umonya/umonya/settings.py @@ -137,7 +137,7 @@ 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.admin', - 'captcha' + 'captcha', # Uncomment the next line to enable admin documentation: # 'django.contrib.admindocs', ) From fab4eb4cf79cdd833aaaa52f84400b22150b794e Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Mon, 22 Jul 2013 12:34:35 +0200 Subject: [PATCH 18/51] adding comma to captcha --- umonya/umonya/templates/contact.html | 47 +++++++++++++--------------- 1 file changed, 21 insertions(+), 26 deletions(-) diff --git a/umonya/umonya/templates/contact.html b/umonya/umonya/templates/contact.html index cc69182..1676071 100644 --- a/umonya/umonya/templates/contact.html +++ b/umonya/umonya/templates/contact.html @@ -1,30 +1,25 @@ {% extends "base.html" %} {% block content %} -{% if success %} -

- Thank You we have recieved your response -

-{% else %} -
-
{% csrf_token %} - {% for field in form %} - {{ field.label_tag }} - {{ field }} - {% if field.errors %} -
- {{ field.errors }} + {% if success %} +

+ Thank You we have recieved your response +

+ {% else %} +
+ {% csrf_token %} + {% for field in form %} + {{ field.label_tag }} + {{ field }} + {% if field.errors %} +
+ {{ field.errors }} +
+ {% endif %} + {% endfor %} +
+
- {% endif %} - {% endfor %} -
- -
- -
- -{% endif %} + +
+ {% endif %} {% endblock %} \ No newline at end of file From ff7994b6c051d911e4705047114afc3b9915e079 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Mon, 22 Jul 2013 12:35:12 +0200 Subject: [PATCH 19/51] Removing captcha keys from form --- umonya/umonya/apps/main/forms.py | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/umonya/umonya/apps/main/forms.py b/umonya/umonya/apps/main/forms.py index ccf2dad..e58f20c 100644 --- a/umonya/umonya/apps/main/forms.py +++ b/umonya/umonya/apps/main/forms.py @@ -14,7 +14,4 @@ class ContactForm(forms.Form): text = forms.CharField(label="Talk to us", widget=forms.Textarea(attrs={})) - captcha = ReCaptchaField( - public_key="6Le5IuQSAAAAAGeTlu2uuj2AcOG-1eDB-qdtz8Xf", - private_key="6Le5IuQSAAAAABqGjiSAhyEVgBM-X0xkJGpKrJCG" - ) + captcha = ReCaptchaField() From ecae26106611e2383f9e5c1487e0ace506773ee5 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Mon, 22 Jul 2013 12:36:43 +0200 Subject: [PATCH 20/51] deleting str() from views --- umonya/umonya/apps/main/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/umonya/umonya/apps/main/views.py b/umonya/umonya/apps/main/views.py index 0f7b984..e5d95be 100644 --- a/umonya/umonya/apps/main/views.py +++ b/umonya/umonya/apps/main/views.py @@ -127,7 +127,7 @@ def send_email_f(f): message = '' for key, value in f.cleaned_data.iteritems(): - message = "%s %s\n%s\n\n" % (message, key.upper(), str(value)) + message = "%s %s\n%s\n\n" % (message, key.upper(), value) sender = "umonya@admin.com" recipients = ["umonya@admin.com"] From 85159dbfa851c8f00e62ae4c00dd87281bb856d6 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Mon, 22 Jul 2013 12:37:54 +0200 Subject: [PATCH 21/51] adding south to settings --- umonya/umonya/settings.py | 1 + 1 file changed, 1 insertion(+) diff --git a/umonya/umonya/settings.py b/umonya/umonya/settings.py index e3c0aa8..d64dce8 100644 --- a/umonya/umonya/settings.py +++ b/umonya/umonya/settings.py @@ -138,6 +138,7 @@ 'django.contrib.staticfiles', 'django.contrib.admin', 'captcha', + 'south', # Uncomment the next line to enable admin documentation: # 'django.contrib.admindocs', ) From 264c7fce110968310fe901f397da59793afe5cc0 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Mon, 22 Jul 2013 12:39:30 +0200 Subject: [PATCH 22/51] Added south migrations --- .../apps/main/migrations/0001_initial.py | 110 ++++++++++++++++++ 1 file changed, 110 insertions(+) create mode 100644 umonya/umonya/apps/main/migrations/0001_initial.py diff --git a/umonya/umonya/apps/main/migrations/0001_initial.py b/umonya/umonya/apps/main/migrations/0001_initial.py new file mode 100644 index 0000000..74b1530 --- /dev/null +++ b/umonya/umonya/apps/main/migrations/0001_initial.py @@ -0,0 +1,110 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Adding model 'Announcement' + db.create_table(u'main_announcement', ( + (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('title', self.gf('django.db.models.fields.CharField')(unique=True, max_length=200)), + ('body', self.gf('django.db.models.fields.TextField')()), + ('pub_date', self.gf('django.db.models.fields.DateField')(default=datetime.datetime(2013, 7, 22, 0, 0))), + ('event_date', self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(2013, 7, 22, 0, 0))), + ('venue', self.gf('django.db.models.fields.CharField')(max_length=300, blank=True)), + ('slug', self.gf('django.db.models.fields.SlugField')(max_length=50)), + )) + db.send_create_signal(u'main', ['Announcement']) + + # Adding model 'About' + db.create_table(u'main_about', ( + (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('name', self.gf('django.db.models.fields.CharField')(max_length=200)), + ('bios', self.gf('django.db.models.fields.TextField')()), + ('bios_photo', self.gf('django.db.models.fields.files.ImageField')(max_length=100, null=True, blank=True)), + ('pub_date', self.gf('django.db.models.fields.DateTimeField')()), + )) + db.send_create_signal(u'main', ['About']) + + # Adding model 'Page' + db.create_table(u'main_page', ( + (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('page', self.gf('django.db.models.fields.CharField')(max_length=200)), + ('content', self.gf('django.db.models.fields.TextField')()), + )) + db.send_create_signal(u'main', ['Page']) + + # Adding model 'Dynamic_Section' + db.create_table(u'main_dynamic_section', ( + (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('section', self.gf('django.db.models.fields.CharField')(max_length=200)), + ('enabled', self.gf('django.db.models.fields.BooleanField')(default=False)), + )) + db.send_create_signal(u'main', ['Dynamic_Section']) + + # Adding model 'Contact' + db.create_table(u'main_contact', ( + (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + )) + db.send_create_signal(u'main', ['Contact']) + + + def backwards(self, orm): + # Deleting model 'Announcement' + db.delete_table(u'main_announcement') + + # Deleting model 'About' + db.delete_table(u'main_about') + + # Deleting model 'Page' + db.delete_table(u'main_page') + + # Deleting model 'Dynamic_Section' + db.delete_table(u'main_dynamic_section') + + # Deleting model 'Contact' + db.delete_table(u'main_contact') + + + models = { + u'main.about': { + 'Meta': {'object_name': 'About'}, + 'bios': ('django.db.models.fields.TextField', [], {}), + 'bios_photo': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}), + 'pub_date': ('django.db.models.fields.DateTimeField', [], {}) + }, + u'main.announcement': { + 'Meta': {'ordering': "['-pub_date']", 'object_name': 'Announcement'}, + 'body': ('django.db.models.fields.TextField', [], {}), + 'event_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 7, 22, 0, 0)'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'pub_date': ('django.db.models.fields.DateField', [], {'default': 'datetime.datetime(2013, 7, 22, 0, 0)'}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), + 'title': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'}), + 'venue': ('django.db.models.fields.CharField', [], {'max_length': '300', 'blank': 'True'}) + }, + u'main.contact': { + 'Meta': {'object_name': 'Contact'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) + }, + u'main.dynamic_section': { + 'Meta': {'object_name': 'Dynamic_Section'}, + 'enabled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'section': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + u'main.page': { + 'Meta': {'object_name': 'Page'}, + 'content': ('django.db.models.fields.TextField', [], {}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'page': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + } + } + + complete_apps = ['main'] \ No newline at end of file From 1b2ae18e28bb662b222ef067dfebaf7efaeeefe5 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Mon, 22 Jul 2013 12:42:51 +0200 Subject: [PATCH 23/51] fixing typo in contact form --- umonya/umonya/templates/contact.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/umonya/umonya/templates/contact.html b/umonya/umonya/templates/contact.html index 1676071..d04789e 100644 --- a/umonya/umonya/templates/contact.html +++ b/umonya/umonya/templates/contact.html @@ -2,7 +2,7 @@ {% block content %} {% if success %}

- Thank You we have recieved your response + Thank You we have received your response

{% else %}
From 2ea5b36de0207e3d65f91006942cd81fdc4c8d9e Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Mon, 22 Jul 2013 18:49:02 +0200 Subject: [PATCH 24/51] Removed pub_date from About Model --- umonya/umonya/apps/main/models.py | 1 - 1 file changed, 1 deletion(-) diff --git a/umonya/umonya/apps/main/models.py b/umonya/umonya/apps/main/models.py index ae55c72..14bb6e2 100644 --- a/umonya/umonya/apps/main/models.py +++ b/umonya/umonya/apps/main/models.py @@ -61,7 +61,6 @@ class About(models.Model): bios = models.TextField() bios_photo = models.ImageField(upload_to=get_image_path, blank=True, null=True) - pub_date = models.DateTimeField("Date Published") def __unicode__(self): return self.name From a246a3a39411f15e8c53b8fc7885cc6484e80a61 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Mon, 22 Jul 2013 18:49:23 +0200 Subject: [PATCH 25/51] created fixture for updated about model --- umonya/umonya/apps/main/fixtures/main.json | 2 +- .../0002_auto__del_field_about_pub_date.py | 58 +++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 umonya/umonya/apps/main/migrations/0002_auto__del_field_about_pub_date.py diff --git a/umonya/umonya/apps/main/fixtures/main.json b/umonya/umonya/apps/main/fixtures/main.json index 41434dc..e5b0395 100644 --- a/umonya/umonya/apps/main/fixtures/main.json +++ b/umonya/umonya/apps/main/fixtures/main.json @@ -1 +1 @@ -[{"pk": 1, "model": "main.announcement", "fields": {"body": "Umonya will be having a course on 12-14 October 2012 wherewe will teach 100 High School children how to program in Python. It will be taking place during Cape Town's first ever Software week (http://www.softwareweek.co.za)\r\n\r\nIn association with Silicon Cape and Cape Peninsula University of Technology.\r\n\r\nApplications for the course can be submitted here.\r\nIf you would like to get involved, please contact us.", "title": "Upcoming Course in October!", "venue": "", "event_date": "2012-10-12T10:00:00Z", "pub_date": "2013-06-18", "slug": "Upcoming_Course_in_October!"}}, {"pk": 2, "model": "main.announcement", "fields": {"body": "Umonya is an official partner of PyconZa (http://za.pycon.org/) and has tickets available for Students to attend the conference.\r\n\r\nThis is an exciting opportunity as the conference will offer a wide variety of talks for everyone from novice to expert. \r\nUmonya students will be accompanied by a mentor who will at all times be available for questions and guidance, sothere will be no need for students to ever feel overwhelmed. \r\n\r\nIf you are interested, sign up for our course happening on 12 - 14 October and tell us you are also interested in the conference.\r\n\r\nPage 1 of 2", "title": "Umonya and PyconZA!", "venue": "PyconZA", "event_date": "2012-10-12T10:00:00Z", "pub_date": "2013-06-18", "slug": "Umonya_and_PyconZA!"}}, {"pk": 3, "model": "main.announcement", "fields": {"body": "We're all super excited about the course this weekend! Please take note that the venue is now set for UCT.\r\n\r\nPlease contact us if you have any inquiries about the weekend. Otherwise, see you there!", "title": "UCT confirmed as venue!", "venue": "UCT", "event_date": "2012-10-12T10:00:00Z", "pub_date": "2013-06-18", "slug": "UCT_confirmed_as_venue!"}}, {"pk": 4, "model": "main.announcement", "fields": {"body": "Umonya's second 3 day event is on the horizon. We will be hosting 50 High School children who are keen to learn to code. It will be taking place towards the end of March, although exact dates are yet to be finalized.\r\n\r\nOur first event was a great success and we are looking forward to an even better one this year. Read about our last event here.\r\n\r\nApplications for the course can be submitted here.\r\nIf you would like to get involved in any other way, please contact us.", "title": "Upcoming Course in March!", "venue": "", "event_date": "2013-04-05T10:00:00Z", "pub_date": "2013-06-18", "slug": "Upcoming_Course_in_March!"}}, {"pk": 5, "model": "main.announcement", "fields": {"body": "The new dates for the upcoming Umonya event are now set for 5-7 April. Spread the word and if you haven't yet, register now!\r\n\r\nIf you would like to stay up to date on everything Umonya, follow us on Twitter, Facebook and Google+", "title": "IMPORTANT: New Dates!", "venue": "", "event_date": "2013-04-05T10:00:00Z", "pub_date": "2013-06-18", "slug": "IMPORTANT:_New_Dates!"}}, {"pk": 6, "model": "main.announcement", "fields": {"body": "We're all set for next weekend's course. The venueis confirmed as Abbotts College in Century City.\r\n\r\nWe have sent out several emails to all applicants. If you haven't received anything, please let us know. info@umonya.com\r\nWe hope you're all as excited as we are. See you there!", "title": "April course all set!", "venue": "", "event_date": "2013-04-05T10:00:00Z", "pub_date": "2013-06-18", "slug": "April_course_all_set!"}}, {"pk": 1, "model": "main.about", "fields": {"bios": "Est tortor amet et! Parturient placerat porttitor urna est mid tortor turpis mattis montes ac ac augue auctor scelerisque tincidunt urna. Eu, augue, dolor, arcu tincidunt placerat mauris lacus hac magna velit proin et. Ac, enim? In turpis tortor lectus, enim lectus dictumst mus a ultricies mauris aenean. Aenean duis, sit turpis rhoncus etiam. Auctor auctor arcu! Amet porttitor porttitor, placerat velit sagittis lorem elementum, sed? Non sed a tincidunt et mus! Turpis lorem mauris nisi montes! Ac purus adipiscing cursus penatibus facilisis lorem nunc tristique enim nascetur ac habitasse, proin parturient? Vel odio rhoncus montes. Lorem a, elementum in.", "pub_date": "2013-06-11T18:39:54Z", "name": "Nina Schiff", "bios_photo": "img/pic/bios/1370975998_08_nina.jpg"}}, {"pk": 2, "model": "main.about", "fields": {"bios": "Tincidunt sagittis aliquet augue nunc porta augue! Augue nisi odio elit elit tristique, etiam, nunc natoque, ac urna elementum integer nec ac vut pulvinar integer. Mid ridiculus odio diam, nisi adipiscing! Tortor, et, ultrices augue augue tempor adipiscing elementum, dapibus porttitor porttitor ut? Enim velit nisi cras porta elit platea urna placerat? Et etiam dictumst egestas porttitor, dictumst, ac nec in in pid, nec turpis vel mid diam, placerat purus montes quis turpis, est a parturient, elit porta sagittis, sociis turpis pid scelerisque pulvinar urna cursus. Porttitor, nisi in sociis massa, nisi tristique placerat, odio porta mauris, elementum dignissim.", "pub_date": "2013-06-11T18:40:48Z", "name": "Lyndsay Lawrence", "bios_photo": "img/pic/bios/1370976050_61_BlankFemale.jpg"}}, {"pk": 3, "model": "main.about", "fields": {"bios": "Turpis? Sociis massa nascetur purus integer placerat eu cras, est dis auctor, et a eros, penatibus, massa? Pulvinar, nec, nisi parturient pid sit enim, amet lundium eu, pid dignissim enim et etiam nunc! Porttitor a turpis, urna turpis lacus, mid et dignissim integer, amet montes arcu vut! Quis tempor porta integer est urna risus scelerisque? Platea scelerisque nunc dapibus dictumst magna tincidunt a amet tincidunt ac non natoque pellentesque. Porttitor arcu lectus, tristique rhoncus lectus ac mus habitasse ac. Natoque arcu sociis montes ut? Tristique habitasse ac nunc augue, mid magnis cum tristique tortor. Turpis diam, pulvinar nec pid.", "pub_date": "2013-06-11T18:41:30Z", "name": "Rizmari Versfeld", "bios_photo": "img/pic/bios/1370976092_93_rizmari.png"}}, {"pk": 4, "model": "main.about", "fields": {"bios": "Diam odio turpis, tristique et rhoncus egestas rhoncus ut tincidunt placerat etiam, sed etiam. Nunc pulvinar ultricies urna, nunc proin pulvinar. Pulvinar et augue sociis nec est facilisis pid integer, nunc placerat, cursus massa, sociis sed lundium mauris pellentesque. Nisi vel turpis arcu, nascetur, sit porttitor platea pulvinar? Turpis placerat et parturient, purus facilisis pellentesque pid dictumst. Porttitor aliquam massa! Magnis lacus eros in, tincidunt mauris purus placerat! Ut sit penatibus in nec quis augue platea, pulvinar, lacus a augue elementum sociis in pid, adipiscing phasellus augue, adipiscing, turpis in dapibus augue in pulvinar aenean augue eros lectus diam diam.", "pub_date": "2013-06-11T18:42:12Z", "name": "Bradly Lawrence", "bios_photo": "img/pic/bios/1370976134_01_images.jpg"}}, {"pk": 1, "model": "main.page", "fields": {"content": "

Overview

\r\n\t\t
\r\n\t\t\t

\r\n\t\t\t\tThere are relatively few IT teachers in South Africa, where we face problems \r\n\t\t\t\tof low skills base in IT. With the many employment opportunities in the field, \r\n\t\t\t\tit is difficult to increase the pool. In addition, many existing IT teachers \r\n\t\t\t\tlack modern skills and training in Computer Science.\r\n\t\t\t

\r\n\t\t\t\r\n\t\t\t

\r\n\t\t\t\tUmonya is an initiative that primarily aims to expand the availability and \r\n\t\t\t\taccessibility of computer science in South Africa. Allowing children who would \r\n\t\t\t\tusually not have the opportunity, to discover and pursue an interest in computer \r\n\t\t\t\tscience and programming.\r\n\t\t\t

\r\n\t\t\r\n\t\t
\r\n\t\t

Objectives

\r\n\t\t
\r\n\t\t\r\n\t\t\t

\r\n\t\t\t\tUmonya's main objectives are to provide theoretic lectures and practical classes to \r\n\t\t\t\tteach high-school children how to program in Python as well as give them an environment \r\n\t\t\t\twhere they can be tutored and guided in their computer skills.\r\n\t\t\t

\r\n\t\t\t\r\n\t\t\t

\r\n\t\t\t\tUmonya will provide an online community where School children can teach themselves to program \r\n\t\t\t\tthrough a structured, easy to learn online course. It will provide forums and discussion groups \r\n\t\t\t\twhere they can freely seek help and guidance as well as find helpful information.\r\n\t\t\t

\r\n\t\t\t\r\n\t\t\t

\r\n\t\t\t\tUmonya's secondary objectives are to encourage children to enter the computer science field and educate \r\n\t\t\t\tthem in the importance and relevance of computers in today's world.\r\n\t\t\t

\r\n\t\t\r\n\t\t
\t\t\r\n\t\t

Why Python

\r\n\t\t
\r\n\t\t\r\n\t\t\t

\r\n\t\t\t\tPython is simple and emphasizes being explicit over implicit. It's open-source, has support locally and \r\n\t\t\t\ta strong, active and open online community. More than that, it's fun!\r\n\t\t\t

\r\n\t\t\t\r\n\t\t\t

\r\n\t\t\t\tFor a more thorough discussion, read our blog post.\r\n\t\t\t

", "page": "about"}}, {"pk": 1, "model": "main.dynamic_section", "fields": {"section": "registration", "enabled": true}}, {"pk": 1, "model": "contenttypes.contenttype", "fields": {"model": "announcement", "name": "announcement", "app_label": "main"}}, {"pk": 2, "model": "contenttypes.contenttype", "fields": {"model": "about", "name": "about", "app_label": "main"}}, {"pk": 3, "model": "contenttypes.contenttype", "fields": {"model": "page", "name": "page", "app_label": "main"}}, {"pk": 4, "model": "contenttypes.contenttype", "fields": {"model": "registration", "name": "registration", "app_label": "main"}}, {"pk": 5, "model": "contenttypes.contenttype", "fields": {"model": "dynamic_section", "name": "dynamic_ section", "app_label": "main"}}, {"pk": 6, "model": "contenttypes.contenttype", "fields": {"model": "contact", "name": "contact", "app_label": "main"}}, {"pk": 7, "model": "contenttypes.contenttype", "fields": {"model": "permission", "name": "permission", "app_label": "auth"}}, {"pk": 8, "model": "contenttypes.contenttype", "fields": {"model": "group", "name": "group", "app_label": "auth"}}, {"pk": 9, "model": "contenttypes.contenttype", "fields": {"model": "user", "name": "user", "app_label": "auth"}}, {"pk": 10, "model": "contenttypes.contenttype", "fields": {"model": "contenttype", "name": "content type", "app_label": "contenttypes"}}, {"pk": 11, "model": "contenttypes.contenttype", "fields": {"model": "session", "name": "session", "app_label": "sessions"}}, {"pk": 12, "model": "contenttypes.contenttype", "fields": {"model": "site", "name": "site", "app_label": "sites"}}, {"pk": 13, "model": "contenttypes.contenttype", "fields": {"model": "logentry", "name": "log entry", "app_label": "admin"}}, {"pk": "vls1kjkg462qevyxi6zpb9xvnnjool0t", "model": "sessions.session", "fields": {"expire_date": "2013-07-04T10:12:30.230Z", "session_data": "NzEwYjBjOTU3NGYzNTY2YWY3ODkzNmU1ZDA2NTg1ZTU4MTE5NTliOTqAAn1xAShVEl9hdXRoX3VzZXJfYmFja2VuZHECVSlkamFuZ28uY29udHJpYi5hdXRoLmJhY2tlbmRzLk1vZGVsQmFja2VuZHEDVQ1fYXV0aF91c2VyX2lkcQRLAXUu"}}, {"pk": 1, "model": "sites.site", "fields": {"domain": "example.com", "name": "example.com"}}, {"pk": 1, "model": "auth.permission", "fields": {"codename": "add_announcement", "name": "Can add announcement", "content_type": 1}}, {"pk": 2, "model": "auth.permission", "fields": {"codename": "change_announcement", "name": "Can change announcement", "content_type": 1}}, {"pk": 3, "model": "auth.permission", "fields": {"codename": "delete_announcement", "name": "Can delete announcement", "content_type": 1}}, {"pk": 4, "model": "auth.permission", "fields": {"codename": "add_about", "name": "Can add about", "content_type": 2}}, {"pk": 5, "model": "auth.permission", "fields": {"codename": "change_about", "name": "Can change about", "content_type": 2}}, {"pk": 6, "model": "auth.permission", "fields": {"codename": "delete_about", "name": "Can delete about", "content_type": 2}}, {"pk": 7, "model": "auth.permission", "fields": {"codename": "add_page", "name": "Can add page", "content_type": 3}}, {"pk": 8, "model": "auth.permission", "fields": {"codename": "change_page", "name": "Can change page", "content_type": 3}}, {"pk": 9, "model": "auth.permission", "fields": {"codename": "delete_page", "name": "Can delete page", "content_type": 3}}, {"pk": 10, "model": "auth.permission", "fields": {"codename": "add_registration", "name": "Can add registration", "content_type": 4}}, {"pk": 11, "model": "auth.permission", "fields": {"codename": "change_registration", "name": "Can change registration", "content_type": 4}}, {"pk": 12, "model": "auth.permission", "fields": {"codename": "delete_registration", "name": "Can delete registration", "content_type": 4}}, {"pk": 13, "model": "auth.permission", "fields": {"codename": "add_dynamic_section", "name": "Can add dynamic_ section", "content_type": 5}}, {"pk": 14, "model": "auth.permission", "fields": {"codename": "change_dynamic_section", "name": "Can change dynamic_ section", "content_type": 5}}, {"pk": 15, "model": "auth.permission", "fields": {"codename": "delete_dynamic_section", "name": "Can delete dynamic_ section", "content_type": 5}}, {"pk": 16, "model": "auth.permission", "fields": {"codename": "add_contact", "name": "Can add contact", "content_type": 6}}, {"pk": 17, "model": "auth.permission", "fields": {"codename": "change_contact", "name": "Can change contact", "content_type": 6}}, {"pk": 18, "model": "auth.permission", "fields": {"codename": "delete_contact", "name": "Can delete contact", "content_type": 6}}, {"pk": 19, "model": "auth.permission", "fields": {"codename": "add_permission", "name": "Can add permission", "content_type": 7}}, {"pk": 20, "model": "auth.permission", "fields": {"codename": "change_permission", "name": "Can change permission", "content_type": 7}}, {"pk": 21, "model": "auth.permission", "fields": {"codename": "delete_permission", "name": "Can delete permission", "content_type": 7}}, {"pk": 22, "model": "auth.permission", "fields": {"codename": "add_group", "name": "Can add group", "content_type": 8}}, {"pk": 23, "model": "auth.permission", "fields": {"codename": "change_group", "name": "Can change group", "content_type": 8}}, {"pk": 24, "model": "auth.permission", "fields": {"codename": "delete_group", "name": "Can delete group", "content_type": 8}}, {"pk": 25, "model": "auth.permission", "fields": {"codename": "add_user", "name": "Can add user", "content_type": 9}}, {"pk": 26, "model": "auth.permission", "fields": {"codename": "change_user", "name": "Can change user", "content_type": 9}}, {"pk": 27, "model": "auth.permission", "fields": {"codename": "delete_user", "name": "Can delete user", "content_type": 9}}, {"pk": 28, "model": "auth.permission", "fields": {"codename": "add_contenttype", "name": "Can add content type", "content_type": 10}}, {"pk": 29, "model": "auth.permission", "fields": {"codename": "change_contenttype", "name": "Can change content type", "content_type": 10}}, {"pk": 30, "model": "auth.permission", "fields": {"codename": "delete_contenttype", "name": "Can delete content type", "content_type": 10}}, {"pk": 31, "model": "auth.permission", "fields": {"codename": "add_session", "name": "Can add session", "content_type": 11}}, {"pk": 32, "model": "auth.permission", "fields": {"codename": "change_session", "name": "Can change session", "content_type": 11}}, {"pk": 33, "model": "auth.permission", "fields": {"codename": "delete_session", "name": "Can delete session", "content_type": 11}}, {"pk": 34, "model": "auth.permission", "fields": {"codename": "add_site", "name": "Can add site", "content_type": 12}}, {"pk": 35, "model": "auth.permission", "fields": {"codename": "change_site", "name": "Can change site", "content_type": 12}}, {"pk": 36, "model": "auth.permission", "fields": {"codename": "delete_site", "name": "Can delete site", "content_type": 12}}, {"pk": 37, "model": "auth.permission", "fields": {"codename": "add_logentry", "name": "Can add log entry", "content_type": 13}}, {"pk": 38, "model": "auth.permission", "fields": {"codename": "change_logentry", "name": "Can change log entry", "content_type": 13}}, {"pk": 39, "model": "auth.permission", "fields": {"codename": "delete_logentry", "name": "Can delete log entry", "content_type": 13}}, {"pk": 1, "model": "auth.user", "fields": {"username": "umonya", "first_name": "", "last_name": "", "is_active": true, "is_superuser": true, "is_staff": true, "last_login": "2013-06-20T10:12:30.128Z", "groups": [], "user_permissions": [], "password": "pbkdf2_sha256$10000$brk9UZ2n0Sy1$dVxb6TN5sELt6sRVFKrNWxHn+J0f6KbEx5arkjvO1qQ=", "email": "", "date_joined": "2013-06-20T10:11:49.173Z"}}, {"pk": 1, "model": "admin.logentry", "fields": {"action_flag": 2, "action_time": "2013-06-21T08:43:54.204Z", "object_repr": "registration", "object_id": "1", "change_message": "Changed enabled.", "user": 1, "content_type": 5}}, {"pk": 2, "model": "admin.logentry", "fields": {"action_flag": 2, "action_time": "2013-06-21T12:20:45.371Z", "object_repr": "registration", "object_id": "1", "change_message": "Changed enabled.", "user": 1, "content_type": 5}}] +[{"pk": 1, "model": "main.announcement", "fields": {"body": "Umonya will be having a course on 12-14 October 2012 wherewe will teach 100 High School children how to program in Python. It will be taking place during Cape Town's first ever Software week (http://www.softwareweek.co.za)\r\n\r\nIn association with Silicon Cape and Cape Peninsula University of Technology.\r\n\r\nApplications for the course can be submitted here.\r\nIf you would like to get involved, please contact us.", "title": "Upcoming Course in October!", "venue": "", "event_date": "2012-10-12T10:00:00Z", "pub_date": "2013-06-18", "slug": "Upcoming_Course_in_October!"}}, {"pk": 2, "model": "main.announcement", "fields": {"body": "Umonya is an official partner of PyconZa (http://za.pycon.org/) and has tickets available for Students to attend the conference.\r\n\r\nThis is an exciting opportunity as the conference will offer a wide variety of talks for everyone from novice to expert. \r\nUmonya students will be accompanied by a mentor who will at all times be available for questions and guidance, sothere will be no need for students to ever feel overwhelmed. \r\n\r\nIf you are interested, sign up for our course happening on 12 - 14 October and tell us you are also interested in the conference.\r\n\r\nPage 1 of 2", "title": "Umonya and PyconZA!", "venue": "PyconZA", "event_date": "2012-10-12T10:00:00Z", "pub_date": "2013-06-18", "slug": "Umonya_and_PyconZA!"}}, {"pk": 3, "model": "main.announcement", "fields": {"body": "We're all super excited about the course this weekend! Please take note that the venue is now set for UCT.\r\n\r\nPlease contact us if you have any inquiries about the weekend. Otherwise, see you there!", "title": "UCT confirmed as venue!", "venue": "UCT", "event_date": "2012-10-12T10:00:00Z", "pub_date": "2013-06-18", "slug": "UCT_confirmed_as_venue!"}}, {"pk": 4, "model": "main.announcement", "fields": {"body": "Umonya's second 3 day event is on the horizon. We will be hosting 50 High School children who are keen to learn to code. It will be taking place towards the end of March, although exact dates are yet to be finalized.\r\n\r\nOur first event was a great success and we are looking forward to an even better one this year. Read about our last event here.\r\n\r\nApplications for the course can be submitted here.\r\nIf you would like to get involved in any other way, please contact us.", "title": "Upcoming Course in March!", "venue": "", "event_date": "2013-04-05T10:00:00Z", "pub_date": "2013-06-18", "slug": "Upcoming_Course_in_March!"}}, {"pk": 5, "model": "main.announcement", "fields": {"body": "The new dates for the upcoming Umonya event are now set for 5-7 April. Spread the word and if you haven't yet, register now!\r\n\r\nIf you would like to stay up to date on everything Umonya, follow us on Twitter, Facebook and Google+", "title": "IMPORTANT: New Dates!", "venue": "", "event_date": "2013-04-05T10:00:00Z", "pub_date": "2013-06-18", "slug": "IMPORTANT:_New_Dates!"}}, {"pk": 6, "model": "main.announcement", "fields": {"body": "We're all set for next weekend's course. The venueis confirmed as Abbotts College in Century City.\r\n\r\nWe have sent out several emails to all applicants. If you haven't received anything, please let us know. info@umonya.com\r\nWe hope you're all as excited as we are. See you there!", "title": "April course all set!", "venue": "", "event_date": "2013-04-05T10:00:00Z", "pub_date": "2013-06-18", "slug": "April_course_all_set!"}}, {"pk": 1, "model": "main.about", "fields": {"bios": "Est tortor amet et! Parturient placerat porttitor urna est mid tortor turpis mattis montes ac ac augue auctor scelerisque tincidunt urna. Eu, augue, dolor, arcu tincidunt placerat mauris lacus hac magna velit proin et. Ac, enim? In turpis tortor lectus, enim lectus dictumst mus a ultricies mauris aenean. Aenean duis, sit turpis rhoncus etiam. Auctor auctor arcu! Amet porttitor porttitor, placerat velit sagittis lorem elementum, sed? Non sed a tincidunt et mus! Turpis lorem mauris nisi montes! Ac purus adipiscing cursus penatibus facilisis lorem nunc tristique enim nascetur ac habitasse, proin parturient? Vel odio rhoncus montes. Lorem a, elementum in.", "name": "Nina Schiff", "bios_photo": "img/pic/bios/1370975998_08_nina.jpg"}}, {"pk": 2, "model": "main.about", "fields": {"bios": "Tincidunt sagittis aliquet augue nunc porta augue! Augue nisi odio elit elit tristique, etiam, nunc natoque, ac urna elementum integer nec ac vut pulvinar integer. Mid ridiculus odio diam, nisi adipiscing! Tortor, et, ultrices augue augue tempor adipiscing elementum, dapibus porttitor porttitor ut? Enim velit nisi cras porta elit platea urna placerat? Et etiam dictumst egestas porttitor, dictumst, ac nec in in pid, nec turpis vel mid diam, placerat purus montes quis turpis, est a parturient, elit porta sagittis, sociis turpis pid scelerisque pulvinar urna cursus. Porttitor, nisi in sociis massa, nisi tristique placerat, odio porta mauris, elementum dignissim.", "name": "Lyndsay Lawrence", "bios_photo": "img/pic/bios/1370976050_61_BlankFemale.jpg"}}, {"pk": 3, "model": "main.about", "fields": {"bios": "Turpis? Sociis massa nascetur purus integer placerat eu cras, est dis auctor, et a eros, penatibus, massa? Pulvinar, nec, nisi parturient pid sit enim, amet lundium eu, pid dignissim enim et etiam nunc! Porttitor a turpis, urna turpis lacus, mid et dignissim integer, amet montes arcu vut! Quis tempor porta integer est urna risus scelerisque? Platea scelerisque nunc dapibus dictumst magna tincidunt a amet tincidunt ac non natoque pellentesque. Porttitor arcu lectus, tristique rhoncus lectus ac mus habitasse ac. Natoque arcu sociis montes ut? Tristique habitasse ac nunc augue, mid magnis cum tristique tortor. Turpis diam, pulvinar nec pid.", "name": "Rizmari Versfeld", "bios_photo": "img/pic/bios/1370976092_93_rizmari.png"}}, {"pk": 4, "model": "main.about", "fields": {"bios": "Diam odio turpis, tristique et rhoncus egestas rhoncus ut tincidunt placerat etiam, sed etiam. Nunc pulvinar ultricies urna, nunc proin pulvinar. Pulvinar et augue sociis nec est facilisis pid integer, nunc placerat, cursus massa, sociis sed lundium mauris pellentesque. Nisi vel turpis arcu, nascetur, sit porttitor platea pulvinar? Turpis placerat et parturient, purus facilisis pellentesque pid dictumst. Porttitor aliquam massa! Magnis lacus eros in, tincidunt mauris purus placerat! Ut sit penatibus in nec quis augue platea, pulvinar, lacus a augue elementum sociis in pid, adipiscing phasellus augue, adipiscing, turpis in dapibus augue in pulvinar aenean augue eros lectus diam diam.", "name": "Bradly Lawrence", "bios_photo": "img/pic/bios/1370976134_01_images.jpg"}}, {"pk": 1, "model": "main.page", "fields": {"content": "

Overview

\r\n\t\t
\r\n\t\t\t

\r\n\t\t\t\tThere are relatively few IT teachers in South Africa, where we face problems \r\n\t\t\t\tof low skills base in IT. With the many employment opportunities in the field, \r\n\t\t\t\tit is difficult to increase the pool. In addition, many existing IT teachers \r\n\t\t\t\tlack modern skills and training in Computer Science.\r\n\t\t\t

\r\n\t\t\t\r\n\t\t\t

\r\n\t\t\t\tUmonya is an initiative that primarily aims to expand the availability and \r\n\t\t\t\taccessibility of computer science in South Africa. Allowing children who would \r\n\t\t\t\tusually not have the opportunity, to discover and pursue an interest in computer \r\n\t\t\t\tscience and programming.\r\n\t\t\t

\r\n\t\t\r\n\t\t
\r\n\t\t

Objectives

\r\n\t\t
\r\n\t\t\r\n\t\t\t

\r\n\t\t\t\tUmonya's main objectives are to provide theoretic lectures and practical classes to \r\n\t\t\t\tteach high-school children how to program in Python as well as give them an environment \r\n\t\t\t\twhere they can be tutored and guided in their computer skills.\r\n\t\t\t

\r\n\t\t\t\r\n\t\t\t

\r\n\t\t\t\tUmonya will provide an online community where School children can teach themselves to program \r\n\t\t\t\tthrough a structured, easy to learn online course. It will provide forums and discussion groups \r\n\t\t\t\twhere they can freely seek help and guidance as well as find helpful information.\r\n\t\t\t

\r\n\t\t\t\r\n\t\t\t

\r\n\t\t\t\tUmonya's secondary objectives are to encourage children to enter the computer science field and educate \r\n\t\t\t\tthem in the importance and relevance of computers in today's world.\r\n\t\t\t

\r\n\t\t\r\n\t\t
\t\t\r\n\t\t

Why Python

\r\n\t\t
\r\n\t\t\r\n\t\t\t

\r\n\t\t\t\tPython is simple and emphasizes being explicit over implicit. It's open-source, has support locally and \r\n\t\t\t\ta strong, active and open online community. More than that, it's fun!\r\n\t\t\t

\r\n\t\t\t\r\n\t\t\t

\r\n\t\t\t\tFor a more thorough discussion, read our blog post.\r\n\t\t\t

", "page": "about"}}, {"pk": 1, "model": "main.dynamic_section", "fields": {"section": "registration", "enabled": true}}] \ No newline at end of file diff --git a/umonya/umonya/apps/main/migrations/0002_auto__del_field_about_pub_date.py b/umonya/umonya/apps/main/migrations/0002_auto__del_field_about_pub_date.py new file mode 100644 index 0000000..09f066a --- /dev/null +++ b/umonya/umonya/apps/main/migrations/0002_auto__del_field_about_pub_date.py @@ -0,0 +1,58 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Deleting field 'About.pub_date' + db.delete_column(u'main_about', 'pub_date') + + + def backwards(self, orm): + # Adding field 'About.pub_date' + db.add_column(u'main_about', 'pub_date', + self.gf('django.db.models.fields.DateTimeField')(default=datetime.datetime(2013, 7, 22, 0, 0)), + keep_default=False) + + + models = { + u'main.about': { + 'Meta': {'object_name': 'About'}, + 'bios': ('django.db.models.fields.TextField', [], {}), + 'bios_photo': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + u'main.announcement': { + 'Meta': {'ordering': "['-pub_date']", 'object_name': 'Announcement'}, + 'body': ('django.db.models.fields.TextField', [], {}), + 'event_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 7, 22, 0, 0)'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'pub_date': ('django.db.models.fields.DateField', [], {'default': 'datetime.datetime(2013, 7, 22, 0, 0)'}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), + 'title': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'}), + 'venue': ('django.db.models.fields.CharField', [], {'max_length': '300', 'blank': 'True'}) + }, + u'main.contact': { + 'Meta': {'object_name': 'Contact'}, + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) + }, + u'main.dynamic_section': { + 'Meta': {'object_name': 'Dynamic_Section'}, + 'enabled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'section': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + u'main.page': { + 'Meta': {'object_name': 'Page'}, + 'content': ('django.db.models.fields.TextField', [], {}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'page': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + } + } + + complete_apps = ['main'] \ No newline at end of file From 2af4e883902f8bbb60361d5a79613b9d4842ce77 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Mon, 22 Jul 2013 18:54:17 +0200 Subject: [PATCH 26/51] fixed splitting dict --- umonya/umonya/apps/main/views.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/umonya/umonya/apps/main/views.py b/umonya/umonya/apps/main/views.py index e5d95be..6e3a6dd 100644 --- a/umonya/umonya/apps/main/views.py +++ b/umonya/umonya/apps/main/views.py @@ -73,8 +73,7 @@ def custom_404(request, page_number, slug): def about(request): about = About.objects.all() page_content = Page.objects.all().filter(page="about") - return render_to_response("about.html", {'about': about, - "page_content": page_content}, + return render_to_response("about.html", {'about': about, "page_content": page_content}, context_instance=RequestContext(request)) From 83c782687616020b7f193560fc8ea60ab5989def Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Mon, 22 Jul 2013 18:57:26 +0200 Subject: [PATCH 27/51] updated unittests to delete pub_date --- umonya/umonya/apps/main/tests/test_page_rendering.py | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/umonya/umonya/apps/main/tests/test_page_rendering.py b/umonya/umonya/apps/main/tests/test_page_rendering.py index a9e0480..e254839 100644 --- a/umonya/umonya/apps/main/tests/test_page_rendering.py +++ b/umonya/umonya/apps/main/tests/test_page_rendering.py @@ -1,7 +1,5 @@ from django.test import TestCase from umonya.apps.main.models import About, Page, Dynamic_Section -import datetime -from django.utils.timezone import utc from django.core.urlresolvers import reverse @@ -59,9 +57,7 @@ def test_about_content(self): def test_about_bios(self): About.objects.create(name="Umonya Name", bios="Umonya Bios", - bios_photo="path/2/Um/Photo.png", - pub_date=datetime.datetime.utcnow(). - replace(tzinfo=utc)) + bios_photo="path/2/Um/Photo.png") response = self.client.get("/about/") content = response.context['about'][0] From 6ba4158df2cb5affb6ed0e3e22d9bdee2965f819 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 23 Jul 2013 12:23:19 +0200 Subject: [PATCH 28/51] Updated requirements.txt to remove google api stuff --- umonya/requirements.txt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/umonya/requirements.txt b/umonya/requirements.txt index 03ce258..1bfc2a6 100644 --- a/umonya/requirements.txt +++ b/umonya/requirements.txt @@ -1,7 +1,4 @@ Django==1.5.1 django-recaptcha==0.0.6 -Pillow-PIL -gdata==2.0.18 -httplib2==0.8 -oauth2client==1.1 -python-gflags==2.0 +Pillow=2.0.0 +South==0.8.1 From 06600026e9cebedc532fff777eef1783385bae8e Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 23 Jul 2013 12:53:56 +0200 Subject: [PATCH 29/51] Added registration to models --- umonya/umonya/apps/main/models.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/umonya/umonya/apps/main/models.py b/umonya/umonya/apps/main/models.py index 14bb6e2..2d777e6 100644 --- a/umonya/umonya/apps/main/models.py +++ b/umonya/umonya/apps/main/models.py @@ -90,5 +90,11 @@ def __unicode__(self): return self.section -class Contact(models.Model): - pass +class Registration(models.Model): + """ + Specify the registration section via admin + """ + form_code = models.CharField(max_length=500) + + def __unicode__(self): + return self.form_code From bc72be1ee7ea6b32447cd94b1f96fd8b3033cf07 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 23 Jul 2013 12:54:04 +0200 Subject: [PATCH 30/51] added registration to admin --- umonya/umonya/apps/main/admin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/umonya/umonya/apps/main/admin.py b/umonya/umonya/apps/main/admin.py index 7b00dfe..0b3af9a 100644 --- a/umonya/umonya/apps/main/admin.py +++ b/umonya/umonya/apps/main/admin.py @@ -1,5 +1,5 @@ from django.contrib import admin -from models import Announcement, About, Page, Dynamic_Section +from models import Announcement, About, Page, Dynamic_Section, Registration #~ Ensuring that admin is aware of this class @@ -14,3 +14,4 @@ class AnnouncementAdmin(admin.ModelAdmin): admin.site.register(About) admin.site.register(Page) admin.site.register(Dynamic_Section) +admin.site.register(Registration) From 840c00ad88781328f743ef13e557f8ff480d04da Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 23 Jul 2013 12:54:13 +0200 Subject: [PATCH 31/51] added regsitration to views --- umonya/umonya/apps/main/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/umonya/umonya/apps/main/views.py b/umonya/umonya/apps/main/views.py index 6e3a6dd..f675f49 100644 --- a/umonya/umonya/apps/main/views.py +++ b/umonya/umonya/apps/main/views.py @@ -1,5 +1,5 @@ from django.shortcuts import render_to_response, get_object_or_404 -from models import About, Page, Dynamic_Section, Announcement +from models import About, Page, Dynamic_Section, Announcement, Registration from forms import ContactForm from django.core.context_processors import csrf from django.template import RequestContext @@ -87,8 +87,11 @@ def registration(request): except Dynamic_Section.DoesNotExist: section = False + registration = Registration.objects.all() + args = {} args.update(csrf(request)) + args['registration'] = registration[0] args["section"] = section return render_to_response("registration.html", args, From 56d55aeb44a3610a2ab28f30313b8e37ae9cd165 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 23 Jul 2013 12:54:32 +0200 Subject: [PATCH 32/51] added regstration to html --- umonya/umonya/templates/registration.html | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/umonya/umonya/templates/registration.html b/umonya/umonya/templates/registration.html index 94d07ab..528b5b3 100644 --- a/umonya/umonya/templates/registration.html +++ b/umonya/umonya/templates/registration.html @@ -5,9 +5,7 @@

REGISTRATION

- - - + {{ registration | safe}}
{% else %}

From ddb1d5131ac5ba9a8924795a16870c01a1a9fe0f Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 23 Jul 2013 12:54:40 +0200 Subject: [PATCH 33/51] did south migrations --- ...003_auto__del_contact__add_registration.py | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 umonya/umonya/apps/main/migrations/0003_auto__del_contact__add_registration.py diff --git a/umonya/umonya/apps/main/migrations/0003_auto__del_contact__add_registration.py b/umonya/umonya/apps/main/migrations/0003_auto__del_contact__add_registration.py new file mode 100644 index 0000000..6f7f5dd --- /dev/null +++ b/umonya/umonya/apps/main/migrations/0003_auto__del_contact__add_registration.py @@ -0,0 +1,70 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + # Deleting model 'Contact' + db.delete_table(u'main_contact') + + # Adding model 'Registration' + db.create_table(u'main_registration', ( + (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + ('form_code', self.gf('django.db.models.fields.CharField')(max_length=500)), + )) + db.send_create_signal(u'main', ['Registration']) + + + def backwards(self, orm): + # Adding model 'Contact' + db.create_table(u'main_contact', ( + (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)), + )) + db.send_create_signal(u'main', ['Contact']) + + # Deleting model 'Registration' + db.delete_table(u'main_registration') + + + models = { + u'main.about': { + 'Meta': {'object_name': 'About'}, + 'bios': ('django.db.models.fields.TextField', [], {}), + 'bios_photo': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + u'main.announcement': { + 'Meta': {'ordering': "['-pub_date']", 'object_name': 'Announcement'}, + 'body': ('django.db.models.fields.TextField', [], {}), + 'event_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 7, 23, 0, 0)'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'pub_date': ('django.db.models.fields.DateField', [], {'default': 'datetime.datetime(2013, 7, 23, 0, 0)'}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), + 'title': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'}), + 'venue': ('django.db.models.fields.CharField', [], {'max_length': '300', 'blank': 'True'}) + }, + u'main.dynamic_section': { + 'Meta': {'object_name': 'Dynamic_Section'}, + 'enabled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'section': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + u'main.page': { + 'Meta': {'object_name': 'Page'}, + 'content': ('django.db.models.fields.TextField', [], {}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'page': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + u'main.registration': { + 'Meta': {'object_name': 'Registration'}, + 'form_code': ('django.db.models.fields.CharField', [], {'max_length': '500'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) + } + } + + complete_apps = ['main'] \ No newline at end of file From 99e5e7ccd26c31c7bc94f97bf6cfb71301b2a0a8 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 23 Jul 2013 12:55:47 +0200 Subject: [PATCH 34/51] updated regsitration code for single dict obj --- umonya/umonya/apps/main/views.py | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/umonya/umonya/apps/main/views.py b/umonya/umonya/apps/main/views.py index f675f49..ce6b0c4 100644 --- a/umonya/umonya/apps/main/views.py +++ b/umonya/umonya/apps/main/views.py @@ -89,10 +89,8 @@ def registration(request): registration = Registration.objects.all() - args = {} + args = {"section": section, "registration": registration[0]} args.update(csrf(request)) - args['registration'] = registration[0] - args["section"] = section return render_to_response("registration.html", args, context_instance=RequestContext(request)) From 5e0d7c89328eaf83f52bb49c1572f85d3757f641 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 23 Jul 2013 12:57:24 +0200 Subject: [PATCH 35/51] updated the return e-mail function --- umonya/umonya/apps/main/views.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/umonya/umonya/apps/main/views.py b/umonya/umonya/apps/main/views.py index ce6b0c4..a5fe21e 100644 --- a/umonya/umonya/apps/main/views.py +++ b/umonya/umonya/apps/main/views.py @@ -132,5 +132,4 @@ def send_email_f(f): sender = "umonya@admin.com" recipients = ["umonya@admin.com"] - if send_mail(subject, message, sender, recipients): - return True + return send_mail(subject, message, sender, recipients) From a049b79f7d1b1e6ea92cf4dada1d714b22b5db06 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 23 Jul 2013 13:03:39 +0200 Subject: [PATCH 36/51] Changed grammatical errors in registration form --- umonya/umonya/templates/contact.html | 2 +- umonya/umonya/templates/registration.html | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/umonya/umonya/templates/contact.html b/umonya/umonya/templates/contact.html index d04789e..70cc767 100644 --- a/umonya/umonya/templates/contact.html +++ b/umonya/umonya/templates/contact.html @@ -2,7 +2,7 @@ {% block content %} {% if success %}

- Thank You we have received your response + Thank you, we have received your response

{% else %}
diff --git a/umonya/umonya/templates/registration.html b/umonya/umonya/templates/registration.html index 528b5b3..40cf3de 100644 --- a/umonya/umonya/templates/registration.html +++ b/umonya/umonya/templates/registration.html @@ -9,7 +9,7 @@

{% else %}

- Sorry but the registration has closed. + Sorry, registration has closed.

{% endif %} {% endblock %} \ No newline at end of file From 2c9e94fa7b8820cbea5cbd0bab41410c001307ac Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 23 Jul 2013 13:14:41 +0200 Subject: [PATCH 37/51] updating registration views to include Model --- umonya/umonya/apps/main/views.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/umonya/umonya/apps/main/views.py b/umonya/umonya/apps/main/views.py index a5fe21e..cc2352c 100644 --- a/umonya/umonya/apps/main/views.py +++ b/umonya/umonya/apps/main/views.py @@ -89,7 +89,10 @@ def registration(request): registration = Registration.objects.all() - args = {"section": section, "registration": registration[0]} + if len(registration) != 0: + registration = registration[0] + + args = {"section": section, "registration": registration} args.update(csrf(request)) return render_to_response("registration.html", args, From 352ff2958e880ff46fac51dfaff26d94d6ced84e Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 23 Jul 2013 13:14:56 +0200 Subject: [PATCH 38/51] Fixing registration views for failing unittests --- umonya/umonya/apps/main/tests/test_forms.py | 6 ------ umonya/umonya/apps/main/tests/test_page_rendering.py | 6 ++++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/umonya/umonya/apps/main/tests/test_forms.py b/umonya/umonya/apps/main/tests/test_forms.py index f14ebc0..6335737 100644 --- a/umonya/umonya/apps/main/tests/test_forms.py +++ b/umonya/umonya/apps/main/tests/test_forms.py @@ -23,9 +23,3 @@ def test_contactform_bad_fields(self): form_data = {"name": "", "email": "umonya", "text": ""} form = ContactForm(data=form_data) self.assertEqual(form["email"].errors, [u'Enter a valid email address.']) - - # Can't test this due to Captcha - # def test_contact_form_post(self): - # form_data = {"name": "Mark Gituma", "email": "Email@mail.com", "text": "Hello World"} - # response = self.client.post("/contact/", form_data) - # self.assertIn("success", response.context) diff --git a/umonya/umonya/apps/main/tests/test_page_rendering.py b/umonya/umonya/apps/main/tests/test_page_rendering.py index e254839..c14453f 100644 --- a/umonya/umonya/apps/main/tests/test_page_rendering.py +++ b/umonya/umonya/apps/main/tests/test_page_rendering.py @@ -1,5 +1,5 @@ from django.test import TestCase -from umonya.apps.main.models import About, Page, Dynamic_Section +from umonya.apps.main.models import About, Page, Dynamic_Section, Registration from django.core.urlresolvers import reverse @@ -23,6 +23,7 @@ def test_about(self): def test_registration(self): Dynamic_Section.objects.create(section="registration", enabled=True) + Registration.objects.create(form_code="") response = self.client.get("/registration/") self.assertEqual(response.status_code, 200) self.assertTemplateUsed(response, "registration.html") @@ -68,10 +69,11 @@ def test_about_bios(self): def test_registration_open(self): Dynamic_Section.objects.create(section="registration", enabled=True) + Registration.objects.create(form_code="") response = self.client.get("/registration/") self.assertTrue("section" in response.context) self.assertEqual(response.context["section"].enabled, True) - self.assertContains(response, "") + self.assertContains(response, "") self.assertNotContains(response, "registration has closed") def test_registration_closed(self): From eeb7ef513cd612cb348a4497b53c6473934fe594 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 23 Jul 2013 14:14:38 +0200 Subject: [PATCH 39/51] updating Pillow error in Requirements.txt --- umonya/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/umonya/requirements.txt b/umonya/requirements.txt index 1bfc2a6..b3561be 100644 --- a/umonya/requirements.txt +++ b/umonya/requirements.txt @@ -1,4 +1,4 @@ Django==1.5.1 django-recaptcha==0.0.6 -Pillow=2.0.0 +Pillow==2.0.0 South==0.8.1 From 6fcfb1650ce1552dc4f201ae0c7f0162dc0301d0 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 23 Jul 2013 14:19:45 +0200 Subject: [PATCH 40/51] modifying registration.html --- umonya/umonya/templates/contact.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/umonya/umonya/templates/contact.html b/umonya/umonya/templates/contact.html index 70cc767..dcd096f 100644 --- a/umonya/umonya/templates/contact.html +++ b/umonya/umonya/templates/contact.html @@ -2,7 +2,7 @@ {% block content %} {% if success %}

- Thank you, we have received your response + Thank you, we have received your response.

{% else %}
From 7daa53e0e9e9a1898298d77b3018339ab3d2e086 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 23 Jul 2013 14:24:11 +0200 Subject: [PATCH 41/51] added URL field to model and did south migration --- ..._auto__chg_field_registration_form_code.py | 57 +++++++++++++++++++ umonya/umonya/apps/main/models.py | 2 +- 2 files changed, 58 insertions(+), 1 deletion(-) create mode 100644 umonya/umonya/apps/main/migrations/0004_auto__chg_field_registration_form_code.py diff --git a/umonya/umonya/apps/main/migrations/0004_auto__chg_field_registration_form_code.py b/umonya/umonya/apps/main/migrations/0004_auto__chg_field_registration_form_code.py new file mode 100644 index 0000000..a9d5479 --- /dev/null +++ b/umonya/umonya/apps/main/migrations/0004_auto__chg_field_registration_form_code.py @@ -0,0 +1,57 @@ +# -*- coding: utf-8 -*- +import datetime +from south.db import db +from south.v2 import SchemaMigration +from django.db import models + + +class Migration(SchemaMigration): + + def forwards(self, orm): + + # Changing field 'Registration.form_code' + db.alter_column(u'main_registration', 'form_code', self.gf('django.db.models.fields.URLField')(max_length=500)) + + def backwards(self, orm): + + # Changing field 'Registration.form_code' + db.alter_column(u'main_registration', 'form_code', self.gf('django.db.models.fields.CharField')(max_length=500)) + + models = { + u'main.about': { + 'Meta': {'object_name': 'About'}, + 'bios': ('django.db.models.fields.TextField', [], {}), + 'bios_photo': ('django.db.models.fields.files.ImageField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'name': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + u'main.announcement': { + 'Meta': {'ordering': "['-pub_date']", 'object_name': 'Announcement'}, + 'body': ('django.db.models.fields.TextField', [], {}), + 'event_date': ('django.db.models.fields.DateTimeField', [], {'default': 'datetime.datetime(2013, 7, 23, 0, 0)'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'pub_date': ('django.db.models.fields.DateField', [], {'default': 'datetime.datetime(2013, 7, 23, 0, 0)'}), + 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50'}), + 'title': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '200'}), + 'venue': ('django.db.models.fields.CharField', [], {'max_length': '300', 'blank': 'True'}) + }, + u'main.dynamic_section': { + 'Meta': {'object_name': 'Dynamic_Section'}, + 'enabled': ('django.db.models.fields.BooleanField', [], {'default': 'False'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'section': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + u'main.page': { + 'Meta': {'object_name': 'Page'}, + 'content': ('django.db.models.fields.TextField', [], {}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}), + 'page': ('django.db.models.fields.CharField', [], {'max_length': '200'}) + }, + u'main.registration': { + 'Meta': {'object_name': 'Registration'}, + 'form_code': ('django.db.models.fields.URLField', [], {'max_length': '500'}), + u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}) + } + } + + complete_apps = ['main'] \ No newline at end of file diff --git a/umonya/umonya/apps/main/models.py b/umonya/umonya/apps/main/models.py index 2d777e6..9b6931e 100644 --- a/umonya/umonya/apps/main/models.py +++ b/umonya/umonya/apps/main/models.py @@ -94,7 +94,7 @@ class Registration(models.Model): """ Specify the registration section via admin """ - form_code = models.CharField(max_length=500) + form_code = models.URLField(max_length=500) def __unicode__(self): return self.form_code From 957ce99fe7e2c05b1183214f665edfeb0766a1c1 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 30 Jul 2013 22:26:43 +0200 Subject: [PATCH 42/51] having a single form.as_p field --- umonya/umonya/templates/contact.html | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/umonya/umonya/templates/contact.html b/umonya/umonya/templates/contact.html index dcd096f..777c1b9 100644 --- a/umonya/umonya/templates/contact.html +++ b/umonya/umonya/templates/contact.html @@ -7,15 +7,7 @@

{% else %}
{% csrf_token %} - {% for field in form %} - {{ field.label_tag }} - {{ field }} - {% if field.errors %} -
- {{ field.errors }} -
- {% endif %} - {% endfor %} + {{ form.as_p }}
From b7e6ff6aad965266459bd022ceea24495385fa58 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 30 Jul 2013 22:37:40 +0200 Subject: [PATCH 43/51] adding registration open context processor --- umonya/umonya/apps/main/context_processors.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/umonya/umonya/apps/main/context_processors.py b/umonya/umonya/apps/main/context_processors.py index ea81d02..457b5ab 100644 --- a/umonya/umonya/apps/main/context_processors.py +++ b/umonya/umonya/apps/main/context_processors.py @@ -1,7 +1,8 @@ def dynamic_menu(request): # Adds Dynamic Menu Template Context - from models import Dynamic_Section + from models import Registration try: - return{"registration": Dynamic_Section.objects.get(section="registration")} - except: - return {"registration": False} + Registration.objects.get(pk=1) + return{"registration_open": True} + except Registration.DoesNotExist: + return {"registration_open": False} From 3c5aa6e1c9f50770aa0c78245af25c93a909e461 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 30 Jul 2013 22:38:25 +0200 Subject: [PATCH 44/51] changing how registration open is being checked --- umonya/umonya/templates/base.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/umonya/umonya/templates/base.html b/umonya/umonya/templates/base.html index 4bf1fbf..9efd75c 100644 --- a/umonya/umonya/templates/base.html +++ b/umonya/umonya/templates/base.html @@ -46,7 +46,7 @@
  • About Us
  • - {% if registration.enabled %} + {% if registration_open %}
  • Registration Open
  • @@ -80,7 +80,6 @@ {%endblock%}
    -

    Latest Tweets

    From a1f6bd2c4426fb465947edf109d37d8f92f2d6f2 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 30 Jul 2013 22:44:35 +0200 Subject: [PATCH 45/51] removing dynamic section from models.py --- umonya/umonya/apps/main/models.py | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/umonya/umonya/apps/main/models.py b/umonya/umonya/apps/main/models.py index 9b6931e..13aeca3 100644 --- a/umonya/umonya/apps/main/models.py +++ b/umonya/umonya/apps/main/models.py @@ -78,18 +78,6 @@ def __unicode__(self): return self.page -class Dynamic_Section(models.Model): - """ - Sections that can be enabled or disabled by admin such - as registration form and menu - """ - section = models.CharField(max_length=200) - enabled = models.BooleanField() - - def __unicode__(self): - return self.section - - class Registration(models.Model): """ Specify the registration section via admin From 5b0ccd14207fc1e5ae3f7d0629e51a36620207b4 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 30 Jul 2013 22:44:49 +0200 Subject: [PATCH 46/51] changing how if registered is checked --- umonya/umonya/templates/registration.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/umonya/umonya/templates/registration.html b/umonya/umonya/templates/registration.html index 40cf3de..eecc687 100644 --- a/umonya/umonya/templates/registration.html +++ b/umonya/umonya/templates/registration.html @@ -1,6 +1,6 @@ {% extends "base.html" %} {% block content %} - {% if section.enabled %} + {% if registration %}

    REGISTRATION

    From a305470be02a943daa53202a81da37dcc0347b5d Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 30 Jul 2013 22:45:05 +0200 Subject: [PATCH 47/51] removing dynamic section from views.py --- umonya/umonya/apps/main/views.py | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/umonya/umonya/apps/main/views.py b/umonya/umonya/apps/main/views.py index cc2352c..1d670ef 100644 --- a/umonya/umonya/apps/main/views.py +++ b/umonya/umonya/apps/main/views.py @@ -1,5 +1,5 @@ from django.shortcuts import render_to_response, get_object_or_404 -from models import About, Page, Dynamic_Section, Announcement, Registration +from models import About, Page, Announcement, Registration from forms import ContactForm from django.core.context_processors import csrf from django.template import RequestContext @@ -82,17 +82,13 @@ def resources(request): def registration(request): - try: - section = Dynamic_Section.objects.get(section="registration") - except Dynamic_Section.DoesNotExist: - section = False - registration = Registration.objects.all() - - if len(registration) != 0: + if registration.exists(): registration = registration[0] + else: + registration = False - args = {"section": section, "registration": registration} + args = {"registration": registration} args.update(csrf(request)) return render_to_response("registration.html", args, From 85ca97f610323d39235c621420159c1732eb1d7f Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 30 Jul 2013 22:45:17 +0200 Subject: [PATCH 48/51] removing dynamic section from admin.py --- umonya/umonya/apps/main/admin.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/umonya/umonya/apps/main/admin.py b/umonya/umonya/apps/main/admin.py index 0b3af9a..0825629 100644 --- a/umonya/umonya/apps/main/admin.py +++ b/umonya/umonya/apps/main/admin.py @@ -1,5 +1,5 @@ from django.contrib import admin -from models import Announcement, About, Page, Dynamic_Section, Registration +from models import Announcement, About, Page, Registration #~ Ensuring that admin is aware of this class @@ -13,5 +13,4 @@ class AnnouncementAdmin(admin.ModelAdmin): admin.site.register(Announcement, AnnouncementAdmin) admin.site.register(About) admin.site.register(Page) -admin.site.register(Dynamic_Section) admin.site.register(Registration) From ecaf74eafe693d6cfa3fe5cf4a99719b1420b748 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 30 Jul 2013 22:45:57 +0200 Subject: [PATCH 49/51] changing URLField to CharField a form object is not a valid URL and therefore gives an error --- umonya/umonya/apps/main/models.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/umonya/umonya/apps/main/models.py b/umonya/umonya/apps/main/models.py index 13aeca3..2fbfae9 100644 --- a/umonya/umonya/apps/main/models.py +++ b/umonya/umonya/apps/main/models.py @@ -82,7 +82,7 @@ class Registration(models.Model): """ Specify the registration section via admin """ - form_code = models.URLField(max_length=500) + form_code = models.CharField(max_length=500) def __unicode__(self): return self.form_code From c384919c763061ab17135285d66bffc08ec67dbd Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Tue, 30 Jul 2013 22:52:38 +0200 Subject: [PATCH 50/51] updating unittests for dynamic section deletion --- .../umonya/apps/main/tests/test_page_rendering.py | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/umonya/umonya/apps/main/tests/test_page_rendering.py b/umonya/umonya/apps/main/tests/test_page_rendering.py index c14453f..6d23cc0 100644 --- a/umonya/umonya/apps/main/tests/test_page_rendering.py +++ b/umonya/umonya/apps/main/tests/test_page_rendering.py @@ -1,5 +1,5 @@ from django.test import TestCase -from umonya.apps.main.models import About, Page, Dynamic_Section, Registration +from umonya.apps.main.models import About, Page, Registration from django.core.urlresolvers import reverse @@ -22,7 +22,6 @@ def test_about(self): self.assertTemplateUsed(response, "about.html") def test_registration(self): - Dynamic_Section.objects.create(section="registration", enabled=True) Registration.objects.create(form_code="") response = self.client.get("/registration/") self.assertEqual(response.status_code, 200) @@ -68,19 +67,17 @@ def test_about_bios(self): self.assertEqual(content.bios_photo, "path/2/Um/Photo.png") def test_registration_open(self): - Dynamic_Section.objects.create(section="registration", enabled=True) Registration.objects.create(form_code="") response = self.client.get("/registration/") - self.assertTrue("section" in response.context) - self.assertEqual(response.context["section"].enabled, True) + self.assertTrue("registration_open" in response.context) + self.assertEqual(response.context["registration_open"], True) self.assertContains(response, "") self.assertNotContains(response, "registration has closed") def test_registration_closed(self): - Dynamic_Section.objects.create(section="registration", enabled=False) response = self.client.get("/registration/") - self.assertTrue("section" in response.context) - self.assertEqual(response.context["section"].enabled, False) + self.assertTrue("registration_open" in response.context) + self.assertEqual(response.context["registration_open"], False) self.assertNotContains(response, "") self.assertContains(response, "registration has closed") From 557fc56cc75961daeadce3b5f4cb618a8ef2f448 Mon Sep 17 00:00:00 2001 From: Mark Gituma Date: Fri, 2 Aug 2013 18:35:35 +0200 Subject: [PATCH 51/51] Changed False to None --- umonya/umonya/apps/main/views.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/umonya/umonya/apps/main/views.py b/umonya/umonya/apps/main/views.py index 1d670ef..d12d51b 100644 --- a/umonya/umonya/apps/main/views.py +++ b/umonya/umonya/apps/main/views.py @@ -86,7 +86,7 @@ def registration(request): if registration.exists(): registration = registration[0] else: - registration = False + registration = None args = {"registration": registration} args.update(csrf(request))