From 7dae6706e2047ce4a0a5c6f914b0c8fc230417cf Mon Sep 17 00:00:00 2001
From: Madhusudan.C.S
Date: Wed, 10 Nov 2010 07:02:57 +0530
Subject: Add a skeleton payment model.
--HG--
branch : payments
---
project/scipycon/registration/models.py | 14 ++++++++++++++
1 file changed, 14 insertions(+)
(limited to 'project')
diff --git a/project/scipycon/registration/models.py b/project/scipycon/registration/models.py
index 70e7d04..90a8599 100644
--- a/project/scipycon/registration/models.py
+++ b/project/scipycon/registration/models.py
@@ -31,6 +31,12 @@ SEX_CHOICES = (
('Other', 'Other')
)
+PAYMENT_MODE_CHOICES = (
+ (),
+ (),
+ ()
+ )
+
class Wifi(base_models.ScopedBase):
"""Defines wifi options at SciPy.in
"""
@@ -104,3 +110,11 @@ class Registration(base_models.ScopedBase):
return 'Registration for user: <%s %s> %s' % (
self.registrant.first_name,
self.registrant.last_name, self.registrant.email)
+
+
+class Payment(base_models.ScopedBase):
+ """Defines payment information for SciPy.in registrants
+ """
+
+ user = models.ForeignKey(User)
+
--
cgit
From 85d4bd4fb0fd0883466c71f8ab7982aa09679e52 Mon Sep 17 00:00:00 2001
From: Madhusudan.C.S
Date: Mon, 15 Nov 2010 14:02:40 +0530
Subject: Add type and detail fields for the payment model.
--HG--
branch : payments
---
project/scipycon/registration/models.py | 16 +++++++++++++---
1 file changed, 13 insertions(+), 3 deletions(-)
(limited to 'project')
diff --git a/project/scipycon/registration/models.py b/project/scipycon/registration/models.py
index 90a8599..2ab0752 100644
--- a/project/scipycon/registration/models.py
+++ b/project/scipycon/registration/models.py
@@ -32,9 +32,9 @@ SEX_CHOICES = (
)
PAYMENT_MODE_CHOICES = (
- (),
- (),
- ()
+ ('Cheque', 'Cheque'),
+ ('Demand Draft(DD)', 'Demand Draft(DD)'),
+ ('Net Banking', 'Net Banking')
)
class Wifi(base_models.ScopedBase):
@@ -118,3 +118,13 @@ class Payment(base_models.ScopedBase):
user = models.ForeignKey(User)
+ type = models.CharField(max_length=25, choices=PAYMENT_MODE_CHOICES,
+ verbose_name="Type", blank=True, null=True)
+
+ details = models.CharField(
+ max_length=255, verbose_name="Details",
+ help_text="If you made the payment using a cheque or a DD please "
+ "provide the number on the cheque or DD. If you made the payment "
+ "via Net Banking please provide the last four digits of the account "
+ "number and the name of the account holder from which the transfer "
+ "was made.", blank=True, null=True)
--
cgit
From 8771e65cd9232b134b77443d16b4a97e5ee586ba Mon Sep 17 00:00:00 2001
From: Madhusudan.C.S
Date: Mon, 15 Nov 2010 14:07:40 +0530
Subject: Change docstring for form classes form PyCON to SciPyCON.
--HG--
branch : payments
---
project/scipycon/registration/forms.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'project')
diff --git a/project/scipycon/registration/forms.py b/project/scipycon/registration/forms.py
index a646399..a241a8f 100644
--- a/project/scipycon/registration/forms.py
+++ b/project/scipycon/registration/forms.py
@@ -61,7 +61,7 @@ class RegistrationEditForm(RegistrationSubmitForm):
id = forms.CharField(widget=forms.HiddenInput)
class WifiForm(forms.ModelForm):
- """PyCon wifi form
+ """SciPyCon wifi form
"""
def save(self, user, scope):
@@ -81,7 +81,7 @@ class WifiForm(forms.ModelForm):
class AccommodationForm(forms.ModelForm):
- """PyCon Accommodation form
+ """SciPyCon Accommodation form
"""
def save(self, user, scope):
--
cgit
From dd41b2b834a771d9b22b0fecc19e66ad50d16730 Mon Sep 17 00:00:00 2001
From: Madhusudan.C.S
Date: Mon, 15 Nov 2010 14:59:13 +0530
Subject: Rename created variable name to acco_created for acco object creation
in edit registration view function.
--HG--
branch : payments
---
project/scipycon/registration/views.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
(limited to 'project')
diff --git a/project/scipycon/registration/views.py b/project/scipycon/registration/views.py
index 3e4de79..5a6e12c 100644
--- a/project/scipycon/registration/views.py
+++ b/project/scipycon/registration/views.py
@@ -62,8 +62,8 @@ def edit_registration(request, scope, id,
# TODO: This is an ugly hack to add accommodation form
# details at later stage for SciPy.in 2010. This must be
# removed for SciPy.in 2011
- acco, created = Accommodation.objects.get_or_create(user=reg.registrant,
- scope=scope_entity)
+ acco, acco_created = Accommodation.objects.get_or_create(
+ user=reg.registrant, scope=scope_entity)
if reg.registrant != request.user:
redirect_to = reverse('scipycon_account', kwargs={'scope': scope})
--
cgit
From 125069c0f25d4a4abc34ffadee70f0499581a571 Mon Sep 17 00:00:00 2001
From: Madhusudan.C.S
Date: Mon, 15 Nov 2010 14:59:46 +0530
Subject: Add paid boolean field to payment model to know whether the user has
already paid the fees or not.
--HG--
branch : payments
---
project/scipycon/registration/models.py | 4 ++++
1 file changed, 4 insertions(+)
(limited to 'project')
diff --git a/project/scipycon/registration/models.py b/project/scipycon/registration/models.py
index 2ab0752..77a6dae 100644
--- a/project/scipycon/registration/models.py
+++ b/project/scipycon/registration/models.py
@@ -118,6 +118,10 @@ class Payment(base_models.ScopedBase):
user = models.ForeignKey(User)
+ paid = models.BooleanField(
+ default=False, blank=True, verbose_name="Amount paid",
+ help_text="Check this box if you have already paid the fees.")
+
type = models.CharField(max_length=25, choices=PAYMENT_MODE_CHOICES,
verbose_name="Type", blank=True, null=True)
--
cgit
From 2f7ba659536bb4704e5f647fe3d5ab63aae4b3b6 Mon Sep 17 00:00:00 2001
From: Madhusudan.C.S
Date: Mon, 15 Nov 2010 15:00:16 +0530
Subject: Add a form for Payment and respective save and clean methods.
--HG--
branch : payments
---
project/scipycon/registration/forms.py | 44 ++++++++++++++++++++++++++++++++++
1 file changed, 44 insertions(+)
(limited to 'project')
diff --git a/project/scipycon/registration/forms.py b/project/scipycon/registration/forms.py
index a241a8f..fc9cb70 100644
--- a/project/scipycon/registration/forms.py
+++ b/project/scipycon/registration/forms.py
@@ -4,6 +4,7 @@ from django.core.exceptions import ObjectDoesNotExist
from project.scipycon.registration.models import SIZE_CHOICES
from project.scipycon.registration.models import OCCUPATION_CHOICES
from project.scipycon.registration.models import Accommodation
+from project.scipycon.registration.models import Payment
from project.scipycon.registration.models import Wifi
@@ -127,6 +128,49 @@ class AccommodationForm(forms.ModelForm):
fields = ('accommodation_required', 'sex', 'accommodation_days')
+class PaymentForm(forms.ModelForm):
+ """SciPyCon Payment form
+ """
+
+ def save(self, user, scope):
+ try:
+ payment = Payment.objects.get(user=user, scope=scope)
+ except ObjectDoesNotExist:
+ payment = Payment(user=user, scope=scope)
+
+ paid = self.cleaned_data['paid']
+ type = self.cleaned_data['type']
+ details = self.cleaned_data['details']
+
+ payment.paid = paid
+ payment.type = type
+ payment.details = details
+
+ payment.save()
+
+ return payment
+
+ def clean(self):
+ """Makes sure that payment form is correct, i.e. type and details
+ are filled in when the required fees is paid.
+ """
+
+ paid = self.cleaned_data['paid']
+ type = self.cleaned_data['type']
+ details = self.cleaned_data['details']
+
+ if paid and (not type or not details):
+ raise forms.ValidationError(
+ u"If you have already paid the fee it is mandatory to "
+ "fill in the type and mandatory fields.")
+
+ return super(PaymentForm, self).clean()
+
+ class Meta:
+ model = Payment
+ fields = ('paid', 'type', 'type')
+
+
PC = (
('all', 'all'),
('paid', 'paid'),
--
cgit
From e9adaedf5ef7d10cfbbb7db57593cdf63ff5eee2 Mon Sep 17 00:00:00 2001
From: Madhusudan.C.S
Date: Mon, 15 Nov 2010 15:00:35 +0530
Subject: Add a fieldset for payment details on the registration template.
--HG--
branch : payments
---
project/templates/registration/submit-registration.html | 7 +++++++
1 file changed, 7 insertions(+)
(limited to 'project')
diff --git a/project/templates/registration/submit-registration.html b/project/templates/registration/submit-registration.html
index 1124cd3..5cbe3ac 100644
--- a/project/templates/registration/submit-registration.html
+++ b/project/templates/registration/submit-registration.html
@@ -146,6 +146,13 @@
+
+