Loving Open-Souce One Anonymous Function at a Time.

Making profile pages more sane

We encourage our merchants to include a facebook page with their profiles so that users can share that page when they check-in, check-out, unlock a deal, or redeem a deal. But some people didn't understand what that means and we had all sorts of crazy input. Instead of explaining the steps they'll need to get us the correct URL, we'll just take whatever they mashed out on their keyboard and fix it.

Django has some weird points, but it mostly has awesome ones. I needed to clean up our database and the interactive console was perfect.

python shell

and then you can something like this

# get all the businesses from the modal
b = Business.objects.all()

# loop through the all the profiles
for p in b:      
    p.facebook_link = p.facebook_link.replace('','')
    p.facebook_link = p.facebook_link.replace('/','/')
    p.facebook_link = p.facebook_link.replace('','')
    p.facebook_link = p.facebook_link.replace('//','/')

On the signup form we do some JavaScript to parse out some of the non-sense

$('#facebook').blur(function() {

$('#twitter').blur(function() {