These are some of our thoughts on technology and business processes, as well as our inner workings and developer lifestyles.
Quite often we have to write paginated or filtered blocks of information on page. I created a decorator that would automate this process.
When we use css-sprites it's important to make browser cache them for longest period possible. On other hand, we need to refresh them when they are updated. This is especially visible when all icons are stored in single sprite. When it's outdated - entire site becomes ugly.
I've created this small sprite to create css sprites. It glues images from directory directory into single file and generates corresponding css.
In order to check if user is authentcated in test, you can run:
In VIM there is a command for char search: f. After first use it can be repeated with ;. I like to navigate in line with it. You see that you need to go to bracket in a middle of a line - you press f( and one-two ; and you are there. There's no such command in Emacs, so I had to write my own. I've managed even to implement repetition with ;.
Learn how to use "OR" and "AND" queries efficiently in Django without using database models Q. Enhance your query-building skills. Dive in now.
It appears that not everyone knows that in python you can create classes dynamically without metaclasses. I'll show an example of how to do it.So we've learned how to use custom QuerySet to chain requests:Article.objects.old().public()Now we need to make it work for related objects:user.articles.old().public()This is done using use_for_related_fields, but it needs a little trick.
As you know, model managers can be overriden in Django. It's convenient to add custom filtration method.