Luke Plant avatar Luke Plant committed 23ca94b

s/ChequePayment/ManualPayment/g

Comments (0)

Files changed (5)

cciw/bookings/admin.py

 from django.utils.html import escape, escapejs
 
 from cciw.bookings.email import send_booking_approved_mail
-from cciw.bookings.models import Price, BookingAccount, Booking, ChequePayment, RefundPayment, BOOKING_APPROVED, BOOKING_INFO_COMPLETE
+from cciw.bookings.models import Price, BookingAccount, Booking, ManualPayment, RefundPayment, BOOKING_APPROVED, BOOKING_INFO_COMPLETE
 from cciw.cciwmain.common import get_thisyear
 from cciw.utils.views import close_window_response
 
         return retval
 
 
-class ChequePaymentAdminFormBase(forms.ModelForm):
+class ManualPaymentAdminFormBase(forms.ModelForm):
 
     account = account_autocomplete_field()
 
     def clean(self):
-        retval = super(ChequePaymentAdminFormBase, self).clean()
+        retval = super(ManualPaymentAdminFormBase, self).clean()
         if self.instance is not None and self.instance.id is not None:
-            raise forms.ValidationError("Cheque payments cannot be changed "
+            raise forms.ValidationError("Manual payments cannot be changed "
                                         "after being created. If an error was made, "
                                         "delete this record and create a new one. ")
         return retval
 
 
-class ChequePaymentAdminForm(ChequePaymentAdminFormBase):
+class ManualPaymentAdminForm(ManualPaymentAdminFormBase):
 
     class Meta:
-        model = ChequePayment
+        model = ManualPayment
 
 
-class RefundPaymentAdminForm(ChequePaymentAdminFormBase):
+class RefundPaymentAdminForm(ManualPaymentAdminFormBase):
 
     class Meta:
         model = RefundPayment
 
 
-class ChequePaymentAdminBase(admin.ModelAdmin):
+class ManualPaymentAdminBase(admin.ModelAdmin):
     list_display = ['account', 'amount', 'created']
     search_fields = ['account__name']
     date_hierarchy = 'created'
             return []
 
 
-class ChequePaymentAdmin(ChequePaymentAdminBase):
-    form = ChequePaymentAdminForm
+class ManualPaymentAdmin(ManualPaymentAdminBase):
+    form = ManualPaymentAdminForm
 
 
-class RefundPaymentAdmin(ChequePaymentAdminBase):
+class RefundPaymentAdmin(ManualPaymentAdminBase):
     form = RefundPaymentAdminForm
 
 
 admin.site.register(Price, PriceAdmin)
 admin.site.register(BookingAccount, BookingAccountAdmin)
 admin.site.register(Booking, BookingAdmin)
-admin.site.register(ChequePayment, ChequePaymentAdmin)
+admin.site.register(ManualPayment, ManualPaymentAdmin)
 admin.site.register(RefundPayment, RefundPaymentAdmin)

cciw/bookings/hooks.py

 
 from .signals import places_confirmed
 from .email import send_unrecognised_payment_email, send_places_confirmed_email
-from .models import BookingAccount, ChequePayment, RefundPayment, send_payment
+from .models import BookingAccount, ManualPayment, RefundPayment, send_payment
 
 #### Handlers #####
 
         unrecognised_payment(ipn_obj)
 
 
-def cheque_payment_received(sender, **kwargs):
+def manual_payment_received(sender, **kwargs):
     instance = kwargs['instance']
     send_payment(instance.amount, instance.account, instance)
 
 
-def cheque_payment_deleted(sender, **kwargs):
+def manual_payment_deleted(sender, **kwargs):
     instance = kwargs['instance']
     send_payment(-instance.amount, instance.account, instance)
 
 payment_was_successful.connect(paypal_payment_received)
 payment_was_flagged.connect(unrecognised_payment)
 places_confirmed.connect(places_confirmed_handler)
-post_save.connect(cheque_payment_received, sender=ChequePayment)
-post_delete.connect(cheque_payment_deleted, sender=ChequePayment)
+post_save.connect(manual_payment_received, sender=ManualPayment)
+post_delete.connect(manual_payment_deleted, sender=ManualPayment)
 post_save.connect(refund_payment_sent, sender=RefundPayment)
 post_delete.connect(refund_payment_deleted, sender=RefundPayment)

cciw/bookings/models.py

         return u"<Payment: %s to %s from %s>" % (self.amount, self.account, self.origin)
 
 
-class ChequePaymentManager(models.Manager):
+class ManualPaymentManager(models.Manager):
     use_for_related_fields = True
 
     def get_query_set(self):
-        return super(ChequePaymentManager, self).get_query_set().select_related('account')
+        return super(ManualPaymentManager, self).get_query_set().select_related('account')
 
 
-class ChequePaymentBase(models.Model):
+class ManualPaymentBase(models.Model):
     amount = models.DecimalField(decimal_places=2, max_digits=10)
     account = models.ForeignKey(BookingAccount)
     created = models.DateTimeField(default=datetime.now)
 
-    objects = ChequePaymentManager()
+    objects = ManualPaymentManager()
 
     def save(self, **kwargs):
         if self.id is not None:
             raise Exception("%s cannot be edited after it has been saved to DB" %
                             self.__class__.__name__)
         else:
-            return super(ChequePaymentBase, self).save(**kwargs)
+            return super(ManualPaymentBase, self).save(**kwargs)
 
     class Meta:
         abstract = True
 
 
-class ChequePayment(ChequePaymentBase):
+class ManualPayment(ManualPaymentBase):
 
     def __unicode__(self):
-        return u"Cheque payment of £%s from %s" % (self.amount, self.account)
+        return u"Manual payment of £%s from %s" % (self.amount, self.account)
 
 
-class RefundPayment(ChequePaymentBase):
+class RefundPayment(ManualPaymentBase):
 
     def __unicode__(self):
         return u"Refund payment of £%s to %s" % (self.amount, self.account)

cciw/bookings/views.py

 # - covers step 4 to 5 of user process
 
 # Admin payments info
-# - 'Add cheque payment' form
-#   - the amount of the cheque payment is entered (and cheque number?)
+# - 'Add manual payment' form
+#   - the amount of the manual payment is entered
 #   - includes name/address, with AJAX view to select account
 # - 'Add refund payment' form
 # - link to general admin page that allows payments to be corrected or deleted
     INSTALLED_APPS += (
     'django.contrib.staticfiles',
     'south',
-)
+    )
 
 if DEVBOX and DEBUG:
     INSTALLED_APPS += (
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.