• Posted on June 20, 2016
Screen Shot 2016-06-20 at 8.41.48 PM

Basic example how to code a Image button in PyQt

You can subclass QAbstractButton and make a button of your own. That’s not a super easy way, but it gives you a lot of control. You can add second pixmap and draw it only when the mouse pointer is hover over button. You can change current stretching behavior to the centering one. You can make it to have not a rectangular shape and so on.

Read More

  • Posted on February 21, 2015
django suite inline pagination

Django suit admin inline pagination

When you have a lot of inline objects, pagination will be a good way to make page of item lighter. You can implement it by yourself. Also keep in mind for Django 1.5 and Django 1.6 implementations differ. Read More

  • Posted on December 12, 2013

Fix Django 1.4 admin_site ForeignKeyRawIdWidget issue

If you want use field widget from Django 1.3 in Django 1.4 you need patch it Read More

  • Posted on December 02, 2011

Retrieving elements in a specific order in django

If you have a list of ordered ids and you want to turn them into an ordered result set you can use FIELD() in mysql:

SELECT * FROM addons
ORDER BY FIELD(id, 3, 5, 9, 1);

Read More

  • Posted on February 10, 2011

Use custom admin filters in ModelAdmin

ModelAdmin now has a lookup_allowed method which is used to either allow a lookup or raise a SuspiciousOperation exception. Read More

  • Posted on February 07, 2011

django-stdimage traceback “The ‘%s’ attribute has no file associated with it”

This traceback happening when you check file to __delete__, but file do not exist on file system Read More

  • Posted on February 01, 2011

Django admin filter by ranges of ages

Adds filtering by ranges of dates birth in the admin filter sidebar Read More

  • Posted on February 01, 2011

Django admin filter by ranges of dates with calendar

Adds filtering by ranges of dates in the admin filter sidebar. Read More

  • Posted on November 18, 2010

How to expire session on browser close in django

django employs cookies to track the user session. settings.SESSION_COOKIE_AGE defines the session expiration age in seconds. So, the user logs in once and can stay logged in for hours (even days). Read More

  • Posted on November 06, 2010

WebSockets in Python

Since the dawn of AJAX, web developers have longed for persistent server-side connections. For a while Comet was hailed as the bastion of “server push”, but deep down we knew it was just a hack. Now finally, years later, we have an API and a protocol being standardized for socket connections between the browser and the server – aptly named, WebSockets. Read More


hosting hostbe.net