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 @@ +
+ Payment + + {{ payment_form }} +
+
+
Others -- cgit From a3307767a93c8d8c19bb83138ee8a5cfaacf5b84 Mon Sep 17 00:00:00 2001 From: Madhusudan.C.S Date: Mon, 15 Nov 2010 15:10:08 +0530 Subject: Add payment forms and object details in edit and submit registration views. --HG-- branch : payments --- project/scipycon/registration/views.py | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) (limited to 'project') diff --git a/project/scipycon/registration/views.py b/project/scipycon/registration/views.py index 5a6e12c..b38c791 100644 --- a/project/scipycon/registration/views.py +++ b/project/scipycon/registration/views.py @@ -12,8 +12,10 @@ from project.scipycon.base.models import Event from project.scipycon.registration.forms import RegistrationEditForm from project.scipycon.registration.forms import RegistrationSubmitForm from project.scipycon.registration.forms import AccommodationForm +from project.scipycon.registration.forms import PaymentForm from project.scipycon.registration.forms import WifiForm from project.scipycon.registration.models import Accommodation +from project.scipycon.registration.models import Payment from project.scipycon.registration.models import Registration from project.scipycon.registration.models import Wifi from project.scipycon.registration.utils import send_confirmation @@ -59,11 +61,13 @@ def edit_registration(request, scope, id, reg = Registration.objects.get(pk=id) wifi = Wifi.objects.get(user=reg.registrant) - # 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 + # TODO: This is an ugly hack to add accommodation and payment forms + # details at later stage for SciPy.in 2010. This must be removed for + # SciPy.in 2011 acco, acco_created = Accommodation.objects.get_or_create( user=reg.registrant, scope=scope_entity) + payment, payment_created = Payment.objects.get_or_create( + user=reg.registrant, scope=scope_entity) if reg.registrant != request.user: redirect_to = reverse('scipycon_account', kwargs={'scope': scope}) @@ -77,9 +81,10 @@ def edit_registration(request, scope, id, registration_form = RegistrationEditForm(data=request.POST) wifi_form = WifiForm(data=request.POST) acco_form = AccommodationForm(data=request.POST) + payment_form = PaymentForm(data=request.POST) if (registration_form.is_valid() and wifi_form.is_valid() and - acco_form.is_valid()): + acco_form.is_valid() and payment_form.is_valid()): reg.organisation = registration_form.data.get('organisation') reg.occupation = registration_form.data.get('occupation') reg.city = registration_form.data.get('city') @@ -98,6 +103,7 @@ def edit_registration(request, scope, id, wifi = wifi_form.save(reg.registrant, reg.scope) acco = acco_form.save(reg.registrant, reg.scope) + payment = payment_form.save(reg.registrant, reg.scope) # Saved.. redirect redirect_to = reverse('scipycon_account', kwargs={'scope': scope}) @@ -130,6 +136,13 @@ def edit_registration(request, scope, id, 'accommodation_required': acco.accommodation_required, 'accommodation_days': acco.accommodation_days, }) + payment_form = PaymentForm(initial={ + 'user': payment.user, + 'scope': payment.scope, + 'paid': payment.paid, + 'type': payment.type, + 'details': payment.details, + }) return render_to_response( template_name, RequestContext(request, { @@ -137,7 +150,8 @@ def edit_registration(request, scope, id, 'registration': {'id': id}, 'registration_form': registration_form, 'wifi_form': wifi_form, - 'acco_form': acco_form})) + 'acco_form': acco_form, + 'payment_form': payment_form})) def submit_registration(request, scope, template_name='registration/submit-registration.html'): @@ -175,6 +189,7 @@ def submit_registration(request, scope, registrant_form = RegistrantForm(data=request.POST) wifi_form = WifiForm(data=request.POST) acco_form = AccommodationForm(data=request.POST) + payment_form = PaymentForm(data=request.POST) if request.POST.get('action', None) == 'login': login_form = AuthenticationForm(data=request.POST) @@ -210,7 +225,7 @@ def submit_registration(request, scope, newuser = user if (registration_form.is_valid() and newuser and wifi_form.is_valid() - and acco_form.is_valid()): + and acco_form.is_valid() and payment_form.is_valid()): allow_contact = registration_form.cleaned_data.get( 'allow_contact') and True or False conference = registration_form.cleaned_data.get( @@ -246,6 +261,7 @@ def submit_registration(request, scope, wifi = wifi_form.save(registrant, scope_entity) acco = acco_form.save(registrant, scope_entity) + payment = payment_form.save(registrant, scope_entity) send_confirmation(registrant, scope_entity,password=passwd) @@ -260,6 +276,7 @@ def submit_registration(request, scope, registrant_form = RegistrantForm() wifi_form = WifiForm() acco_form = AccommodationForm() + payment_form = PaymentForm() login_form = AuthenticationForm() @@ -270,6 +287,7 @@ def submit_registration(request, scope, 'registrant_form' : registrant_form, 'over_reg' : reg_count >= REG_TOTAL and True or False, 'acco_form': acco_form, + 'payment_form': payment_form, 'wifi_form' : wifi_form, 'message' : message, 'login_form' : login_form -- cgit From 4b343a8d508ec2d957a9e43d53b0951c8be52cd4 Mon Sep 17 00:00:00 2001 From: Madhusudan.C.S Date: Mon, 15 Nov 2010 18:42:26 +0530 Subject: Use different DB for testing payments. --HG-- branch : payments --- project/development.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'project') diff --git a/project/development.py b/project/development.py index df95ac1..34bb854 100644 --- a/project/development.py +++ b/project/development.py @@ -27,7 +27,7 @@ INSTALLED_APPS = ( ) DATABASE_ENGINE = 'sqlite3' -DATABASE_NAME = 'scipycon.db' +DATABASE_NAME = 'scipyconpayment.db' DATABASE_USER = '' DATABASE_PASSWORD = '' -- cgit From 48f3c42a37c6776e54912f927edb2b969d14ae11 Mon Sep 17 00:00:00 2001 From: Madhusudan.C.S Date: Mon, 15 Nov 2010 19:36:00 +0530 Subject: Add a - to the title of the header for Registration Statistics page. --HG-- branch : payments --- project/templates/registration/regstats.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'project') diff --git a/project/templates/registration/regstats.html b/project/templates/registration/regstats.html index e1a0736..f73a36f 100644 --- a/project/templates/registration/regstats.html +++ b/project/templates/registration/regstats.html @@ -1,6 +1,6 @@ {% extends "base.html" %} -{% block title %}Registration Statistics{% endblock %} +{% block title %}Registration Statistics - {% endblock %} {% block content %}

Registration Statistics

-- cgit From 1a9687da44ec63ab40c44e2dc64f986f7564bc7f Mon Sep 17 00:00:00 2001 From: Madhusudan.C.S Date: Mon, 15 Nov 2010 19:43:15 +0530 Subject: Add cookie and return message for regstats view function. --HG-- branch : payments --- project/scipycon/registration/views.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'project') diff --git a/project/scipycon/registration/views.py b/project/scipycon/registration/views.py index b38c791..e4ce38b 100644 --- a/project/scipycon/registration/views.py +++ b/project/scipycon/registration/views.py @@ -302,7 +302,9 @@ def regstats(request, scope, if not request.user.is_staff: redirect_to = reverse('scipycon_login', kwargs={'scope': scope}) - + return set_message_cookie( + redirect_to, msg = u'You must be a staff on this website to ' + 'access this page.') q = Registration.objects.all() conf_num = q.filter(conference=True).count() -- cgit From a2f1020b1995ffa3b5f7f179092883ae7f5042c7 Mon Sep 17 00:00:00 2001 From: Madhusudan.C.S Date: Tue, 16 Nov 2010 17:11:24 +0530 Subject: Add a new URL for managing payments. --HG-- branch : payments --- project/urls.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'project') diff --git a/project/urls.py b/project/urls.py index 9b6f208..2d12b34 100644 --- a/project/urls.py +++ b/project/urls.py @@ -51,8 +51,10 @@ urlpatterns += patterns('project.scipycon.registration.views', 'submit_registration', name='scipycon_submit_registration'), url(r'^%s/edit-registration/(?P\d+)/$' % (SCOPE_ARG_PATTERN), 'edit_registration', name='scipycon_edit_registration'), - url(r'^%s/regstats/'% (SCOPE_ARG_PATTERN), + url(r'^%s/regstats/$'% (SCOPE_ARG_PATTERN), 'regstats', name="scipycon_regstats"), + url(r'^%s/manage_payments/$'% (SCOPE_ARG_PATTERN), + 'manage_payments', name="scipycon_manage_payments"), ) # Authentication and Profile -- cgit From 4c843f49203961cb30003b1405667a849346c758 Mon Sep 17 00:00:00 2001 From: Madhusudan.C.S Date: Tue, 16 Nov 2010 17:11:48 +0530 Subject: Add a view to manage payments. --HG-- branch : payments --- project/scipycon/registration/views.py | 55 +++++++++++++++++++++++++++++++++- 1 file changed, 54 insertions(+), 1 deletion(-) (limited to 'project') diff --git a/project/scipycon/registration/views.py b/project/scipycon/registration/views.py index e4ce38b..f3aa378 100644 --- a/project/scipycon/registration/views.py +++ b/project/scipycon/registration/views.py @@ -316,4 +316,57 @@ def regstats(request, scope, 'conf_num': conf_num, 'tut_num': tut_num, 'sprint_num': sprint_num, - })) \ No newline at end of file + })) + + +@login_required +def manage_payments(request, scope, + template_name='registration/manage_payments.html'): + """View that gives a form to manage payments. + """ + + if not request.user.is_superuser: + redirect_to = reverse('scipycon_login', kwargs={'scope': scope}) + return set_message_cookie( + redirect_to, msg = u'You must be an admin on this website to ' + 'access this page.') + + message = None + + scope_entity = Event.objects.get(scope=scope) + + if request.method == 'POST': + post_data = request.POST + list_user_ids = [] + for user_id_string in post_data: + id_str_list = user_id_string.split('_') + if (len(id_str_list) == 3 and id_str_list[0] == 'registrant' and + id_str_list[1] == 'id'): + id = int(id_str_list[2]) + reg_user = User.objects.get(pk=id) + + payment, created = reg_user.payment_set.get_or_create( + user=reg_user, scope=scope_entity) + + payment.paid = True + payment.save() + + list_user_ids.append(id) + + # This is done to unset for the confirmation for users for whom + # mistakenly confirmation was set. + # (TODO) This is a very expensive operation, any better solution + # will be appreciated. + unpaid_users = User.objects.exclude(pk__in=list_user_ids) + for user in unpaid_users: + payment, created = user.payment_set.get_or_create( + user=user, scope=scope_entity) + payment.paid = False + payment.save() + + registrants = Registration.objects.all() + + return render_to_response(template_name, RequestContext(request, + {'params': {'scope': scope}, + 'registrants': registrants, + })) -- cgit From 40fd5fed6b86b37668582923e6113acbcf8a2312 Mon Sep 17 00:00:00 2001 From: Madhusudan.C.S Date: Tue, 16 Nov 2010 17:12:38 +0530 Subject: Add a new template for payment management. --HG-- branch : payments --- .../templates/registration/manage_payments.html | 41 ++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 project/templates/registration/manage_payments.html (limited to 'project') diff --git a/project/templates/registration/manage_payments.html b/project/templates/registration/manage_payments.html new file mode 100644 index 0000000..ffa1aa6 --- /dev/null +++ b/project/templates/registration/manage_payments.html @@ -0,0 +1,41 @@ +{% extends "base.html" %} + +{% block title %}Manage Payments - {% endblock %} + +{% block content %} +

