Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Django Social Bookmarks
The Django Social Bookmarks app does what you might expect this application to do. It provides an easy and reusable way to get those pesky add to this social network site on a Django site. It currently supports 34 different sites, ranging from the big ones like; twitter, facebook, slashdot, delicious, digg, technorati, strumble to local networks like nujij (Dutch), ekudos and tagmos or netjes (Belgium). All texts in the app use Django i18n so people should have no trouble contributing both links and translations to make it truly comprehensive. After adding social_bookmarks to INSTALLED_APPS and making sure the images are reachable you can use the provided inclusion-tag to add the links in a template. Template example: {% load social_bookmarks_tags %} <div class="content"> {{ content }} {% show_social_bookmarks object.title object.get_absolute_url %} </div> The default inclusion-tag template specifies some simple css classes so you can theme the links without having to write you own template. CSS: /* div around the entire block of links ^/ .socialbookmarks { display: block; } .socialbookmarks strong { font-weight: bold; color: black; } /* individual links */ .socialbookmarks .social { color: #ccc; } /* no borders on images */ .socialbookmarks .social a img { border: 0px; … -
Django localized date template filter
UPDATE! This is going to be redundant in Django 1.2, in which you can add DATE_FORMAT to your django.po files. I’ve often been frustrated that using settings.DATE_FORMAT does not give a localized date. Granted that the name of a month may be localized, but the format string does not change. So let’s start out by modifying settings.py. We wrap our default date format in a ugettext so the makemessages command will detect it, and we need to make it a dummy function, because the i18n library cannot be imported in settings.py due to circularity (it depends on settings.py). ugettext = lambda s: s DATE_FORMAT = ugettext('N j, Y') Run compilemessages and type in your localized date formats. Now we need a template filter that uses a localized format for calling the Django date format function. This is really simple: from django.template.defaultfilters import stringfilter from django.utils import dateformat from django.utils.translation import ugettext from django.conf import settings @register.filter() def localdate(value): """Format date with localized date format""" format = ugettext(settings.DATE_FORMAT) return dateformat.format(value, format) And done. Using the filter is straight forward: Date: {{ my_date|localdate }} -
DjangoCon 2009 en Portland
La próxima DjangoCon tendrá lugar del 8 al 12 de Septiembre en Portland (Oregon). Los primeros 3 días serán de conferencia y los siguientes 2 de sprint. El precio de asistencia está entre los 132$ y los 400$. Tenéis toda la información en la página de DjangoCon, donde también está abierta la propuesta de charlas. -
Announcing pyvcs, django-vcs, and piano-man
Justin Lilly and I have just released pyvcs, a lightweight abstraction layer on top of multiple version control systems, and django-vcs, a Django application leveraging pyvcs in order to provide a web interface to version control systems. At this point pyvcs exists exclusively to serve the needs of django-vcs, although it is separate and completely usable on its own. Django-vcs has a robust feature set, including listing recent commits, pretty diff rendering of commits, and code browsing. It also supports multiple projects. Both pyvcs and django-vcs currently support Git and Mercurial, although adding support for a new backend is as simple as implementing four methods and we'd love to be able to support additional VCS like Subversion or Bazaar. Django-vcs comes with some starter templates (as well as CSS to support the pretty diff rendering).It goes without saying that we'd like to thank the authors of the VCS themselves, in addition we'd like to thank the authors of Dulwich, for providing a pure Python implementation of the Git protocol, as well as the Pocoo guys, for pygments, the syntax highlighting library for Python, as well as the pretty diff rendering which we lifted out of the lodgeit pastbin application.Having announced … -
Jak sprawdzać zgodność kodu Pythona z PEP8
Znalazłem ostatnio bardzo fajne narzędzie do sprawdzania czy kod Pythona jest zgodny z zalecanym stylem pisania kodu w Pythonie(PEP8). Jest to skrypt uruchamiany z konsoli który sprawdza czy wskazany moduł jest zgodny z PEP8. Przykład użycia: $ pep8.py --filename=*.py --show-source --show-pep8 /sciezka/do/projektu/ parts/djangopl/sitemaps.py:14:5: E301 expected 1 blank line, found 0 def changefreq(self, obj): ^ Separate top-level function and class definitions with two blank lines. Method definitions inside a class are separated by a single blank line. Extra blank lines may be used (sparingly) to separate groups of related functions. Blank lines may be omitted between a bunch of related one-liners (e.g. a set of dummy implementations). Use blank lines in functions, sparingly, to indicate logical sections. ... parametry: filename - wzorzec jakie pliki mają być brane pod uwagę show-source - przy każdym błędzie będzie wypisany kawałek kodu i wskazane w którym miejscu jest błąd show-pep8 - do każdego błędu będzie podane wyjaśnienie z dokumentu PEP8 Wynik działania prezentuje się bardzo ładnie i można szybko wychwycić gdzie jest błąd i zobaczyć dlaczego tak nie powinno się pisać kodu w Pythonie. Znalazłem też opis jak zintegrować sprawdzanie zgodności z PEP8 z testami wykorzystywanymi w systemie typu continuous integration: http://www.ajaxline.com/continuous-integration-in-django-project Przydatne linki związane … -
Features of a good Django plugin
Well, my opinion on them anyway. -
Even better than I thought
Yesterday, I blogged about a positive experience I had with Packt Publishing's relationship with Open Source projects. In that blog entry, I called on companies, including Packt, to give more back to the communities that produce Open Source, including financial contribution where possible. It has since been drawn to my attention that Packt already contributes financially to the Django Foundation, as well as other Open Source projects. Packt pays a royalty back to projects when they sell books on an Open Source topic Packt - I salute you again for this excellent policy, and I apologize for the error on my part. My broader comment still stands: there are many companies that derive profit from open source, but give little if anything back to the projects from which they derive that profit. To those companies - I strongly encourage you to follow the example of Packt. -
Doing the right thing
My life has been fairly busy of late. My daughter was born on June 19; Django v1.1 is almost out the door; and we have lots of interesting stuff underway at work. So, when Packt Publishing contacted me asking if I would like to review their recently released book, I declined. I barely have enough time to read books at the moment, let alone review them. However, I asked if I could have a complimentary copy anyway. After all - I am a Django core developer, and if I (and many other people) hadn't volunteered my time to develop Django, Packt wouldn't have a topic to publish a book about. To my surprise, they agreed. Sitting on my hard disk is a freshly downloaded copy of "Django 1.0 Template Development", by Scott Newman. If Django template development sounds like something you might be interested in knowing more about, and you want to know more about this book, a sample chapter is available. I find this kind of attitude encouraging. It would have been very easy to dismiss my request, but Packt took the opportunity to give a little something back to the community that enables them to derive financial benefit. … -
Professionalism
Yes, it’d be nice if contractors kept up to date on the progress of the various building codes. They don’t. There are a lot of people who asked about the building codes in the 1970s and were told (right or wrong) what they were. So they went ahead and learned their trade, build their homes, and chose watching a DVD or spending time with their kids over watching city council do battle over asbestos insulation. -
An if-substring-in-string Django Template Construction
Here's a quick tip for Django template hackers. It's a known fact of Django templates that the syntax is purposefully limited. I've been living with the need for an if-substring-in-string construction. Of course, I could write a custom template tag, but work is quitebusy. So on a whim and a 10 minute break I tried this yesterday, and it worked well for me. Take a look and let me know what you think.First, the problem.Bookmark FormattingI have a custom app for pulling in my Delicious bookmarks and formatting them as link posts here on this site. I include the HTML I want in the original bookmark and have a bit of template code to insert preview images generated by ShrinkTheWeb. When I link a YouTube video, I do a quick cut-n-paste of the video to embed the player, and in these cases, I don't want to include the preview image. In Python, this would be super simple: if 'http://www.youtube.com/' not in link_url: show_thumb() However, Django templates don't have a similiar syntax.A Solution Using {% with %}So here's what I did: {% with link_url|slice:":23" as short_url %} {% ifnotequal short_url "http://www.youtube.com/" %} My ShrinkTheWeb image goes here. {% endifnotequal %} Other … -
Django and nginx settings
Django and nginx settings -
EveryBlock libera su código fuente
Hace un par de días se ha liberado el código de EveryBlock bajo licencia GPL. EveryBlock ofrece noticias e información local sobre barrios de distintas ciudades de Estados Unidos. Se trata de uno de los sitios web más interesantes que utilizan Django. El código fuente se puede encontrar dividido en distintos paquetes en el sitio oficial. El código incluye paquetes que trabajan con información geográfica, el sistema de publicación completo de EveryBlock y hasta un paquete de blog y otro de wiki. -
AvaTint Launched!
The site very simply takes your avatar and turns it into any color you select. The online community is starting to do this to support and protest many things. This is the 2.0 way of making your page background black for a cause. We created this site in 90 minutes using Django on June 19th. I got home from dinner and noticed that some twitter icons were coming in green. This caught my attention because I had suggested yellow to protest Obama's massive government spending a few days earlier. I mentioned this to Rudy Menendez (yes related) and suggested it would be useful for the less tech savvy to create a page to change an avatar's color. We knew the Pyhon package PIL could do this and Rudy found jscolor as a color selection tool. Together we created and deployed this application. The timeline is roughtly as follows: 12:25am CT Floated the idea to Rudy via IM 12:30am CT Created local proof of concept that PIL could handle it 12:35am CT Created local project diretory 12:38am CT Download jscolor 12:56am CT Registered domain 1:14am CT Rudy jokes about test scripts 2:00am CT Start deploy to production server and test 2:10am … -
SVN usability
Okay, time to import this code into SVN. svn import, right? This should be easy! svn import https://...../trunk/ Oh crap, that tried to import everything. ^C Guess I’ll just set svn:ignore. svn propset . svn:ignore svn propset svn:ignore . svn propedit svn:ignore svn propedit svn:ignore . Okay. Can’t do that on a non checkout. Fine. cd .. svn co https://...../trunk/ myproject.svn cd myproject.svn/ mv ../myproject/* . Right, okay. Add some files now. -
MySQL Backup Skript mit Emailversand.
A while ago I found a good script for backing up a MySQL database and sending it via email to a recipient here. The script is cool, but I didn't like its structure and the fact, that you have to add the database values inline and that it can only backup a single database. For this reason I rewrote it a little and you can download it here. Features: Backup of mutliple databases Sending of backups to multiple users For every single database a mail is send and there is no file saved on the server. And wow: it's really easy to configure! How do I use it? Download the current version (0.1) Adjust the backup.php (you're getting help by my wonderful comments) upload everything to a directory of your choice if applicable, create a cronjob to periodically execute the script And here the backup.php that calls the appropriate classes and executes the backup (also included in the download): ini_set('error_reporting', E_ALL);// include the filesrequire_once 'MySQLConfig.php';require_once 'MySQLBackup.php'; // add some databases to backup// the domain will be appended to the email subject and is also included within the sql file for identification.$cfgHost0 = new MySQLConfig('username0', 'password0', 'database_name0', 'domain0');$cfgHost1 = new MySQLConfig('username1', 'password1', … -
MySQL backup script with emailing
A while ago I found a good script for backing up a MySQL database and sending it via email to a recipient here. The script is cool, but I didn't like its structure and the fact, that you have to add the database values inline and that it can only backup a single database. For this reason I rewrote it a little and you can download it here. Features: Backup of mutliple databases Sending of backups to multiple users For every single database a mail is send and there is no file saved on the server. And wow: it's really easy to configure! How do I use it? Download the current version (0.1) Adjust the backup.php (you're getting help by my wonderful comments) upload everything to a directory of your choice if applicable, create a cronjob to periodically execute the script And here the backup.php that calls the appropriate classes and executes the backup (also included in the download): ini_set("error_reporting", E_ALL); // include the files require_once "MySQLConfig.php"; require_once "MySQLBackup.php"; // add some databases to backup // the domain will be appended to the email subject and is also included within the sql file for identification. $cfgHost0 = new MySQLConfig("username0", "password0", … -
MySQL backup script with emailing
A while ago I found a good script for backing up a MySQL database and sending it via email to a recipient here. The script is cool, but I didn't like its structure and the fact, that you have to add the database values inline and that it can only backup a single database. For this reason I rewrote it a little and you can download it here. Features: Backup of mutliple databases Sending of backups to multiple users For every single database a mail is send and there is no file saved on the server. And wow: it's really easy to configure! How do I use it? Download the current version (0.1) Adjust the backup.php (you're getting help by my wonderful comments) upload everything to a directory of your choice if applicable, create a cronjob to periodically execute the script And here the backup.php that calls the appropriate classes and executes the backup (also included in the download): ini_set("error_reporting", E_ALL); // include the files require_once "MySQLConfig.php"; require_once "MySQLBackup.php"; // add some databases to backup // the domain will be appended to the email subject and is also included within the sql file for identification. $cfgHost0 = new MySQLConfig("username0", "password0", … -
MySQL backup script with emailing
A while ago I found a good script for backing up a MySQL database and sending it via email to a recipient here. The script is cool, but I didn't like its structure and the fact, that you have to add the database values inline and that it can only backup a single database. For this reason I rewrote it a little and you can download it here. Features: Backup of mutliple databases Sending of backups to multiple users For every single database a mail is send and there is no file saved on the server. And wow: it's really easy to configure! How do I use it? Download the current version (0.1) Adjust the backup.php (you're getting help by my wonderful comments) upload everything to a directory of your choice if applicable, create a cronjob to periodically execute the script And here the backup.php that calls the appropriate classes and executes the backup (also included in the download): ini_set("error_reporting", E_ALL); // include the files require_once "MySQLConfig.php"; require_once "MySQLBackup.php"; // add some databases to backup // the domain will be appended to the email subject and is also included within the sql file for identification. $cfgHost0 = new MySQLConfig("username0", "password0", … -
Link Exchange For Tough Times
Advertising on Google is getting expensive, very expensive. This year advertising costs for Adwords rose between 40% and 60% for some advertisers. Companies like eBags.com and Babyage.com have seen the cost of advertising online soar to 45% of the cost of the product they are trying to sell. Margins are diminishing and [...] -
Practical Django Projects
June 2009 News Update: The second edition of this book has been released! The 2nd edition of Practical Django Projects has been released making this series of posts redundant! Notes and a practical companion I've been reading James Bennett's excellent Practical Django Projects (PDP), which uncritically I think is the best python based book I've read since I picked up Mark Lutz's Learning -
Psychic IRC Support In 10 Easy Steps
This list is somewhat specific to Django and #django channel on freenode.net. Psychic support is what people are looking for when they expect others to just know their development environment and their code. If one doesn’t supply enough information on the problem, no matter how good a hacker the person on the other end of [...] -
Untitled
hej -
Untitled
hej -
Что такое pip?
Pip это альтернатива easy_install, а как говорят сами разработчики - замена. Как известно easy_install только часть глыбы под названием setuptools. Много копий сломано по поводу нужно ли такие двухголовое чудовище, которое позволяет продвинутым образом собирать питонячьи пакеты и их устанавливать. Или достаточно стандартного distutils. Вот тут pip выступает как противоположность, говоря - я сборкой пакетов не занимаюсь, а только их ставлю. Pip может поставить любой пакет собранный при помощи distutils. Причем только source-пакет - никаких бинарных яиц ему и прочих setuptools'овых прибамбасов. Эта концептуальная простота во многом помогла pip постепенно выйти на уровень широко используемого инструмента в питон-сообществе. Благо и пользоваться им максимально просто: # pip install wna где wna - это некий пакет (для примера я возьму код своего блога). Так же преимуществом pip безусловно является более полезный вывод информации о процессе установки и репортинг ошибок во всяких непредвиденных ситуациях. Помимо уже собранных source-пакетов pip может брать исходники пакетов из систем контроля версий. Поддерживаются subversion, mercurial, git, bazaar. Делая checkout и устанавливая через python setup.py с ключом devel, дает возможность иметь в папке /src/packet_name/ исходный код и при необходимости редактировать его. # pip install -e hg+http://bitbucket.org/daevaorn/turbion/#egg=turbion Где egg=turbion говорит pip чтобы он сделал checkout в /src/turbion/. Очень полезная возможность, … -
sphinx autodoc and django app
Today I have been getting my foot wet with autodoc extension from sphinx. Here it is what the documentation of sphinx say about it :"""Sphinx is a tool that makes it easy to create intelligent and beautiful documentation, written by Georg Brandl and licensed under the BSD license."""I have to say that before today my experience with sphinx as been excellent. It is relatively straightforward to get started once you pass the first little annoyances that come with the fact that you are learning a new tool.The module I have been using to conduct this experiment is django-geotagging this reusable app enables you to geotag any object in the database. If you want to know more about this you can read the sphinx based documentation. This is the goal of the documentation, isn't it ? :-)If adding a manually written documentation is very easy and well documented. The modification required to move from a very primitive documentation written using some rst file to sphinx is shown here. Most of it is automatically generated by : sphinx-quickstart.Taking it a step further have been more difficult than anticipated and this for several reasons : lack of example, and a bugToday I wanted …