Archive for April, 2008

Undocumented Django: Overriding _get_FIELD_url and friends

Monday, April 21st, 2008

Recently I found the need to override the _get_FIELD_url() for a particular set of models in my Django app. The _get_FIELD_*() methods provide your FileField and ImageField with “magic” convenience methods. For example:

from django.db import models

class MyModel(models.Model):
    file = models.FileField(upload_to=’some/path’)

If you want to to retrieve the URL for the file you would use:

m = MyModel().objects.get(id=1)
m.get_file_url()

Notice that your class automagically gets a method called “get_file_url()”. This is the “magic” part and all of this is done behind the scenes for you. While this is really convenient for getting things done most of the time, there are some times where you need to have more control over what’s returned by these magic methods.

(more…)

How To Piss Off Your Customers

Sunday, April 20th, 2008

Names of domain registrars have been changed or omitted to protect you from them. Stay away from them!

This morning I needed to register a new domain name for a site I’m building. I chose the domain registrar that had a pretty good rep back in the day as my registrar. I don’t have a credit card yet so I had to borrow my sister’s card to complete the transaction. When I clicked on the “Order” button, the next screen told me that my transaction triggered their “Fraud Protection” filter or something. It said that because my card is “Unsecured” I needed to fill up a form that I should print, attach a “blueprint” of the card, and fax it to an international number. This was the first time I came across this sort of thing. I asked my sister if she could print the form and take a “blueprint” of the card and send it to them. She said no. The other option was to send it to them via an upload form. She still said no. I agree with her.

My sister is tech savvy, having worked as a call center agent for a large North American computer manufacturer before she got hired as a nurse. She was quick to point out that it’s risky to send an image of your credit card anywhere because that’s a sure fire way to expose yourself to fraud. Imagine if someone manages to sniff your network traffic. Or if you dial in the wrong fax number! What sort of stupid, braindead idiot came up with this method of card verification?!? There are better, simpler, more secure ways of verification. Try the phone! BlackAndYellowMoneyTransfer does this for their online transactions.

I don’t know yet if they have charged my sister’s card but it appears from the emails I got that they have not charged her yet. I already sent them a tech support ticket and I am still waiting for a reply. I really hope they had not charged her yet because that will mean she has to dispute the charge and go through a lot of hoops to get her money back. Money is just money and I can get it back really quickly. What pisses me off is not that I was not able to go through with the transaction. It is because they have locked on my domain name even though my transaction status is pending. On the “card verification” page it said that if we did not send the printed form in 60 days my domain will get deleted. So now, my domain is locked with these morons until this gets sorted out.

Now, with my domain locked with FunnyHatDomainRegistrationCompanyDotCom I decided to try this other domain registrar. This one is all over the place. I’ve seen them on American Chopper. They’re also on this video podcast show with two guys drinking beer and yammering on about how cool their social network site is. So I decided to try GoToYourMommaDomainRegistrationCompanyDotCom. After all, Danica Patrick is hot!

On their order page, I was completely inundated with offers for assorted add-ons and services. Not the kind where they offer you services at the end of your order. These offers were on every single step of my order. I had a hard time wading through these offers and sorting out which ones are the offers and which ones are my actual order. When I finally managed to fill in the billing and credit card details form and click “Order” I was greeted with a simple “Unable to process order”. That’s it! No explanation why the order failed. No offer for help to remedy my situation. Nothing! I’m more surprised they did not offer to sell me anything after the order failed. Way to go GoToYourMommaDomainRegistrationCompanyDotCom! See ya!

Completely frustrated I decided to try this other domain registrar. This one is owned by ExclamationPointSearchDotCom and in the past they had good service, although their administration control panel was a bit confusing. Went in, got through 3 steps to process my order and in 5 minutes I finally had my domain registered. Yahoo!

UPDATE 21 Apr 2008 – 6:40PM PHT

I received an email from FunnyHatDomainRegistrationCompanyDotCom billing technical support. I replied and asked to have my order cancelled. Within a few minutes I received 3 emails confirming that my order has been cancelled and that my domain has been released. Props to FunnyHatDomainRegistrationCompanyDotCom for the quick reply, although their credit card verification process certainly needs improvement. A quick phone call to the card owner to verify and confirm the order should be sufficient. It is simply too risky to post your credit card proof of ownership through fax, email or upload form.

Running a Budget Web Hosting Company (or Not)

Wednesday, April 16th, 2008

I will be buying a new server to host my site and possibly use it for web hosting. I have been scoping out the competition. There are a lot of them out there and it’s scary what some of these web hosting companies appear to be offering. On the surface they certainly look very attractive, not so much for their glossy landing pages and slick designs, but because of the numbers they put out on their packages.

A colleague brought up one web hosting company the other day. Ultra-cheap packages and impressive numbers make it very attractive to those who are looking to host their site for the first time. I don’t know what bothers me more. Is it the fact that people buy into these bullshit packages? Or the fact that some unscrupulous web hosting companies take advantage of numbers to market their crappy service. To be fair to them (and so you don’t fall prey to them as well), I won’t mention that company here. However, I will take a look at the packages they offer.

(more…)

Undocumented Django: urlresolvers.reverse() gotchas

Thursday, April 3rd, 2008

When you have several projects that share the same app, it is particularly important not to hard-code URL’s. Say you have a Blog app that you want to use with a couple of projects, you need to ensure that any URL’s used in the views as well as the templates are “portable”. That is, if you have one site with the Blog app rooted under /blog/ and the other site puts it under /diary/ you need to make sure that URL’s mapping to the views in the Blog app will work under these different roots.

For instance, viewing a post on one site would require a URL like /blog/posts/1/view/ and the other site it would be /diary/posts/1/view/. For blog archives you would have URLs like /blog/archives/ and /diary/archives/. You would use a URLconf pattern like this:

(r&#8217;^posts/(?P<post_id>\d+)/view/$&#8217;, &#8216;post_view&#8217;),
(r&#8217;^archives/$&#8217;, &#8216;post_archive&#8217;),

You can hard-code the URLs in your views and templates, but that would be less than ideal since you now have to maintain two slightly different versions of what is essentially the same code base. What you need to do is somehow obtain the URL properly rooted to either /blogs/ or /diary/.

(more…)