Django community: Community blog posts RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
Django: Big Integer Fields
I submitted a patch to Django Ticket #399 (request for a bigint field type). It still needs testing but works at a quick glance on mysql. Here’s a shot of them in action from the admin interface (the input is just too small and just too big respectively): Update: BigIntegerField works perfectly on PostgreSQL but because it doesn’t have an unsigned integer type (that I can find), PostitiveBigIntegerField isn’t going to make it all the way up to 18,446,744,073,709,551,615 without using an arbitrary precision NUMERIC or mapping zero to -9,223,372,036,854,775,808. Both solutions are messy and it would be a shame to have the mysql and postgres backends behave so differently. As an aside, it looks like this is already the case with mysql’s IntegerFields being UNSIGNED while Postgres just checks to make sure that the integers are positive before inserting. The best solution would probably be to employ backend-specific range checking for these monsterous numbers. That way you won’t end up out of range in PostgreSQL but you’re also not penalizing MySQL for being able to count to 18 bajillion. At this point it would be safe to drop in BigIntegerField as is (as soon as I check it out … -
A note to web designers
When a job listing says it requires knowledge of web standards, don’t bother applying if you haven’t changed your markup since 1998. From the web page of a designer applying for the senior designer position at World Online: <META NAME=GENERATOR CONTENT="Adobe PageMill 3.0 Mac"> Dude, don’t even bother. (If your markup is better than that and you want to work for the best online news team in the world, why not apply? -
Django Model Syntax Change
Adrian has committed the Django model syntax changes. Current models will have to be rewritten — once — but the new syntax looks a lot cleaner and I think it will reduce the learning curve for newcomers to the platform. Be sure to check out the full documentation as well as a brief screencast highlighting the changes. I will do my best to update my CRUD Generic Views tutorial as soon as possible to reflect the syntax change. Update: Here’s the updated tasks.py -
A quick comparison
The Microsoft way Windows 2003 Server, Enterprise Edition: $3,999 Visual Studio.NET, Enterprise Edition: $2,499 per developer SQL Server, Enterprise Edition: $19,999 per processor Programming in an outdated, insecure, hard to use environment: priceless. The Linux way Debian Linux: free Apache 2.0: free PostgreSQL: free Perl/PHP/Python: free Programing in a fun, modern, secure environment: priceless. -
Sera's Pancakes
For three 3 eggs 2 cups flour 3/4 teaspoon baking powder 3/4 teaspoon salt 2 tablespoons sugar 1 - 1 1/2 cup milk 3 tablespoons melted butter For four 4 eggs 2 2/3 cups flour 3/4 teaspoon baking powder 1 teaspoon salt 3 tablespoons sugar 1 3/4 - 2 1/4 cup milk 4 tablespoons melted butter Combine eggs, flour, baking power, salt, sugar and the smaller amount of milk and whisk until smooth. -
Redirects in Django
While working on the authentication bits for a feed-reader application I'm writing (more on that later), I noticed that polipo ... -
Redirects in Django
While working on the authentication bits for a feed-reader application I'm writing (more on that later), I noticed that polipo ... -
Django Generic Views: CRUD
Note: I’ve not yet updated this to reflect the new model syntax. For the time being you can take a look at the new model syntax for tasks here. There are lots of gems buried in Django that are slowly coming to light. Generic views and specifically the CRUD (create, update, delete) generic views are extremely powerful but underdocumented. This brief tutorial will show you how to make use of CRUD generic views in your Django application. One of my first encounters with Rails was the simple todo list tutorial which managed to relate lots of useful information by creating a simple yet useful application. While I will do my best to point out interesting and useful things along the way, it is probably best that you be familiar with the official Django tutorials. Now would also probably be a good time to mention that this tutorial works for me using MySQL and revision 524. Django is under constant development, so things may change. I’ll do my best to keep up with changes. Getting Started As with all Django projects, the best place to start is to start with django-admin.py startproject todo. Make sure that the directory you created your … -
Django and Rails
Sam Newman just posted a comparison of Django and Rails which is extremely balanced and fair, and a very good read. I’ve obviously got a few bits of feedback, so here goes: Background As a framework Rails has been around for little over a year, whereas as a framework in its own right django has only been public for around two months. Actually, Django’s been in use internally for over two years, although we only got the buy-in from management to release it as open-source two months ago. -
Reboot
Well, now. I hear that there’s this thing all the cool kids are doing. Something about a web stick, or a web tree or something… Web Log, that’s it. (Hear that? It’s me running after the bandwagon as fast as my lazy ass can take me.) Of course, this whole site is now powered by Django — including some neat little tricks I’ll try to share later on. -
Rob Curley Blew My Mind
A few days back I listened to this IMA Keynote by Rob Curley on IT Conversations. It blew my mind. I started out looking for some insight in to the team behind Django, The Lawrence Journal-World, lawrence.com, and so on. I got a whole lot more than I had bargained for. If you’re involved in old media, new media, any media, or just want a glimpse of the future (I hope), please have a listen. It will be very interesting to see what happens in the next few months as Django takes flight, Rob heads to Naples (with technical backup from Eric) and Adrian telecommutes to The Washington Post -
Django Markup Template Tags
Changeset 467 contains template tags for renderingTextile (using PyTextile), Markdown (using python-markdown), and ReStructured Text (using docutils). You can find usage examples and some basic tests in markup.py. You need to make sure that you have the correct modules installed to do the heavy lifting, but the tags are extremely easy to use: {{ textile_content|textile }} {{ markdown_content|markdown }} {{ rest_content|restructuredtext }} -
Django: Tutorial 4 and RSS
Today Adrian posted Django Tutorial 4 which covers form processing and generic views. Everyone dive in! In other news, if you’re looking to generate RSS using Django “the easy way,” look no further than this #django log and associated pastebin. As always, svn up if you haven’t in the last few hours. Update: The pastebin dissapeared, so here’s a transcribed version of what was in there. Typos are mine and not Adrian’s of course. -
HTTP Headers and Django
Andrew Brehaut has a hot tip about HTTP headers and Django: HttpResponse objects contain a headers dictionary, that you can easily add and remove headers from using dictionary notation You can read more about it and see usage examples in his post. -
Migrating Your App to Django
A few days ago I mentioned Changeset 384 which included a new command, django-admin.py inspectdb <dbname>. It has also been tweaked and improved since it was initially committed. The other day I tried it out on a simple database structure, but I decided to throw a more complex example at it. I decided to take the final depot application from the excellent Agile Web Development with Rails book. Beta books rule by the way. I executed the SQL in rails-code/depot_final/db/create.sql from the the code tarball to set up the database structure. I then created a new project with django-admin startproject and edited settings/main.py to tell Django how to log in to my mysql database. After exporting the correct DJANGO_SETTINGS_MODULE I ran django-admin.py inspectdb depot_rails which gave me the following model: # This is an auto-generated Django model module. # You'll have to do the following manually to clean this up: # * Rearrange models' order # * Add primary_key=True to one field in each model. # Feel free to rename the models, but don't rename # db_table values or field names. # # Also note: You'll have to insert the output of # 'django-admin.py sqlinitialdata [appname]' # into your database. … -
Django middleware
In the django project settings there is a key called MIDDLEWARE_CLASSES which is a tuple of strings implementing the middleware methods. Django base handler (TBD explain what this class does) reads this setting and initializes three of its own attributes: _request_middleware, _view_middleware and _response_middleware. It goes through the list of middleware classes instantiates each of [...] -
django decorators
Django framework has used some design patterns. There is a directory called decorator which currently has two decorators: (decorator is just a method which dynamically adds additional functionality to original method depending on the situation) funcA = login_required(funcA) This replaces the funcA with a function which checks if the user is logged in and calls [...] -
Getting to know the django web framework
I was just about to abandon python and join the ruby camp to be able to use the wonderful rails framework for web application development. (They do have very good documentation and impressive video demo which you should check out!) But then came the announcement of Django. I really like the python language and feel [...] -
Django: Another "Rails" Web Framework
The Rails hype continues: Django for Python is the most recently announced of what is becoming a long line of web frameworks inspired by Ruby on Rails. Others that have popped up include MonoRail for .NET & Mono, Subway for Python, Trails for Java, Catalyst and Maypole for Perl. In the context of all these rails derivatives, this article on "Could Rails have been built without Ruby?" is an interesting read. [source] For PHP we have also cake and biscuit. -
Django: Another "Rails" Web Framework
The Rails hype continues: Django for Python is the most recently announced of what is becoming a long line of web frameworks inspired by Ruby on Rails. Others that have popped up include MonoRail for .NET & Mono, Subway for Python, Trails for Java, Catalyst and Maypole for Perl. In the context of all these rails derivatives, this article on "Could Rails have been built without Ruby?" is an interesting read. [source] For PHP we have also cake and biscuit. -
Search Results
This content won’t be rendered. See https://gist.github.com/eddiewebb/735feb48f50f0ddd65ae5606a1cb41ae. -
Subscribe to my newsletter
Want to get email when I write new blog posts? Sign up here to get an email every week with a summary of my latest posts. I’ll also occasionally include a few shorter thoughts or links that don’t fit as well here on the blog. -
Ways I'm available to help
Summary: want help? Email me: jacob@<this domain>. I’ve been lucky and privileged enough to have had a long and successful career. I’m now in a position to use my accumulated knowledge, network, and experience to help others, and I’d like to do so. This is a list of ways I think I can help; if you see something here that’d be useful to you, please email me. This isn’t an exhaustive list, but it is representative.