Blog

Grouping data by field with the Django ORM

December 7, 2013

I just finished creating some charts for my Django app using Highcharts and had to group some data for them. I thought it would be just as simple as calling a group_by() method but turned out it works a little differently but still pretty straightforward and well documented.

Just to show an example (I’m using Django 1.6):

# glucoses/models.py

class Category(models.Model):
    name = models.CharField(unique=True, max_length=255)


class Glucose(TimeStampedModel):
    user = models.ForeignKey(User)
    value = models.PositiveIntegerField() # …

Auto-deploy your Django app to Heroku with Travis CI on git push

December 3, 2013

I was setting up a demo site for my latest open-source project, GlucoseTracker, a few weeks back and decided to run it on Heroku. The free tier (called ‘Hobby Dev’) allows 10,000 rows in a PostgreSQL database and 20 concurrent connections, which is more than good enough for me at this point.

I thought about using Jenkins CI to do the deployment to Heroku initially, but as I was installing it on my …

AT&T GoPhone: How to get the 10 cents/minute plan with your smartphone

November 29, 2013

I just recently came back to the US and had to get a new SIM card (which you can get on Amazon for about $0.25+shipping (should come out to less than $2), a lot cheaper than the $10 AT&T charges). I don’t want to subscribe to their plans that give you unlimited voice or text messaging as I rarely use my cellphone service. I really just want to have it in case of an emergency. …

Loading dummy data for your Django app using management commands

November 23, 2013

I’m at a point in my project now, GlucoseTracker, a web application for keeping tracking of blood sugar levels, where I’m starting to work on reporting and statistics. I need some dummy data automatically loaded in the database to work on this part and I need to refresh the data every few days or so.

It would be too much work to do this manually so I wrote a simple script that would be …

A hidden spot in Barcelona: ‘El Bunker’

November 18, 2013

During my second week in Barcelona, I went to a Couchsurfing event and was chatting with a girl who told me about this place called “bunkers”, an old Spanish civil war bunker on top of a hill built in the 30s. She’d been living here for a few months now and told me it’s the best view of Barcelona she’d seen, even better than the view from Parc Guell, probably the most famous park in …