Django

2013


Migrating to a Custom User Model in Django

UPDATE: Read a newer blog post on this topic.

The new custom user model configuration that arrived in Django makes it relatively straightforward to swap in your own model for the Django user model. In most cases, Django's built-in User model works just fine, but there are times when certain limitations (such as the length of the email field) require a custom user model to be installed. If you're starting out with a custom user model, setup and configuration are relatively straightforward, but if you need to migrate an existing legacy project (e.g., one that started out in Django 1.4 or earlier), there are a few gotchas that you might run into. We did this recently for one of our larger, long-term client projects at Caktus, and here's an outline of how we'd recommend tackling this issue:

Factory Boy as an Alternative to Django Testing Fixtures

Mark Lavin

When testing a Django application you often need to populate the test database with some sample data. The standard Django TestCase has support for fixture loading but there are a number of problems with using fixtures:

Caktus is hiring a Design Visionary and User Experience Virtuoso with a Knack for Coding

Do your mornings usually consist of reading design blogs and drinking coffee? Are you obsessive about fonts? Are you constantly seeking out new inspiration to make your designs better? As a Front-End Developer + Designer at Caktus, you’ll be able to put your passion for design and development to work by creating beautiful designs for complex websites. You will work closely with clients to bring their visions to life and help lead the branding and design process. Our designers take ownership of the user experience and design process from the beginning and collaborate with our development team to implement the vision. You should be passionate about the open source community and the philosophy behind it. If you’re interested in becoming part of and contributing to a creative, dynamic team, here’s an idea of what you’ll do:

Caktus and Python Software Foundation Collaborate on PyCon 2014 in Montreal Site

Alex Lemann

[Caktus is proud to be a part of the launch of the]{style=“color:#000000; background-color:transparent; font-style:normal;”} PyCon 2014 in Montreal[ website. We were delighted to be selected as this year’s partner for software development and brand updates. In the past, we've enjoyed working with the ]{style=“color:#000000; background-color:transparent; font-style:normal;”}Python Software Foundation[ as a collaborator for the ]{style=“color:#000000; background-color:transparent; font-style:normal;”}Raspberry.io[ branding and development and are excited to help out with the PyCon website.]{style=“color:#000000; background-color:transparent; font-style:normal;”}

MEDIA_ROOT and Django Tests

Mark Lavin

If you’ve ever written a test for a view or model with associated uploaded files you might have noticed a small problem with those files hanging around after the tests are complete. Since version 1.3, Django won’t delete the files associated with your model instances when they are deleted. Some work-arounds for this issue involve writing a custom delete for your model or using a post_delete signal handler. But even with those in place the files would not be deleted during tests because the model instances are not explicitly deleted at the end of the test case. Instead, Django simply rolls back the transaction and the delete method is never called nor are the signals fired. This can be quite an annoyance when running the tests repeatedly and watching your MEDIA_ROOT (or worse your S3 bucket) fill up with garbage data. More than annoyance, this introduces something you always want to avoid in unittests: global state.

Making your Django app more pluggable

Dan Poirier

This blog post is about ways of doing things in your Django app, and pitfalls to avoid, so your app is easier to plug in to other sites.

AngularJS to PyGame: Caktus’ 2nd ShipIt Day

We had our 2nd ShipIt Day at Caktus last week. ShipIt (coined by Atlassian), in case you don’t know, is an exercise that allows your team to work on alternative projects in a 24-hour hackathon. We brainstorm ideas related to Caktus, break into small groups and try to build a project by the end of the day on Friday. It’s a lot of fun and provides an opportunity to work on internal tools, try something new and collaborate together. \

Managing Django Translations with Transifex

Mark Lavin

We manage a number of open source Django apps here at Caktus. While many of us here are proficient in a number of programming languages, the same can’t be said for our ability to read or write in languages other than English. The Django community is global and we want our apps to support other languages. For that we’ve turned to Transifex which it the same tool Django itself uses for translations.

cover-caktus-sponsoring-and-speaking-mobile-health-switchpoint-2013.jpg

Caktus sponsoring and speaking on mobile health at SwitchPoint 2013

SwitchPoint is a one-of-a-kind conference and a unique opportunity to learn, share ideas, and hear about global and mobile health efforts around the world. We had a great time at SwitchPoint last year. I’m excited to announce that Caktus, for the second year in a row, is sponsoring [SwitchPoint 2013]{style=“color: rgb(17, 85, 204);”}.

A helper script for runserver

Dan Poirier

My Django runserver shortcut script

This is a little shell script I save as rs, put on my path, and use as a shortcut to start the Django development server. It has several features that make me more productive: