Python / Django Goodies For eCommerce

I should preface this post by noting that this is not for the "average" internet marketer. This is more designed for Python programmers with a love for the Django framework. Real geek stuff. If you got the stomach for it, then read on...

Serving Secure Signed Files With Expiration Times

I wrote a simple class this morning to handle secure signed Amazon S3 links with expiration times. This is very useful when you want to serve files from Amazon S3 that are part of a membership site or a digital goods purchase.

I have been serving files from my digital purchases through a custom Django view. This isn't a very strong method because for every file served (purchased) my server has to load that file into memory. I would much rather give that task to S3 since it's more reliable, very fast and so cheap that it's a no brainer.

Of course I haven't migrated this class into my payment and delivery system yet but I'll do that some time this weekend.

Django DateField To Handle Credit Card Expiration Dates

I've now built several systems for taking payment via credit card. One of the problems that consistently comes up is when a user wants to update their credit card information in the database.

Providing the interface for that is easy, but the default display for a Django DateField will display their expiration date like this:

YYYY-MM-DD

Now on your credit, or debit, cards the expiration date looks like: MM/YY. So I created a custom field to display and accept input in the MM/YY format.

Totally got rid of the customer problems when updating their account with new credit card information.

Get the code...

You can snag both snippets at my account on DjangoSnippets. They are free to use however you want. You can also see example usage of them on their individual snippet page.

Go here to download the snippets.