Django community: RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Django-treemenus new release 0.4
I have just released the version 0.4 of django-treemenus It does not contain code modifications so you don’t necessarily have to upgrade if you’re currently using it. In fact, this release integrates more languages, so you may be interested if you’re not happy with the standard English version. Thank you to Maxim Oransky for marking a couple of missing strings and for providing the Russian translation. Thank you also to Ido Sebastiaan van Oostveen for providing the Dutch translation. I’ve also added French locale, so that’s now 4 languages including English. Please send me your translations in other languages and I’ll integrate them in future releases. Django-treemenus has been quite stable it seems since the last release. I use it in several projects, and my clients like it simplicity of use (in particular the user-friendly representation of the tree structure in the admin). I’d be happy to hear more feedback, so please let me know how you use this, if you’ve extended or improved it. Any suggestion or testimonial is very welcome! Finally, a couple of things I’m planning to work on in the near future: handle caching and better integration with newforms-admin. -
DjangoProjectLauncher?
I just filed a ticket with the Google AppEngine project requesting the source to GoogleAppEngineLauncher, with the idea that this would make a very cool Django developer's aid on OS X -- much like Locomotive for Rails. Anybody else interested in this should go star it: http://code.google.com/p/googleappengine/issues/detail?id=386 Update: Cool. In less than 24 hours, 38 people have starred the issue, making it the 31st most-requested item and rising -- ahead of hot numbers like "Please add Tcl support". Sorry, Tcl. -
How Do You Fight Spam?
In the last few weeks I’ve been getting an increasingly amount of comment spam. This was expected though — I’ve done nothing to actually keep spam out. For a tiny blog like mine I feel the two traditional ways of blocking spam; user registration and CAPTCHAs, are not very user friendly. As a first line of defense I decided to disable commenting for posts older than 2 weeks. As always with Django, it turned out to be much simpler than I thought. Step 1: Create a template filter The template filter is very straight forward. It takes a date and returns True/False if the date is within 14 days. I hardcoded the limit to 14 days in my example, however it should probably be an setting in settings.py. If you do not know or remember how to create a template filter, Django has some excellent documentation on the subject. 1 2 3 4 5 6 7 8 9 10 11 12 13from django import template import datetime register = template.Library() @register.filter def showcomments( date ): date_adjusted = date + datetime.timedelta( days=14 ) if datetime.datetime.now() <= date_adjusted: return True return False Step 2: Modify the blog template In your blog post template add an if statement … -
Garść nowości.
Trochę informacji na temat co się dzieje w świecie Django. Dodatkowe opcje dla funkcji 'update' w nowym ORM-ie Sebastian Noack napisał rozszerzenie funkcjonalności funkcji update. Dotychczas mogliśmy podać tam tylko stałe wartości (np. foo=42). Z jego rozszerzeniem możemy podać całe... -
AOP aspect of JavaScript with Dojo
Finally: my open source JavaScript project DCL is built on ideas described in this article. Available for node.js and modern browsers, it implements OOP with mixins and AOP at "class" and object level. Read documentation and background articles on www.dcljs.org , clone its code on github.com/uhop/dcl , and follow @dcl_js . If we look at the history of computer programming languages, we can see that practically all new programming methodologies were about one thing: taming complexity. The anarchy of earlier days of procedural programming (example: Fortran) gave way to structured programming (Pascal), which was refined with modular programming (Modula), and was reformulated when object-oriented programing went mainstream (C++, and much later Java). And it stopped there. The focus shifted to different branches of computer programming, namely to functional programming, and, to a lesser degree, logical programming. The only major development in this branch was the rise of aspect-oriented programming (AOP) paradigm. Let’s take a look at AOP in our favorite language: JavaScript, and how Dojo helps the language with dojox.lang.aspect package. -
Pocket Django
At the Western Mass. Developers Group meeting this week I showed a few people some of the unixy fun you can have with a (jailbroken) iPod touch and the Cydia package manager. Cydia is a port of Debian's APT system to the iPhone platform -- i.e. it's a real package manager. It made it a snap to install Python, Mobile Terminal, Mobile Text Edit, Subversion, etc. This is the toolset that has allowed me to even do some work on the book as I mentioned in my last post. And while it has its limitations as a development environment, of course I did get Django running on it. Below are a couple screenshots of an example application from the book. This is my kind of portable computer! -
Web frameworks: a free software oriented study
The web2.0 era has put the web application frameworks at the center of the free software (aka FLOSS) community attention. Various opinions (1,2) and performance (1,2) comparisons have been published by free software enthusiasts trying to rank the quality and the potential of different web frameworks. In this post we use standard data mining and [...] -
Django OperationalError Debugging
So on one of our test servers I was doing some heavy performance testing when I noticed a strange OperationalError exception message in the Debug console for Django: I went digging around and sure enough I had all kinds of locks when I attempted: mysql> SHOW PROCESSLIST; So next I checked the status of the free space available to learn than the partition that the mysql data was on was completely full. So, shutdown mysql and relocated the data to another partition with plenty of room: mysqladmin shutdown mv /usr/local/apache/var/* /new/location/for/files/ Then I changed /etc/my.cnf so that it had the following lines edited or amended: [mysqld_safe] datadir = /new/location/for/files/ Make sure that the ib_logfile files don't remain in the new location: rm /new/location/for/files/ib_logfile* Now restart mysql and verify that everything is working: mysqld_safe & echo "create database testdatabase;" | mysql echo "show databases;" | mysql -
Django OperationalError Debugging
So on one of our test servers I was doing some heavy performance testing when I noticed a strange OperationalError exception message in the Debug console for Django: I went digging around and sure enough I had all kinds of locks when I attempted: mysql> SHOW PROCESSLIST; So next I checked the status of the free space available to learn than the partition that the mysql data was on was completely full. So, shutdown mysql and relocated the data to another partition with plenty of room: mysqladmin shutdown mv /usr/local/apache/var/* /new/location/for/files/ Then I changed /etc/my.cnf so that it had the following lines edited or amended: [mysqld_safe] datadir = /new/location/for/files/ Make sure that the ib_logfile files don't remain in the new location: rm /new/location/for/files/ib_logfile* Now restart mysql and verify that everything is working: mysqld_safe & echo "create database testdatabase;" | mysql echo "show databases;" | mysql -
MySQL, Dates and Time zones, Postgres and Mindshare
A database can’t be all things to everyone. Each one has its sweet spot. MySQL happens to be the Wal-Mart of the database world. A large market sweet spot with lots of really cheap stuff, questionably good for you and serving a basic need. Occasionally, MySQL will let you down with some basic things… like time zones. When you store a date/time, it's often (but not always) important to store the time zone information that came with it. If you think about it, it's not just useful to know it's 1:00pm when you're trying to calculate temporal differences between two dates. You need to know what time zone the date was for. You can just convert the date/time to the local time but then you lose the time zone that was associated with the date originally. A piece of information forever lost! If you always have a time zone associated with a date/time, then importing and calculating dates across multiple time zones is incredibly simple. If not, you have to make assumptions about the time zones that can be confusing and very error prone. But? Does MySQL blend? Dates and time zones that is. MySQL doesn't handle time zones correctly. … -
Default arguments in Python: two easy blunders
I’m glad I stumbled across Patrick Altman’s tweet about a “default bug in Django“. I’d never have guessed you can pass a callable to a field’s default= argument, otherwise. That’s quite a powerful idiom, and I think I’ll use it a lot. To balance the karma, I’d like to post a quick reminder to everyone else that expressions in default arguments are calculated when the function is defined, not when it’s called. In Patrick’s code, for example, all objects created in the same running session got the same timestamp. Try this in the Python interactive prompt: >>>import time >>> def report(when=time.time()): ... print when ... >>> report() 1210294387.19 >>> time.sleep(5) >>> report() 1210294387.19 Until the interpreter quits, you’ll always get the same timestamp. The correct way to go about this is to default to None or some other sentinel, then replace it inside the function: >>> def report(when=None): ... if when is None: ... when = time.time() ... print when ... >>> report() 1210294762.29 >>> time.sleep(5) >>> report() 1210294772.23 Now that you know about that blunder, you should be able to figure out what’s going on with this second classic blunder when using default arguments in Python: >>> def spam(eggs=[]): … -
A Default Bug in Django
Not to say that this is a bug in django but rather a bug in how I had written some of my models. Just wanted to point out a quick tip for anyone else who may have done the same thing as me as well as for any of the django experts out there that might suggest a better way. What was happening was that I began to notice a wild discreptancy between two datetime columns in several models. They should have been identical, however, they were both getting their dates differently: ... date_column_one = models.DateTimeField(default=datetime.now()) date_column_two = models.DateTimeField(auto_now_add=True) ... What seems to be happening with this configuration is that datetime.now() is executed once when the server starts (and/or the module is imported) instead of what I thought would happen when I initially wrote these and that datetime.now() would get executed anytime an instance of the model was created and saved as a new record. My solution was to override the save method: ... date_column_one = models.DateTimeField() ... def save(self): if not self.id: self.date_column_one = datetime.now() super(MyModel, self).save() ... I am sure there is probably a better way and if you know of one, please leave a comment or send … -
A Default Bug in Django
Not to say that this is a bug in django but rather a bug in how I had written some of my models. Just wanted to point out a quick tip for anyone else who may have done the same thing as me as well as for any of the django experts out there that might suggest a better way. What was happening was that I began to notice a wild discreptancy between two datetime columns in several models. They should have been identical, however, they were both getting their dates differently: ... date_column_one = models.DateTimeField(default=datetime.now()) date_column_two = models.DateTimeField(auto_now_add=True) ... What seems to be happening with this configuration is that datetime.now() is executed once when the server starts (and/or the module is imported) instead of what I thought would happen when I initially wrote these and that datetime.now() would get executed anytime an instance of the model was created and saved as a new record. My solution was to override the save method: ... date_column_one = models.DateTimeField() ... def save(self): if not self.id: self.date_column_one = datetime.now() super(MyModel, self).save() ... I am sure there is probably a better way and if you know of one, please leave a comment or send … -
A Default Bug in Django
Not to say that this is a bug in django but rather a bug in how I had written some of my models. Just wanted to point out a quick tip for anyone else who may have done the same thing as me as well as for any of the django experts out there that might suggest a better way. What was happening was that I began to notice a wild discreptancy between two datetime columns in several models. They should have been identical, however, they were both getting their dates differently: ... date_column_one = models.DateTimeField(default=datetime.now()) date_column_two = models.DateTimeField(auto_now_add=True) ... What seems to be happening with this configuration is that datetime.now() is executed once when the server starts (and/or the module is imported) instead of what I thought would happen when I initially wrote these and that datetime.now() would get executed anytime an instance of the model was created and saved as a new record. My solution was to override the save method: ... date_column_one = models.DateTimeField() ... def save(self): if not self.id: self.date_column_one = datetime.now() super(MyModel, self).save() ... I am sure there is probably a better way and if you know of one, please leave a comment or send … -
Update to django-ae-utils
I’ve been hanging out at the NYC App Engine Hackathon today and I’ve had some time to work on django-ae-utils. Accordingly I’ve just posted an update to django-ae-utils. This update includes a User model which uses the App Engine datastore as a backend, as well as a few generic views for working with the model. [...] -
Extra
Después del fin de semana laaargo, en el cual me desconecte de la red y solo interactue en el "mundo real", llegué hoy a mi universidad y me di cuenta que la gente de google me envio un correo, solo para decirme que ya me habilitaron la cuenta de Google App Engine, ahora a hechar codigo!!! -
Mondrian & ReviewBoard
Word is that the a version of the code review tool that Google uses internally (called Mondrian) on the Google App Engine – called Code Review. I remember first seeing the Google tech talk on Mondrian and thinking that was … Continue reading → -
Django Templates: Good for so much more than HTML
I’m a big fan of Jon Bentley, the author of Programming Pearls. In this book, he discusses elegant solutions to problems that have irritated programmers for years. (I was in Europe for 6 weeks last year, and this was the one book that remained consistently in my bag throughout the whole trip. I’m not joking.) In [...] -
DjangoSites Gets New Shoes
I launched DjangoSites publicly last June, and since then we've had over 1,250 websites submitted to what has become the ultimate directory of Django-powered websites. The look and feel of the site didn't seem to have the same zing that many of the listed sites had though, so after a quick chat with the ever-creative Martin 'maddiin' Czura he was able to put together a new design that we both think is a great improvement. The new design is already online at DjangoSites.org, with a few nifty changes as well as the colour scheme such as an improved navigation bar and less cluttered positioning of user account options. At the same time, the website has been moved to a new VPS with KnownHost. I've been using KnownHost for over a year now and their VPS hosting is fantastic. The support from them has always been helpful, and their prices are very reasonable for what has been a very reliable service. I updated the TTL for the djangosites.org domain a few weeks back, so by the time this post goes live the new IP address should be accessible to anybody with properly configured DNS servers. I encourage you to do a … -
DjangoSites Gets New Shoes
I launched DjangoSites publicly last June, and since then we've had over 1,250 websites submitted to what has become the ultimate directory of Django-powered websites. The look and feel of the site didn't seem to have the same zing that many of the listed sites had though, so after … -
Habemus Python!!!
Hace poco fue el dia D para python y django puesto que el gran hermano Google lanzó el beta de Google App Engine, un sdk de desarrollo de aplicaciones web powered by python, pues bien el ingeniero Camilo Nova, CEO de Axiacore, me pidió que lo asesorará sobre django, y lo hicé, en cuestion de 1 hora, le mostré el potencial de django y quedó sorprendido, por lo cual dijo que lo iba a pensar y hoy me dio la noticia de que AxiaStore se desarrollará en python, por lo cual puedo decir: Habemus Python!!! -
Django performance testing – a real world example
About a week ago Andrew and I launched a new Django-powered site called Hey! Wall. It’s a social site along the lines of “the wall” on social networks and gives groups of friends a place to leave messages, share photos, videos and links. We wanted to gauge performance and try some server config and code changes to see what steps we could take to improve it. We tested using httperf and doubled performance by making some optimisations. Server and Client The server is a Xen VPS from Slicehost with 256MB RAM running Debian Etch. It is located in the US Midwest. For testing, the client is a Xen VPS from Xtraordinary Hosting, located in the UK. Our normal Internet access is via ADSL which makes it difficult to make enough requests to the server. Using a well-connected VPS as the client means we can really hammer the server. Server spec caveats It’s hard to say exactly what the server specs are. The VPS has 256MB RAM and is hosted with similar VPSes, probably on a quad core server with 16GB RAM. That’s a maximum of 64 VPSes on the physical server, assuming it is full of 256MB slices. If the … -
Queryset-Refactor Merged!
Od dawna rozwijany w osobnym branchu ulepszony ORM został połączony z drzewem głównym. W końcu możemy uaktualniać wiele rekordów w tabeli na raz, czy też korzystać z dziedziczenia modeli. Jedyne niekompatybilność na które natrafiłem, to OneToOneField nie jest teraz domyślnie kluczem... -
Django sites
He estado revisando sitios "powered by django" enhttp://www.djangosites.org y he encontrado http://dpaste.com/ que estacomo el mas alto por votos.pdt: este post fue escrito probando la funcionalidad de blogger de mail2blog -
quicknote
Hace poco me consegui un trabajo donde debo hacerle varios cambios a una aplicacion desarrollada en python con gtk como librera gráfica llamada quicknote, lo interesante del asunto es que corre en un celular nokia 810 que esta muy coqueto, ojala me pudiera comprar uno de estos, tienen un linux propio que es derivado de debian, por lo que tiene repositorios apt y todo eso, algunos paquetes como python ya estan portados a este dispositivo, y dentro de poco daran soporte para qt.Es muy vacano ver como las empresas de dispositivos moviles como nokia, le apuestan a linux y sobretodo a python, otra cosa interesante que alcancé a ver que tiene soporte para pygame, por lo que se pueden desarrollar juegos para este movil.Y tiene ssh!!! el mejor amigo del hombre geek!!! (frase de Santiago Ruano)