Manage Payments

+ +
+ +
+ Payment Details +
+ {% for registrant in registrants %} + + + + + {% endfor %} + + + +
+ + + {{ field.errors }} +
+
+ +
+
+ + +{% endblock content %} -- cgit From 814b5243284d8f96f446f1c799bed0ce460dd216 Mon Sep 17 00:00:00 2001 From: Madhusudan.C.S Date: Tue, 16 Nov 2010 17:34:36 +0530 Subject: Modify the help text for details field to be more harsh on users so that they are clear as to what they are supposed to provide. --HG-- branch : payments --- project/scipycon/registration/models.py | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'project') diff --git a/project/scipycon/registration/models.py b/project/scipycon/registration/models.py index 77a6dae..ed196f3 100644 --- a/project/scipycon/registration/models.py +++ b/project/scipycon/registration/models.py @@ -127,8 +127,9 @@ class Payment(base_models.ScopedBase): 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) + help_text="If the payment mode was cheque or DD please provide " + "the cheque or DD number and the name of the bank " + "and branch.
If the payment mode was 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 568138fbc63828f8f21314cb9d21c95faaa1a350 Mon Sep 17 00:00:00 2001 From: Madhusudan.C.S Date: Tue, 16 Nov 2010 17:35:03 +0530 Subject: Change the model field name of the payment from paid to confirmed. --HG-- branch : payments --- project/scipycon/registration/models.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'project') diff --git a/project/scipycon/registration/models.py b/project/scipycon/registration/models.py index ed196f3..a65a34e 100644 --- a/project/scipycon/registration/models.py +++ b/project/scipycon/registration/models.py @@ -118,9 +118,8 @@ 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.") + confirmed = models.BooleanField( + default=False, blank=True) type = models.CharField(max_length=25, choices=PAYMENT_MODE_CHOICES, verbose_name="Type", blank=True, null=True) -- cgit From fcfd1ad4aa613ffc50e9b69b46aca13cb5c3a064 Mon Sep 17 00:00:00 2001 From: Madhusudan.C.S Date: Tue, 16 Nov 2010 17:36:21 +0530 Subject: Typo of type field twice is fixed to details field in the form of registrantion. --HG-- branch : payments --- project/scipycon/registration/forms.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'project') diff --git a/project/scipycon/registration/forms.py b/project/scipycon/registration/forms.py index fc9cb70..15934d4 100644 --- a/project/scipycon/registration/forms.py +++ b/project/scipycon/registration/forms.py @@ -168,7 +168,7 @@ class PaymentForm(forms.ModelForm): class Meta: model = Payment - fields = ('paid', 'type', 'type') + fields = ('paid', 'type', 'details') PC = ( -- cgit From 4593a15c0fdfac4ac5f3d495045b9ead20a567bd Mon Sep 17 00:00:00 2001 From: Madhusudan.C.S Date: Tue, 16 Nov 2010 17:36:53 +0530 Subject: Remove the paid field from model form since it is now a dummy form field. --HG-- branch : payments --- project/scipycon/registration/forms.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'project') diff --git a/project/scipycon/registration/forms.py b/project/scipycon/registration/forms.py index 15934d4..578bfff 100644 --- a/project/scipycon/registration/forms.py +++ b/project/scipycon/registration/forms.py @@ -132,6 +132,10 @@ class PaymentForm(forms.ModelForm): """SciPyCon Payment form """ + paid = forms.BooleanField( + required=False, label="Amount paid", + help_text="Check this box if you have already paid the fees.") + def save(self, user, scope): try: payment = Payment.objects.get(user=user, scope=scope) @@ -142,7 +146,6 @@ class PaymentForm(forms.ModelForm): type = self.cleaned_data['type'] details = self.cleaned_data['details'] - payment.paid = paid payment.type = type payment.details = details -- cgit From 0952257f5614de1f48970b516514d5a36b769b78 Mon Sep 17 00:00:00 2001 From: Madhusudan.C.S Date: Tue, 16 Nov 2010 17:37:36 +0530 Subject: Made adjustments in the view to make paid field a dummy form field and not a model field. Also added confirmed field as model field. --HG-- branch : payments --- project/scipycon/registration/views.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'project') diff --git a/project/scipycon/registration/views.py b/project/scipycon/registration/views.py index f3aa378..2ae1d5b 100644 --- a/project/scipycon/registration/views.py +++ b/project/scipycon/registration/views.py @@ -139,7 +139,7 @@ def edit_registration(request, scope, id, payment_form = PaymentForm(initial={ 'user': payment.user, 'scope': payment.scope, - 'paid': payment.paid, + 'paid': payment.type or payment.details, 'type': payment.type, 'details': payment.details, }) @@ -348,7 +348,7 @@ def manage_payments(request, scope, payment, created = reg_user.payment_set.get_or_create( user=reg_user, scope=scope_entity) - payment.paid = True + payment.confirmed = True payment.save() list_user_ids.append(id) @@ -361,7 +361,7 @@ def manage_payments(request, scope, for user in unpaid_users: payment, created = user.payment_set.get_or_create( user=user, scope=scope_entity) - payment.paid = False + payment.confirmed = False payment.save() registrants = Registration.objects.all() -- cgit From 7a329ebb234ad78dc2e458fb1f20af15e6ad9239 Mon Sep 17 00:00:00 2001 From: Madhusudan.C.S Date: Tue, 16 Nov 2010 17:38:06 +0530 Subject: Add javascript to submit registration form template to make sure the details are supplied only when user fills in the details. --HG-- branch : payments --- project/templates/registration/submit-registration.html | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'project') diff --git a/project/templates/registration/submit-registration.html b/project/templates/registration/submit-registration.html index 5cbe3ac..7c238b0 100644 --- a/project/templates/registration/submit-registration.html +++ b/project/templates/registration/submit-registration.html @@ -19,6 +19,20 @@ $('#id_sex').removeAttr('disabled'); } }); + + if (!$('#id_paid').is(':checked')) { + $('#id_type').attr('disabled', 'disabled'); + $('#id_details').attr('disabled', 'disabled'); + } + $('#id_paid').change(function() { + if (!$('#id_paid').is(':checked')) { + $('#id_type').attr('disabled', 'disabled'); + $('#id_details').attr('disabled', 'disabled'); + } else { + $('#id_type').removeAttr('disabled'); + $('#id_details').removeAttr('disabled'); + } + }); }); -- cgit From 83d967ff3990775c9c2675372ae40546963d5323 Mon Sep 17 00:00:00 2001 From: Madhusudan.C.S Date: Tue, 16 Nov 2010 18:07:25 +0530 Subject: Add a alert label block with bigger font size and red color. --HG-- branch : payments --- project/static/css/styles.css | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'project') diff --git a/project/static/css/styles.css b/project/static/css/styles.css index 4127bd0..aef48ba 100644 --- a/project/static/css/styles.css +++ b/project/static/css/styles.css @@ -583,4 +583,9 @@ ol li { color: #58585a; margin-left: 5em; text-align: justify; +} + +label.alert { + font-size: 1.2em; + color: #ff0000; } \ No newline at end of file -- cgit From 58079289ccebf61d562e5e5a576b4aa48fee25b5 Mon Sep 17 00:00:00 2001 From: Madhusudan.C.S Date: Tue, 16 Nov 2010 18:08:30 +0530 Subject: Add a long check for alertness of payment names in the template. --HG-- branch : payments --- project/templates/registration/manage_payments.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'project') diff --git a/project/templates/registration/manage_payments.html b/project/templates/registration/manage_payments.html index ffa1aa6..d340d5f 100644 --- a/project/templates/registration/manage_payments.html +++ b/project/templates/registration/manage_payments.html @@ -13,7 +13,11 @@ {% for registrant in registrants %} -