Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Going international, pt. 2: URL design
To help myself developing the international part of this blog, I've made some usage scenarios, which I write down here, partly to not forget them but mostly to help find any mistakes and omissions. So here they are: The users: Giannis (Greek, computer savvy user, has his browser correctly set) Takis (Greek, lives abroad, doesn't have access to the language settings) I could also define two English users in similar situations, but there's no point as it turns out that they just mirror each other. I have to point out a seemingly little-used preference of web browsers, the language selection preference. This sets the HTTP header 'Accept-Language' so that a server can know, erm, the language preference. This is basic stuff but not many users bother to change from the default setting. URLs and design The pages: /el/1/ Direct link to a greek page, content isn't available in english. /en/2/ Direct link to an english page, content isn't available in greek. /el/3/ Direct link to a greek page, content is available in english. /en/3/ Direct link to an english page, content is available in greek. Also, there are two little flags on the top right of the site that allow … -
djanger = Django developer
Durante uma conversa com o Marinho, onde estávamos falando sobre a falta de sistemas em django, como cms, blogs, wikis e acabou saindo uma nova expressão: djanger, onde djanger é a pessoa que utiliza o django.Sent at 12:22 PM on SaturdayAndrews Medina: heheh verdade :pMarinho Brandão: … e ir oferencendo o serviço a djangers (essa expressão eu acabei de inventar… ehhe ) e ganhar dinheiro com AdSenseNessa conversa tambem nasceu um novo projeto o 'bingo!'. Ainda não sei se será esse nome mesmo, mas em breve terão notícias sobre ele. -
Captcha no django
Você quer evitar spams em seus sistemas feitos em django?Seus problemas acabaram! Existe um projeto opensource da verificação capctha para django. Este projeto utiliza os newforms o que é algo muito bom, já que a maneira antiga de tratar formulários no django tende a ser extinta.Para saber mais sobre o projeto acesse: http://www.lostlogicx.com/captchasblow/ -
Enfim o django 0.96
Dia 23 de março foi anunciado no blog oficial do django o lançamento da versão 0.96 do django.O objetivo principal dessa versão é deixar estável, algumas coisas que foram iniciadas na versão 0.95 e nisso haverá incompatibilidades na mudança de versão.A principal incompatibilidade está relacionada ao driver para MySQL, o MySQLdb. Se a versão que você utiliza for anterior a 1.2.1p2, você terá que colocar no settings 'mysql_old' em vez de 'mysql', se a versão do driver for a 1.2.1p2 ou mais recente continua a mesma coisa.Como muitos ja esperavam, o newsforms que é a nova biblioteca para geração e manipulação de formulários é a padrão. Se você quiser continuar usando os oldforms é só importar os oldforms como forms da seguinte maneira:from django import oldforms as formsEntre as outras novidades está:Uuma ferramenta para testes.Melhoria na parte de serialização, com novos formatos, suportando JSON, XML e Python ( gerando listas, dicionários, strings )Melhorias também na configuraçã ode URLs, antes só era permitido strings com o caimnho inteiro indicando uma função duma view, agora é possível importar essa função com o import do Python e apenas chamá-la. Ex:from django.conf.urls.defaults import *from mysite.myapp.views import myviewurlpatterns = patterns('', ('^myview/$', myview))E para finalizar foram … -
Mais um site feito em django com o fonte liberado!!!
Tá virando mania mesmo!Tudo começou quando o JeffCroft resolveu liberar o código fonte de uma projeto que ele tinha feito em django o LOST-theories.com. Esse foi seu primeiro projeto em django. Mesmo com o grande crescimento da comunidade OpenSource e com a idéia de que algo assim poderá ajudar muitos a aprenderem a fazer o que você sabe, podendo ajudar a comunidade estarem bem difundidos, ainda é raro vermos algo assim.Lógico que tem projetos opensource em várias linguagens são faceis de achar, como o Drupal por exemplo. Mas liberar o código fonte de um site comercial, só para mostrar como foi feito é algo que não se vê todo dia.Muita gente viu e curtiu! E o resultado disso foi mais dois sites repetirem o ato: o CheeseRater e o DjangoSnnipets.org.Vendo a ação feita pelo pessoal do DjangoSnnipets, o Chris McAvoy liberou através do google code, um projeto para podcasts em django.Nisso já são 4 projetos, um vendo o outro e seguindo o exemplo. Isso me faz lembrar do filme: 'A corrente do bem'.Agora falta só você também fazer parte dela ( e eu também né ).A comunidade django agradece!Ai estão o link para os fontes dos projetos:http://code.google.com/p/tastebud/http://code.google.com/p/cab/ http://code.google.com/p/django-registration/http://www.cheeserater.com/ ( o … -
Django + Apache no Windows
Com a crescente divulgação do django aqui no Brasil, muitos estão começando a testar e usar esse WebFramework.A maioria dos desenvolvedores usam o 'manager.py runserver' para fazerem seus testes com django no windows, ou por falta de necessidade de usaru m servidor para testes ou por não conseguir configurar um.No post de hoje vou mostrar a instalação e configuração do Django em ambiente Windows utilizando apache + modpython.Os programas utilizados são:Python 2.4.4Apache 2ModPython 3.2.8Django 0.95.11 - Instalando o PythonPara instalar o Python no Windows é só dar duplo clique no arquivo .msi e seguir o guia de instalação2 - Instalando o ApachePara instalar oapache no windows é só dar um cuplo clique no executável e seguir o guia de instalação.Para testar o apache é só acessar http://localhost3 - Instalando o modpythonPara instalar o modpython é só dar um cuplo clique no executável e seguir o guia de instalação. No final da instalação é só informar a pasta em que o apache foi instalada.Depois abra o arquivo 'http.conf' que fica dentro da pasta 'conf' do apache e adicione esta linha:LoadModule python_module modules/mod_python.so4 - Instalando o djangoDescompacte o arquivo .tar.gz baixado no site do django.Abra o prompt de comando, geralmente encontrado em … -
Lançado o Bingo!
Depois do anúncio aqui está o lançamento. Este ainda não é o lançamento oficial, mas já está disponível no google code o código fonte do bingo. Para quem não sabe o bingo é um CMS desenvolvido em django. O blog, wiki, feeds RSS e atom já estão em funcionamento, mas há várias coisas a serem resolvidas, como os comentários e cadastro de usuários. Para as tags usamos o django-tagging. O marinho, meu parceiro no desenvolvimento do bingo colocou uma versão do bingo no ar para ver acesse http://marinho.webdoisonline.com/blog/. Também foi criado um grupo de discussão para o grupo de desenvolvimento do bingo. Se quiser participar é só se inscrever. O e-mail do grupo é bingo-developers@googlegroups.comSó lembrando que ainda não foram lançadas nenhuma versão release, mas em breve lançaremos o 0.1.Para acessar o código fonte do bingo via svn use:svn checkout http://bingo.googlecode.com/svn/trunk/ bingo -
CMS em Django? bingo!
Depois de um tempo de pesquisa concluí:Ao contrário das outras tecnologias, não há nenhum CMS, Wiki ou algum sistema do tipo feito em django.Se pensarmos em zope, pensamos em plone. Se pensarmos em php logo vem wordpress, phpnuke, phpbb. Se pensamos em java temos o JavaBB, JavaFreeCms entre outros.Mas porque não há nada parecido em django?Uma das razões é porque é tão facil criar um wiki no django que ninguem vai querer um pronto.Foi ai que decidi: vou criar um CMS feito em django e seu nome será bingo.O bingo integrará Wiki, Blog, Galeria de fotos, feeds entre outras coisas.O grande barato do bingo é que o foco dele não serão somente os djangers, e sim pessoas comuns que querem ter seu wiki ou seu blog ou páginapessoal, sem precisar mexer nos códigos.Mas, quando anuncei o bingo! na lista de e-mails do django-brasil, muitos djangers se interessaram, e ainda mais, se alistaram para ajudar o projeto. E ainda mais o site da comunidade django-brasil usará o bingo!.O bingo! ainda é um projeto em nascimento, mas já nasceu com o pé direito.Está querendo ajudar? Está ancioso para utilizar?Aguarde..... -
How to add a preview page
When using the django web administration page to add blog posts, it's nice to be able to preview the post to catch layout glitches, typos and markup issues. The best way to do this is to have a preview page. To add a preview page, the model should have: a boolean field that determines whether the post is public or not a smart get_absolute_url function. Separate your posts The first is easy: is_public = models.BooleanField(default=False) Make your URLs smart The second: def get_absolute_url(self): if self.is_public: return "/%s/blog/%s/%s/" % (self.language, self.pub_date.strftime("%Y/%m/%d").lower(), self.slug) else: return "/%s/blog/preview/%d" %(self.language,self.id) The django admin uses the get_absolute_url function to put a "Display on site" button on an object's page. So when you have public entries, you get to see what all the world sees, but when an entry is not public, the get_absolute_url function returns a special url. Add a pre-view The final piece to the puzzle is to have a view that is protected: @login_required @user_passes_test(lambda u: u.is_staff) def entry_preview(request, entry_id): entry = get_object_or_404(Entry, pk=entry_id) return render_to_response('entry_detail.html', {'entry':entry}, context_instance=RequestContext(request)) I use the is_staff property, but this can easily be changed to something else. Don't forget to add the relevant url to your urls.py : (r'^preview/(?P<entry_id>\d+)/$', … -
Going international, pt. 1
Introduction From the start, I was interested in making the content posted here available in two languages: Greek and English. This is no small feat, and I thought long and hard on how to make it possible and get it working just the way I like it. So here is a rundown of how internationalization works here: The prerequisites are not many: Make the content available in both languages. Make the interface available in both languages. I have slacked and made the tags English-only. Maybe I'll fix that later on, but it'll do for now. Approaches Now, you have two choices about making a site handle international visitors. You either: let them decide what language they prefer, by providing the choices somewhere in your interface or, try to use their request data (like the IP address, or the language preference sent by their browser) to decide their preferred language. The first approach is the most foolproof, as a user explicitly chooses his language. He can't be wrong, can he? But, there is a snag: what is the first page he sees? If it is in his own language, there's no problem. But if it is in another language, he'll get … -
Django Quick Tips #2: Image Thumbnails
One of the most common tasks in web development is resizing uploaded images into thumbnails of the original. Today I’ll ... -
Building My Django Weblog: Part 6
Very early on, when I was still playing with the look and layout of the website, I asked my friend Lisa. At the time, I was still just running the django development server. Anyway, Lisa has a great mind for web standards and the evolution of web markup. So she immediately picked up on the fact that my pages had a doctype of Transitional HTML 4.01 and gave me quite a bit of a lecture on things I should do instead. She recommended going with at least strict HTML 4.01, but preferably with XHTML. At the time, I wasn't sure what any of that meant (and I'm even still learning my way through it). So, anyway, I launched the website a few weeks later, with a few things not quite working the way they should have been. Content types were one of those things. One of the first bugs that got reported was by James Rowe: he saw, in my atom feed, that lists and block quotes and other things had embedded paragraph tags (<p>...</p>). And so in some cases, I had nested paragraph tags. Here's what happened. In Django's admin, when you have a text field, you just type … -
Django Internships at the Journal-World
I’m extremely excited to announce our new internship program here in Lawrence. Starting this summer we’re going to be hiring interns to join our kick-ass team and learn the ropes. If you’re a student, or if you’re trying to break into the world of next-generation web development, I can’t think of a better place to get started. You’ll get to spend up to six months developing cool toys (in Django, of course), live in one of the coolest towns in the country, and learn web development from the best. -
Upgrading Ubuntu for Django Users
I just updated my Slice from Ubuntu Dapper (6.06.1), the currently available version from Slicehost, to Ubuntu Feisty (7.04). I ... -
Amazon S3 Updates Pricing
Amazon just sent out an email to AWS developers. S3 has a new pricing model, which actually reduces cost: Current ... -
Another django-restful-model-views Update
As I mentioned a few weeks ago, Andreas Stuhlmueller has proposed a general REST API for Django, and as his ideas and mine seemed very compatible, we began talking about collaborating on a joint solution. -
[EN] Django model managers, Do Not Repeat Yourself !
I've recently come up with a great django feature "model Managers".Each django model has it's own manager class, which can be overriden by your custom class.Let's say there's a model containing fields:class Person(models.Model): name = models.CharField(maxlength="100", blank=False, verbose_name="Your name") age = models.IntegerField(verbose_name="Your age") def __str__(self): -
[EN] Django extending User, custom User methods
Django doesn't allow to subclass the User model yet.Each Django model lets you easily create model methods.Behind the scene, each django model has its own methods, f.e. save()which saves the model data into the database.Django provides the lightweight User framework in "django/contrib/auth/",where "User" model is defined with fields:username, password, is_staff, first_name, last_name, email, -
URL Pet Peeves
One of the best features of Django is the clean URL structure. The following is an example of what could ... -
Building My Django Weblog: Part 5
The time came for me to start thinking about where to host my site. And although I have some experience with using dreamhost to host sites, I wasn't particularly thrilled with that idea. Instead, I started thinking about using a VPS. That would allow me to use gentoo linux as my hosting environment, and it meant that I wouldn't have to hack around and do clever things just to run django behind apache and mod_python. Added to that, regular hosting is about 10 US dollars a month, while a VPS is about 20 a month. I decided to go with VPS Land because they offered the best price point for the feature list. And they've proved to be an excellent provider in all the time I'd been with them. (I switched out to linode simply because a friend of mine is there, and I have to represent and keep it real). Anyway, after upgrading gentoo and installing django on my VPS it was time to start opening up the testing to other people to get their feedback on various features. One of those features was the look of the site. Since I'd already decided on a layout, it was time … -
Building My Django Weblog: Part 4
In one of my earliest blog posts, I wished my sister a happy birthday. Today is exactly two years since, so Happy Birthday to Sindhu :) Edit: My sincerest apologies to all your feed readers -- my blog programming skills are not good enough, apparently, to keep drafts from getting published. I thought I'd fixed the problem this morning, before getting on the plane in San Jose to return Boston, but apparently not. I don't think I even fixed the feed, so I'm not entirely sure what it was I fixed. In any case, my humblest apologies to everyone for the inconvenience caused. I hope it doesn't put you off my blog. It definitely shows how much I have yet to learn. I like to get my news from reddit usually. The nice thing about reddit is that there tends to be a variety of stories, and every so often you get a gem of an article about CSS. So, for example, you get a menu of css techniques, or you find out about Yahoo's javascript and CSS library--yui, and reading these open up possibilities. So, I've never delved into web-two-point-oh stuff yet. The last line of Javascript I ever … -
O MVC, o MTV e o Django
Como muitos sabem, MVC ( Model – View – Controller ) é um padrão de desenvolvimento, que é um padrão que separa o desenvolvimento nessas 3 camadas. Model – nessa camada é implementada o banco de dados ou o modelo objeto-relacional. Controller – nessa camada é implementado as regras de negocio, onde são processados os dados vindo camada Model e passados para a camada View. View – nessa camada é onde fica a interface do sistema. O MVC é muito utilizado nos dias de hoje e tem agradado a muitos desenvolvedores para web por separar a parte de programação de dados da parte da programação visual de um sistema feito para web, onde geralmente essas partes de um sistema são feitos por pessoas diferentes. Em conseqüência ao aceitamento desse padrão pela comunidade, surgiram muitos frameworks que implementam esse padrão como o Ruby on Rails, Struts, Mentawai, TurboGears, Django entre muitos outros.Como citado acima o desenvolvimento usando o django é feito de acordo com o MVC separado nessas 3 camadas. Até ai tudo perfeito, mas há um problema. Qual problema? O django usa as nomenclaturas para as camadas,diferente do modelo MVC. Para modelo o django usa model, para view ele usa … -
Building my Django Weblog: Part 3
One day, while searching for something Django related, I ran into a really nicely done Django weblog. What caught my attention here, is that he came up with a way to spiffy up his comments display by showing a country flag for each commenter. It looks really spiffy. So I decided to play copycat. Well, it only took a few minutes to implement it in the testing version of my own blog, and I showed it off to a couple of my friends in IRC. One of them, tjfontaine, said something along the lines of "oh neat, libgeoip." Obviously, I hadn't seen or heard of this libgeoip thing so I asked him about it and he linked me to it. Now this was interesting, because it comes with python bindings. And the best part, of course, is that it is in portage. So I installed it, and had a look at their usage sample. Essentially, you just download their ip to country map, which they update once a month, and so you don't have to hit their servers everytime you do a lookup. Next up, I wrote the templatetag to use GeoIP. In its entirety, it looks like this: from … -
Building my Django Weblog: Part 2
Up until a few days ago, my Django blog application was violating DRY. Well, let's be honest, it probably still is, but this one was a blatant violation. What happened was that I wanted to be able to add users to my system without necessarily having them listed as bloggers, since I'm hoping to provide, in the future, gallery, mail and other miscellaneous services to the extended Kulleen clan. To solve that I created a Person class which had a foreign key into Django's own user class, plus some extra fields. Two of those fields were first_name and last_name, so that meant that for each blogger, I had to enter their names twice. Silliness, I tell you! Now, I'd read James' article about extending the User model late last year, during the early stages of my django learnings. And to be honest, I didn't really understand the implications. All of a sudden, two days ago, it hit me! So, I made a few changes to my blog to make use of that technique. My code went from this: class Person( models.Model ): first_name = models.CharField (maxlength = 100) last_name = models.CharField (maxlength = 100) user = models.ForeignKey ( User, verbose_name="Associated … -
Django Registration for Newbies
I recently turned my attention to user account management in Django and what follows are (cleaned-up) notes I made while exploring the django-registration contribution. As a result, this post is very introductory and task oriented, but hopefully, it will help orient newcomers like me to what's available and provide a foundation for exploring these topics in more depth.