Colors are amazing. It's one of the design elements clients care about so much. It's also one of the least reliable things on Earth. When choosing colors and applying them to your design, you have to keep in mind that no matter how much time you invest into colors, they'll never be appreciated the same way by all. Personal taste is not even the most important reason for this. This article discusses colors in the context of web design and gives you a few pointers so you can stop wasting so much time on them. I especially recommend it to print designers who are new to web design.
Browser wars of the 90's are in somewhat distant memory. We were there, we fought, have the scars. Mobile starts a whole new war, much like the Cold War—not so much fighting, not so many scars, but still a great deal of pressure. OK, enough with the corny intro.
While mobile and desktop devices behave more or less the same (thank heavens!), there are some minor differences that you want to keep in mind. These tips come from my experience working on web sites (not web apps) that target both desktop and mobile devices (responsive design). The tips in this article are sometimes not specific to mobile, and sometimes specific to one or the other platform. I hope you generally find them useful, though. Drop me a line in the comments if you have any others you want to see included.
If you are wondering how one could possible improve the already awesome Django admin, you probably aren't an admin-junky... yet. While Django admin app is pretty good as it is, it can certainly use lots of improvements. Here I will show you three of the admin enhancements that I simply can't live without.
I've always been an avid Vim fan and user. I've got a vimrc file the length of my leg, and a few megs of plugins. But there's always been something that bothered me in Vim, and that's the lack of good code completion facilities for Python. Sure you have Ropevim, and all that, but that never quite cut it for me. From time to time, I'd enviously look at different IDEs like Eclipse with PyDev or Aptana Studio (yes, that's more or less identical to Eclipse with PyDev, I know), PyCharm... Ah, PyCharm. It really made my day.
SEO and social media are an important part of doing business online. Although metadata are just one part of the story, they are indispensable when it comes to proper positioning of your Django site on the Web. Unfortunately, valid HTML is still quite far from being able to convey all the concepts that you publish on the Internet, and we still have to rely in metadata and semantic markup like schemas to let search engines and social sites know what our content is about. django-meta is my first attempt at making the task of adding metadata to your site a bit easier.
django-meta takes care of two things for you. It renders the classic meta description and keywords, and also renders the OpenGraph protocol meta tags (OG tags). In this post, I will give you a short overview of django-meta. I won't go into too much detail, since the app is (hopefully) well documented.
Testing Django apps is not as straightforward as testing whole Django projects. After all, Django apps are meant to be part of a project, and they cannot survive on their own. So how do you go about it? There are many ways to do it (as usual), ranging from testing only the parts that aren't related to Django, to scaffolding whole Django projects just for the purpose of testing.
Here I will show you how to write a simple script that would allow you to run test suites for pluggable apps without having to scaffold entire projects, while still allowing you to have a full Django environment akin to ones in which you'd run your apps. I find this method to be the most maintainable and easiest to understand.
When you add a new non-null field in Django models, and you use South to migrate the schema, it usually gives you two options: either add the default value for the field, or use a simple one-off value as default. This works as far as the new field is non-unique. If you are dealing with unique fields, you cannot provide a simple one-off value because it would immediately cause the uniqueness constraint to be broken, and having a default value for a unique field doesn't make any sense. Fortunately, South migrations are written in Python, and it's trivial to add custom dynamically generated data. This post will demonstrate the process of adding a unique slug field to an existing model and migrating the schema using customized migration.