Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Reminder: Django Training
A quick reminder: if you’re thinking of coming to me week-long Django course in Kansas City next month, today’s the last day to sign up at early-bird pricing. The price goes up by $500 tomorrow. It’s shaping up to be a blast – why not join us? -
Adding django-shorturls
Time to time I sync my blog software to the Django trunk and introduce small enhancements. Some of them visible to my readers, some of them are just for me. This time after reading Simon Willison's post on rev=canonical I decided to add short URLs to my blog as well. This is a convention to provide custom short URLs managing the mapping on your own web site. In my opinion the idea is very cool. To be completely honest: while I like the idea I am not completely sold on its implementation. For example Mark Nottingham advocates a different way to provide the same information: rel=shorturl (via Simon's post), and it sounds more logical to me. Oh, well. The first approach is easy to try: Simon coded it for Django, and Jacob Kaplan-Moss even created a full-fledged Django application out of it available both on github and on pypi — with this kind of availability I had no excuse not to try it. And rev=canonical can be used together with rel=shorturl, if I want to add it later, using the same universal django-shorturls application. So after buying lzt.me domain I armed myself with Simon's article and Jacob's git repository, and … -
Adding django-shorturls
Time to time I sync my blog software to the Django trunk and introduce small enhancements. Some of them visible to my readers, some of them are just for me. This time after reading Simon Willison’s post on rev=canonical I decided to add short URLs to my blog as well. This is a convention to provide custom short URLs managing the mapping on your own web site. In my opinion the idea is very cool. To be completely honest: while I like the idea I am not completely sold on its implementation. For example Mark Nottingham advocates a different way to provide the same information: rel=shorturl (via Simon’s post), and it sounds more logical to me. Oh, well. The first approach is easy to try: Simon coded it for Django, and Jacob Kaplan-Moss even created a full-fledged Django application out of it available both on github and on pypi — with this kind of availability I had no excuse not to try it. And rev=canonical can be used together with rel=shorturl, if I want to add it later, using the same universal django-shorturls application. So after buying lzt.me domain I armed myself with Simon’s article and Jacob’s git repository, and … -
Twitter Change
After two years or more I have finally been able to get my real name on twitter (gregnewman) and will be switching over to using that as my main twitter account. I will keep 20seven around as a pointer to gregnewman but please re-follow me there and I'll be working on re-following all my friends under that account. -
Пространства имен
Недавний релиз Джанги 1.1 принес с собой новую фичу - пространства имен урлов. Цель они призваны достичь благую, но увы их механизм пока не очень прозрачен и понятен при первом приближении. Давайте разбираться. Всё это родилось из идеи иметь несколько админок в одном проекте. И после рефакторинга админки под новые формы это стало возможным. Так же нужно было решить как разделять их урлы и главное как их реверсить по имени. Понятно, что в общем случае имена паттернов урлов разных админок будут пересекаться и однозначно преобразовать имя в урл невозможно. Тогда придумали каждому объекту SiteAdmin давать имя и это имя становилось частью названия паттерна урлов соответствующей админки. Ещё особенностью являлось то, что админка это объект и её урлы скрыты в атрибуте urls, что немного ломало классический способ инклюда урлов Джанги. Что же сделали? Добавили разделение имен урлов. Причем разделенние на 2 уровня - уровень приложения и уровень инстанса приложения. Так что за приложения и что за инстансы? Допустим у вас есть приложение foo, в котором присутствует какое-то количество урлов. Раньше хорошей практикой считалось урлы называть с префиксом имени приложения, например foo_index (или ещё каким-то уникальным идентификатором, что делала раньше админка (именем)). Теперь же. использую пространства имен, можно ограничится только index и … -
Links Desktop Teaser Screencast
In past blogs I've hinted on the fact that I'm working on a Javascript application in my spare time. It's not quite done yet, and wont be live for a few more weeks, but I do have something that I can show off. This project is best explained in the form of a screencast. This is the first screencast I have ever made and I'm not sure if I have done it right, or if my humble server will cope with serving FLV files. If the server doesn't manage to keep up, I'll probably Youtube it. -
Links Desktop Teaser Screencast
In past blogs I've hinted on the fact that I'm working on a Javascript application in my spare time. It's not quite done yet, and wont be live for a few more weeks, but I do have something that I can show off. This project is best explained in the form of a screencast. This is the first screencast I have ever made and I'm not sure if I have done it right, or if my humble server will cope with serving FLV files. If the server doesn't manage to keep up, I'll probably Youtube it. flowplayer("player_linksdesktop", "http://www.willmcgugan.com/media/flowplayer/flowplayer-3.1.2.swf"); Update: If for any reason the above player doesn't work, you can view the screencast on Youtube. The front-end uses nothing more than HTML and Javascript. This project actually represents more Javascript than I have written in all my previous career. I've written so much JS lately that I have stopped hating it – but that may just be Stockholm Syndrome. The back-end is a Django application that serves the content and the API that is used by the front-end JS. I've put together a nice simple mechanism for exposing an AJAX API in Django, that removes virtually all the boiler plate; … -
Links Desktop Teaser Screencast
In past blogs I've hinted on the fact that I'm working on a Javascript application in my spare time. It's not quite done yet, and wont be live for a few more weeks, but I do have something that I can show off. This project is best explained in the form of a screencast. This is the first screencast I have ever made and I'm not sure if I have done it right, or if my humble server will cope with serving FLV files. If the server doesn't manage to keep up, I'll probably Youtube it. Update: If for any reason the above player doesn't work, you can view the screencast on Youtube. The front-end uses nothing more than HTML and Javascript. This project actually represents more Javascript than I have written in all my previous career. I've written so much JS lately that I have stopped hating it – but that may just be Stockholm Syndrome. The back-end is a Django application that serves the content and the API that is used by the front-end JS. I've put together a nice simple mechanism for exposing an AJAX API in Django, that removes virtually all the boiler plate; the API … -
Django development workflow
Speak to 10 different Django developers and you will find 10 different ways of working. Speak to them the following year and you will no doubt find another 10 evolutions. This is just one of them, pickled in the moment. I have a longish history with python but my Django experience is much more recent, but nonetheless I think this distills a some sound practices that I've learned from others, and -
Django: Testing With File System Side Effects
Django uses unittest for testing. django.test.TestCase is a special base class for tests that adds various features1. Django testing framework takes care of creating a test database, resetting it to its initial state after each test and finally destroying it. So you don’t have to worry tests overwriting anything in your main database. But if [...] -
Собственные фильтры полей в админке Django
Пока Правильное Решение проблемы страдает в джанговском Trac'е уже два с половиной года от смены майнтейнеров и архитектурной астронавтики, мне как раз потребовалось это сегодня для Афиши. Оказывается, никого ждать не надо , и это вполне решаемо уже сейчас, хоть и с небольшим хаком процесса регистрации. Задача У нас есть моделька City, в которой страна задана целым числом -- ID региона из яндексовой геобазы. Название в модели не хранится, а при необходимости вычисляется из ID запросом в геобазу: class City(models.Model): country_region_id = models.IntegerField() def country(self): return get_name_from_geobase(self.country_region_id) Если в админке сделать фильтр по полю country_region_id, получится некрасиво: Хочется заставить админку выводить не цифры, а то, что получается из country(). FilterSpec В админке за выдачу данных фильтров овечает несколько классов, определённых в django.contrib.admin.filterspecs. Каждый класс отвечает за то, чтобы из модели и типа поля вытащить данные для фильтра и определяет правила составления запроса. Стандартные FilterSpec'и умеют строить фильтры для полей разного типа: Для ForeignKey выбираются все данные из модели, на которую он ссылается. Для полей с choice'ами фильтрами являются сами choice'ы. Для BooleanField'ов предопределённый набор из двух значений: True и False. Для всех остальных полей делается distinct-выборка всех значений, которые есть в модели. Для того, чтобы выдавать названия стран, я и … -
Собственные фильтры полей в админке Django
Пока Правильное Решение проблемы страдает в джанговском Trac'е уже два с половиной года от смены майнтейнеров и архитектурной астронавтики, мне как раз потребовалось это сегодня для Афиши. Оказывается, никого ждать не надо , и это вполне решаемо уже сейчас, хоть и с небольшим хаком процесса регистрации. Задача У нас есть моделька City, в которой страна задана целым числом — ID региона из яндексовой геобазы. Название в модели не хранится, а при необходимости вычисляется из ID запросом в геобазу: class City(models.Model): country_region_id = models.IntegerField() def country(self): return get_name_from_geobase(self.country_region_id) Если в админке сделать фильтр по полю country_region_id, получится некрасиво: Хочется заставить админку выводить не цифры, а то, что получается из country(). FilterSpec В админке за выдачу данных фильтров овечает несколько классов, определённых в django.contrib.admin.filterspecs. Каждый класс отвечает за то, чтобы из модели и типа поля вытащить данные для фильтра и определяет правила составления запроса. Стандартные FilterSpec'и умеют строить фильтры для полей разного типа: Для ForeignKey выбираются все данные из модели, на которую он ссылается. Для полей с choice'ами фильтрами являются сами choice'ы. Для BooleanField'ов предопределённый набор из двух значений: True и False. Для всех остальных полей делается distinct-выборка всех значений, которые есть в модели. Для того, чтобы выдавать названия стран, я и … -
Django 1.1 lançado
Django 1.1 lançado -
Django 1.1 lançado
Django 1.1 lançado -
Django 1.1
Por fin se ha anunciado la esperada versión 1.1 de Django. Ya se puede descargar desde el sitio oficial e incluye la actualización de seguirdad publicada ayer: Descarga Django 1.1 desde el sitio oficial. -
Django hits the big 1.1
Django 1.1 is out! This release has some great new features: aggregation support for SQL aggregate queries (COUNT, MIN, MAX) query expressions can now refer to another field in the query admin actions allow custom actions to be taken on a group of model objects in bulk a bunch of other stuff... RTFRN Many of our newer Django projects have been developed against the 1.1 feature set. django-blogdor supports admin actions for publishing posts. This has made the admin interface much easier to use for our bloggers. James is in the process of redeveloping this site, Sunlight Labs, against 1.1. Some of our other Django-powered sites include Sunlight Foundation, Earmark Watch, Capitol Words, and Read the Bill. We have been big proponents of Django here at Sunlight Labs. When organizations tell us that they are planning to use a CMS like Drupal, we urge them to consider using Django + Pinax instead. Pinax has many of the same features, but provides much more flexibility in the long run. We have also released many of our internal Django apps: django-blogdor blogging application django-gatekeeper generic model object moderation django-honeypot generic honeypot utilities to fight bot form submissions django-mediasync sync media with S3 … -
Django 1.1 Released
The Django project just announced that v1.1 is ready! Go here for the full release notes. Some notable changes include support for aggregate functions from within the ORM. This includes COUNT(), MAX(), MIN(), etc. Also, the concept of "unmanaged" models which allow you to easily support tables that pre-existed or were created by some other [...] Related posts:Setup Python 2.6.4, mod_wsgi 2.6, and Django 1.1.1 on CentOS 5.3 (cPanel) jQuery 1.4 Released Adventures in Django and Python – Part III -
Personal Site Sprint
The beginning of August, following my relocation to Charlotte, will kick off the Personal Site Sprint along with my friends Chris Harrison and Bryan Veloso. The sprint will end with a launch date of September 1st. What this means is we will all be redesigning and documenting the process of our personal site refresh. I will be detailing the process from initial pencil sketches all the way through to final launch. I might even throw in some screencasts. I am also going to take this opportunity to leave Movable Type in favor of Django. This is something I've wanted to do for a while and haven't had the time or energy to do. Personal projects are a PITA so I'm hoping that doing the sprint with two other great designers will keep me motivated. -
Django 1.0 Template Development: Sample Chapter “Serving Multiple Templates”
DISCLOSURE: I was sent this sample chapter by the publisher. I'm sure some of you folks will find it useful so I'm posting it. For a review of the book go here. Download Sample Chapter 6 "Serving Multiple Templates" Related posts:Setup Python 2.6.4, mod_wsgi 2.6, and Django 1.1.1 on CentOS 5.3 (cPanel) 8 Books To [...] Related posts:Setup Python 2.6.4, mod_wsgi 2.6, and Django 1.1.1 on CentOS 5.3 (cPanel) 8 Books To Get A Developer For The Holidays Django and Python First Impressions – Part II -
Serving multiple templates
-
Django 1.1
Django 1.1 is nearing a release and from what I can see about the new features the two most exciting one (to me at least) are improvements from the models end that is the "managed" model and the "proxy" models. Managed models would be good for existing tables that should not be managed by django. This is useful in some of my projects in which I am using django for database work but do not necessarily need django to manage it. Now if only the database evolve stuff or database versioning stuff: http://paltman.com/2008/jul/03/managing-database-changes-in-django/ could be integrated into the core, now that would be superb!Talking about migration too, is this project: http://code.google.com/p/dmigrate/ still alive. Doesn't look like there are any downloadable stuff. The examples are half of what I need what I further need is the ability to undo db migration changes between revisions. -
django-renderformplain
django-renderformplain is a Django app that allows you to render forms in plain text. I have found myself implementing quite a bit of styling into my forms and thought why do it once more when I want to render just the data. Renderformplain works both with bound forms (renders bound data) and unbound forms (renders [...] -
The lack of magic in Django
...or why Rails and Zope 2 were too magical. -
Summer Spam
Spam is occupying more than its customary share of my attention in recent weeks. I've long had a morbid fascination with sleazy human communication (hence Purportal.com). That makes the always-relentless stream of spam, though not exactly welcome, at least interesting. Spam volume also seems to have increased during this period. The number of spam attempts my mail server rejects per day had been steady at around 3,000 for months. Now it's back up around 5,000 or 6,000. I run my own mail server and fight spam via greylisting, blacklisting, and other strict technical rules. This setup rejects 99+% of the spam aimed at the domains I host, but some still gets through to me. Never enough to displace real mail, but enough to keep my little hobby-interest alive. Here are some of the spam highlights of my summer so far: After one too many identical HTML spams, I took the rare step of adding a custom rule to my mail server config. I started rejecting all mail with "Content-Type: text/html; charset=us-ascii". In this age of Unicode, that's turned out to be a pretty safe bet. Lots of rejections and no known false positives. I received a weird email about money … -
On "magic", once again
So it seems Giles Bowkett is upset about use of the word “magic”. I’m happy to agree with the general consensus from various fora that the specific article he’s complaining about is, well, pretty much content-free. I could read that post over and over and still have no idea what actual things the author liked about Django or didn’t like about Rails. But I’ve pretty much learned to ignore content-free hype, and that’s what I ... Read full entry