Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Django internationalisation
Multilingual web site with djangoI have been recently working on a web application that needs to support several languages, English and French among others. This web application is built on top of Django which has a nice built in support for internationalisation, also known as i18n. However along the road of building this web application I have noticed some gaps between what was existing and what I was trying to achieve.Here it is the list whithout any particular order:- a multilingual flatpages- a way to explicitely use display the language code (ie fr for French and en for English) directly in the URL. I do prefer http://yml.alwaysdata.net/fr/help instead of http://yml.alwaysdata.net/ and rely on the browser settings to direct my user the right page. In addition I have the feeling that this would result in a much better indexation by search engine like Google or Yahoo, ...- a simple UI to set the language.The good news is that after some time, search and chat on IRC I have found a way to close all of them.Multilingual flatpagesThis has been amazingly simple thanks to django-multilingual, a library kindly developped by ???. In a matter of one or two hours I have forked … -
Rolling your own simple authentication system for Django
Sometimes you need to roll a simple authentication system for Django. For example, I just hacked a client interface on our corporate intranet at GMTA, using a similar approach as the one I will describe here. The solutions consists of four parts: Extending the model to include a password Login form Login / Logout views A login_required decorator for views to require authentication Extending the model In order for us to authenticate a Client we need to add a password to the model. As it is not good practice to store passwords in plain text in the database, we will store the password as a salted hash. In this example I will use the SHA-1 secure hash function. We will add two functions to the Client model in order to handle the hashing itself. This is also helpful if we later in the project decides to change the hashing algorithm used. The two functions and the password field: password = models.CharField(maxlength=40) def update_password(self, new_password): self.password = sha.new(settings.PASSWORD_SALT + new_password).hexdigest() def check_password(self, password): hsh = sha.new(settings.PASSWORD_SALT + password).hexdigest() return hsh == self.password In order to update the password for a Client we just call the update_password method - as well as … -
Rolling your own simple authentication system for Django
Sometimes you need to roll a simple authentication system for Django. For example, I just hacked a client interface on our corporate intranet at GMTA, using a similar approach as the one I will describe here. The solutions consists of four parts: Extending the model to include a password Login form Login / Logout views A login_required decorator for views to require authentication Extending the model In order for us to authenticate a Client we need to add a password to the model. As it is not good practice to store passwords in plain text in the database, we will store the password as a salted hash. In this example I will use the SHA-1 secure hash function. We will add two functions to the Client model in order to handle the hashing itself. This is also helpful if we later in the project decides to change the hashing algorithm used. The two functions and the password field: password = models.CharField(maxlength=40) def update_password(self, new_password): self.password = sha.new(settings.PASSWORD_SALT + new_password).hexdigest() def check_password(self, password): hsh = sha.new(settings.PASSWORD_SALT + password).hexdigest() return hsh == self.password In order to update the password for a Client we just call the update_password method - as well as … -
Django Menuing System
On most of the websites that I've built with Django, I have had a desire to be able to manage little elements of the website from the Django administration screen without having to touch my templates. My intent is for the templates to become the presentation vehicle, with anything that matters being built out of the Django databases. One such thing that I want to keep out of my templates is navigation. Sure, the template has a place for navigation (including an empty ), but the contents of my navigation bars are driven by a dynamic Django application. The application has but two files: the models and a template tag. First up is the model file, menu/models.py: from django.db import models class Menu(models.Model): name = models.CharField(maxlength=100) slug = models.SlugField() base_url = models.CharField(maxlength=100, blank=True, null=True) description = models.TextField(blank=True, null=True) class Admin: pass def __unicode__(self): return "%s" % self.name def save(self): """ Re-order all items at from 10 upwards, at intervals of 10. This makes it easy to insert new items in the middle of existing items without having to manually shuffle them all around. """ super(Menu, self).save() current = 10 for item in MenuItem.objects.filter(menu=self).order_by('order'): item.order = current item.save() current += 10 … -
Django Menuing System
On most of the websites that I've built with Django, I have had a desire to be able to manage little elements of the website from the Django administration screen without having to touch my templates. My intent is for the templates to become the presentation vehicle, with anything that … -
Django Brasil no ar!
Após grande expectativa, está no ar o site da comunidade Django Brasil (http://www.djangobrasil.org/)! O objetivo é ser um veículo de divulgação deste framework em terras tupiniquins, trazendo informações para auxiliar tanto os iniciantes quanto os mais experientes.Atualmente o site fornece: as principais características do Django; um weblog para anúncios e avisos à comunidades brasileira; uma página exclusiva para a comunidade descrevendo como um desenvolvedor pode participar; um agregador de blogs (planeta) dos desevolvedores nacionais, e; uma área específica para a documentação. A documentação e tradução da documentação oficial ainda é escassa. Convidamos os interessados em traduzir ou produzir conteúdo em língua portuguesa para suprir essa necessidade.Este é apenas o início de uma nova fase da comunidade Django Brasil. Participe!O site foi desenvolvido pelo Guilherme Mesquita Gondim (semente) e o belo desing pelo Jader Rubini (http://jaderubini.wordpress.com). O código é livre e pode ser acessado no seguinte endereço: http://code.google.com/p/djangobrasil/. -
Django Brasil no ar!
Após grande expectativa, está no ar o site da comunidade Django Brasil! O objetivo é ser um veículo de divulgação deste framework em terras tupiniquins, trazendo informações para auxiliar tanto os iniciantes quanto os mais experientes.Atualmente o site fornece: as principais características do Django; um weblog para anúncios e avisos à comunidades brasileira; uma página exclusiva para a comunidade descrevendo como um desenvolvedor pode participar; um agregador de blogs (planeta) dos desevolvedores nacionais, e; uma área específica para a documentação. A documentação e tradução da documentação oficial ainda é escassa. Convidamos os interessados em traduzir ou produzir conteúdo em língua portuguesa para suprir essa necessidade.Este é apenas o início de uma nova fase da comunidade Django Brasil. Participe!O site foi desenvolvido pelo Guilherme Mesquita Gondim (semente) e o belo desing pelo Jader Rubini (http://jaderubini.wordpress.com). O código é livre e pode ser acessado no seguinte endereço: http://code.google.com/p/djangobrasil/. -
Usando o ZODB no Django
Ter a flexibilidade da orientação a objetos do Python em um banco de dados pode ser algo muito útil e interessante que utilizar bancos relacionais. Um dos melhores bancos orientado a objetos em Python é o ZODB , é poderoso e simples de utilizar.Mas como utilizar ele para web?A resposta mais óbvia é Zope e Grok . São dois frameworks para web que utilizam ZODB como base de dados!A resposta não tão óbvia é o Pylons . O Pylons é um framework que trabalha através de camadas (middlwares) onde você uma dessas camadas pode ser a implementação para suporte a ZODB.E a resposta nada óbvia é o Django. O Django é um framework famoso pela sua coesão, mas isso não quer dizer que ele não pode ser facilmente integrado com outras ferramentas. Uma das provas disso é o tranquil, uma middlware que integra o Django ao SQLAlchemy .Inspirado pela necessidade de usar o ZODB , por não querer usar Grok , Pylons ou outro e pela implementação do tranquil, implementei o django-zodb, uma middlware que integra o Django ao ZODB.O endereço do projeto é: http://code.google.com/p/django-zodb/Para instalar o projeto basta ler a página do wiki do projeto: http://code.google.com/p/django-zodb/wiki/InstallationNo projeto tem um … -
Case-insensitive ordering with Django and PostgreSQL
When the Django Gigs site first went live we noticed the ordering of developers by name was not right. Those starting with an uppercase letter were coming before those starting with a lowercase letter. PostgreSQL and the locale PostgreSQL has a locale setting which is configured when the cluster is created. Among other things, this affects the ordering of results when you use the SQL order by clause. The local on my server was set to “C” which means it uses byte-level comparisons, rather than following more complex rules for a given culture. Although this is apparently good for performance, it means order by will be case sensitive – e.g. “Zebra” comes before “apple”. Depending on how your system is set up, you may have locales such as en_GB. The locale can’t easily be changed in PostgreSQL because indexes and other data depends on it. To change locale, you need to start a new cluster and move databases to it. Django and case-sensitivity Django provides the order_by() function on QuerySets, but does not have an option for case insensitive ordering. Instead this is left to your database configuration. When using SQL directly, you can sort case-insensitively using the PostgreSQL lower() … -
WebService with PHP Server and Java Client
For my current private project that answers to the nice name "Telrunya" I'm trying to access a PHP web service through a Java client. I once heard in a .NET codecamp that WebServices are super cool and that it doesn't matter in which language they are implemented. But that doesn't apply if you're communication between 2 different technologies. In the Guxx blog I found the reversed case, how to access a java server through a PHP client. There is also a Java bridge developed by Zend that manages the conversion of the objects. But that seems to be an independent server or at least a server modul but that isn't considered by me. (furthermore it costs money) Anyway, I tried the whole thing withion NetBeans IDE with JAX-WS. My WSDL file (document) written in Eclipse was successfully parsed and the Java files for client etc. were created. The client was also able to access the service but it failed to convert the values. Monitoring the HTTP traffic I can see that the right values are returned, but the Java client returns "null". I already read a lot of documentations and tutorials but I didn't find out anything about converting the … -
WebService with PHP Server and Java Client
For my current private project that answers to the nice name "Telrunya" I'm trying to access a PHP web service through a Java client. I once heard in a .NET codecamp that WebServices are super cool and that it doesn't matter in which language they are implemented. But that doesn't apply if you're communication between 2 different technologies. In the Guxx blog I found the reversed case, how to access a java server through a PHP client. There is also a Java bridge developed by Zend that manages the conversion of the objects. But that seems to be an independent server or at least a server modul but that isn't considered by me. (furthermore it costs money) Anyway, I tried the whole thing withion NetBeans IDE with JAX-WS. My WSDL file (document) written in Eclipse was successfully parsed and the Java files for client etc. were created. The client was also able to access the service but it failed to convert the values. Monitoring the HTTP traffic I can see that the right values are returned, but the Java client returns "null". I already read a lot of documentations and tutorials but I didn't find out anything about converting the … -
WebService with PHP Server and Java Client
For my current private project that answers to the nice name "Telrunya" I'm trying to access a PHP web service through a Java client. I once heard in a .NET codecamp that WebServices are super cool and that it doesn't matter in which language they are implemented. But that doesn't apply if you're communication between 2 different technologies. In the Guxx blog I found the reversed case, how to access a java server through a PHP client. There is also a Java bridge developed by Zend that manages the conversion of the objects. But that seems to be an independent server or at least a server modul but that isn't considered by me. (furthermore it costs money) Anyway, I tried the whole thing withion NetBeans IDE with JAX-WS. My WSDL file (document) written in Eclipse was successfully parsed and the Java files for client etc. were created. The client was also able to access the service but it failed to convert the values. Monitoring the HTTP traffic I can see that the right values are returned, but the Java client returns "null". I already read a lot of documentations and tutorials but I didn't find out anything about converting the … -
Stockphoto 0.2.1 released
I've just released stockphoto 0.2.1. This is a bugfix release and contains no new features relative to 0.2. I would ... -
Stockphoto 0.2.1 released
I've just released stockphoto 0.2.1. This is a bugfix release and contains no new features relative to 0.2. I would like to thank many people for bug reports on the previous version; plese see the credits in the README file. I'll be opening development on stockphoto 0.3 once I decide the best way to host a public version control repository (Google code vs. Savannah, vs self-hosting). The pre-0.3 branch will include new features, some of which are listed as to-dos in the current README. -
Django Book Update
A quick update on the Django Book: Adrian and I wrapped up the last few bits last week, and the book went to the printer on Friday. It should start shipping to bookstores around the second week of December. There’s still a fair amount of work that needs to be done on the website, so I can’t put the final version of the book up just yet. However, the final book will be available online around the same time as the dead tree version. -
Segundo Django Sprint dia 1 de Dezembro
Sprint é um evento onde os desenvolvedores, colaboradores e simpatizantes com alguma ferramenta opensource se unem para implementar novidades de arrumar erros existentes nessa ferramenta. E dia 1 de Dezembro ocorrerá o segundo Django Sprint desse ano. Para participar do Sprint, inscreva-se na página do wiki do Django e no dia do Sprint fique atento no canal #django-sprint, onde todos os envolvidos com o Sprint e os responsáveis pelo código do Django estarão para auxiliar e tirar dúvidas. Se você ainda não conhece o processo de criação de tickets, envio de path's utilizado no desenvolvimento do Django, leia esse artigo: Contributing to Django. -
benchmarking Django Queue Service
I took some time this afternoon to benchmark out the work we’ve been doing with the Django Queue Service. We haven’t done anything to optimize it, and we’re starting to push in some code to make it fully support REST … Continue reading → -
6 Weeks with Ruby
When I left Cuker Design to work for Slicehost I made the transition from Django to Ruby on Rails. Some Ruby conventions are similar to Python, but many threw me off a bit. Here's what I discovered after 6 weeks with Ruby and Rails. -
Bug patches for django-voting and django-tagging
As part of my top-secret Django project, I’ve enlisted the help of the django-voting and django-tagging packages to provide rating and tagging, respectively, to my models. These work wonders and serve their purpose to a T, however, I’ve come across a couple small bugs that I wanted to document here, in addition to the bug [...] -
Wanted - Engaged Djangonauts
I've spent the last year or so building a Django-powered bridal gift registry service. It allows you to easily list desired gifts in a simple online format, for your guests to select and purchase for you. It works pretty well - my wife let me use it for our own wedding, afterall. It's also stood up to a half-dozen other weddings, who have all provided fantastic feedback which I've put into place. I'm just about ready for launch, but I'd like to do a final round of live testing. So, I'm opening it up to Django users worldwide. The criteria? Be getting married in the short-term future Be prepared to provide feedback Be prepared to use public beta software (However, I believe it's stable enough!) Have a [wife|husband]-to-be who is happy to be involved :) In return I'll provide a premium account (value: $40AUD) for you to use from day one. Interested? Just e-mail me at ross at this domain and I'll provide a signup URL. You're welcome to sign up and check it out before committing to using it for your wedding, of course - however if you choose not to use it, I'd love to know what WAF … -
Wanted - Engaged Djangonauts
I've spent the last year or so building a Django-powered bridal gift registry service. It allows you to easily list desired gifts in a simple online format, for your guests to select and purchase for you. It works pretty well - my wife let me use it for our own wedding … -
DjangoPoweredSites Grows Up
After some e-mail discussions with Jacob Kaplan-Moss from the Django team, I've moved all of the sites listed on the old DjangoPoweredSites wiki page to Djangosites.org. It took a fair bit of time to weed out some not-working pages and expired domains (which have, of course, been purchased by spammers and link farmers), and a small investment in extra WebThumb credits to allow me to take screenshots of a fresh 500+ websites, but I got there in the end. We'll now be closing the DjangoPoweredSites wiki page for good, as it has become redundant and is not the best way to peruse 800+ websites. What we're left with is a fantastic directory of websites powered by Django. I'll be putting together a 'Featured' list shortly, but in the meantime I need a little bit of help from the community. All sites scraped from the wiki page are currently unowned. I encourage you to check out the list of unclaimed websites, and e-mail me to let me know which sites are yours so you can receive due credit. There are some great websites listed there, so it'd be fantastic to be able to show off who built them. Thanks to Jacob … -
DjangoPoweredSites Grows Up
After some e-mail discussions with Jacob Kaplan-Moss from the Django team, I've moved all of the sites listed on the old DjangoPoweredSites wiki page to Djangosites.org. It took a fair bit of time to weed out some not-working pages and expired domains (which have, of course, been purchased by … -
Django Queue Service
Work has been continuing apace on the Django Queue Service, mostly through the efforts of Rajesh and Marcus who have really done an outstanding job of filling in the holes in testing and structure for the application to make it … Continue reading → -
Multiple File Uploads in Django
As part of yet-to-be-announced project, I’m working with Django. After only a couple days, I’ve been able to produce some pretty cool results. One of the requirements that I have is that a user be able to upload a bunch of files when editing a form. Using Django’s newforms package, I was able to quickly [...]