Django community: Community blog posts RSS
This page, updated regularly, aggregates Community blog posts from the Django community.
-
django-sorting a generic way of queryset sorting
Just found a great project django-sorting. It's a generic way of queryset sorting. It's based on middleware, and templatetag. Please read the README.txt of the project. In couple easy steps you get sorting: 1. Download & install django-sorting 2.In your settings.py - add 'django-sorting' to INSTALLED_APPS - add 'django_sorting.middleware.SortingMiddleware' to MIDDLEWARE_CLASSES (make sure ' -
django-tables generic way for displaying tables (pagination included)
In thnis short post I would like to let you know about the great project django-tables. You can read more about it at: http://blog.elsdoerfer.name/2008/07/09/django-tables-a-queryset-renderer/ In a couple of words it lets you: - display the table using one template which lets you sort & paginate easily (filtering in plans!) By reading the text below you will find out how to create table with -
Django explained with model/view/controller (MVC)
-
RSS With the Syndication Framework
Getting our data out to others is very important with a world full of data. RSS is one of the best ways to do this, still. We go over how to create an RSS feed for your content as we continue to build out our demo blog. It is so simple it should be illegal, check it out.Watch Now... -
RSS With the Syndication Framework
Getting our data out to others is very important with a world full of data. RSS is one of the best ways to do this, still. We go over how to create an RSS feed for your content as we continue to build out our demo blog. It is so simple it should be illegal, check it out.Watch Now... -
OpenBlock Geocoder, Part 1: Data Model and Geocoding
As Tobias mentioned in Scraping Data and Web Standards, Caktus is collaborating with the UNC School of Journalism to help develop Open Rural (the code is on GitHub). Open Rural hopes to help rural newspapers in North Carolina leverage OpenBlock. This blog post is the first of several covering the internals of OpenBlock and, specifically, the ... -
OpenBlock Geocoder, Part 1: Data Model and Geocoding
As Tobias mentioned in Scraping Data and Web Standards, Caktus is collaborating with the UNC School of Journalism to help develop Open Rural (the code is on GitHub). Open Rural hopes to help rural newspapers in North Carolina leverage OpenBlock. This blog post is the first of several covering the internals of OpenBlock and, specifically, the ... -
OpenBlock Geocoder, Part 1: Data Model and Geocoding
As Tobias mentioned in Scraping Data and Web Standards, Caktus is collaborating with the UNC School of Journalism to help develop Open Rural (the code is on GitHub). Open Rural hopes to help rural newspapers in North Carolina leverage OpenBlock. This blog post is the first of several covering the internals of OpenBlock and, specifically, the ... -
Released 0.6 final
We are happy to announce the first final release of LFS 0.6. Kudos to Michael Thornhill (of http://www.maithu.com/) who did a lot of work to make this happen. What's new? Using Django 1.3 Added country dependent addresses Added pluggable price calculation Added supplier management Massively improved management interface Improved static file handling (Django's staticfiles) Improved properties management Removed SWFUpload (Flash) in favour of jquery.fileupload (Javascript) Using Python's locale to display currencies New contact form Continues integration on shiningpanda Migration Starting with this release we provide a migration command (lfs_migrate, based on South) to upgrade your existing LFS instances. Please refer to the documentation for further information. What happens next? We have already started to plan and implement the next release of LFS. Some new features are: Product attachements Pluggable order number generation Using django_compressor New portlets: featured products, for sale products Aded SEO information for shop and pages Portets for pages Generic tax calculations Better pluggability See the roadmap for up-to-date information and follow the ongoing process on bitbucket. Further Information You can find more information and help on following places: Official page Documentation on PyPI Demo Releases on PyPI Source code on bitbucket.org Google Group lfsproject on Twitter IRC -
Update: JsLint Checker for Sublime Text 2 with jslint4java
Very important update of JsLint Checker Plugin for Sublime Text 2: I've moved execution of jslint4java (the tool which make lint checks) into separate thread so now plugin becoming usable for production/daily usage.Execution in separate thread is important difference from other *-lint plugins – you don't need to wait with blocked editor area until jslint finish the work. Now all of it will be done separately from main editor thread and you can continue to work.Next steps for this plugin are:Add support of Sublime Package ControlI want to add support of PyLint, PEP8 and PyFlakes supportCheck it out on GitHub -
My BaseModel
When I build projects in Django I like to have a 'core' app with all my common bits in it, including a BaseModel. In that BaseModel I'll define the most basic fields possible, in this case a simple pair of created/modified fields built using custom django-extension fields. # core/models.pyfrom django.db import modelsfrom django.utils.translation import ugettext_lazy as _from core.fields import CreationDateTimeField, ModificationDateTimeFieldclass BaseModel(models.Model): """ Base abstract base class to give creation and modified times """ created = CreationDateTimeField(_('created')) modified = ModificationDateTimeField(_('modified')) class Meta: abstract = TrueYou'll notice I also have core.fields defined. That is because (unless things have changed), django-extensions doesn't work with South out of the box. Hence the file below where I extend those fields to play nicely with my migration tool of choice.# core/fields.pyfrom django_extensions.db.fields import CreationDateTimeField, ModificationDateTimeFieldclass CreationDateTimeField(CreationDateTimeField): def south_field_triple(self): "Returns a suitable description of this field for South." # We'll just introspect ourselves, since we inherit. from south.modelsinspector import introspector field_class = "django.db.models.fields.DateTimeField" args, kwargs = introspector(self) return (field_class, args, kwargs) class ModificationDateTimeField(ModificationDateTimeField): def south_field_triple(self): "Returns a suitable description of this field for South." # We'll just introspect ourselves, since we inherit. from south.modelsinspector import introspector field_class = "django.db.models.fields.DateTimeField" args, kwargs = introspector(self) return (field_class, args, … -
Gedit as a Django IDE for Linux
gedit is actually a pretty bad ass IDE for Django web development. -
Django Authentication using an Email Address
A custom authentication backend which allows a user to login using their email address in Django. -
Django Dynamically Generated Images with Cairo
It is fairly simple to dynamically generate images in your Django views using the Cairo 2D graphics library. -
AJAX Form Submission in Django
Here is a simple example of using the jQuery javascript framework to hijack and submit a Django form. -
Authorize.Net Credit Card Form in Django
A Django form which submits a payment to Authorize.Net during form validation. -
Accept Credit Cards in Django with Authorize.Net
Accepting credit cards in your Django applications using the Authorize.Net payment gateway is easier than you might think. -
How to Add Django Database Caching in 5 Minutes
Milk my Caching for all it’s worth One of our big challenges at Yipit as an aggregator has been weaning ourselves off of all of those dastardly MySQL Joins. As Uncle Ben once warned Peter Parker, “With great power comes interminably long queries”. Fortunately, because our workload skews heavily towards reads, we’ve had success implementing various caching strategies across the stack. On the application level, we’ve leveraged Django’s built-in caching framework to enable site-wide caching for anonymous users, view level caching for authenticated pages (especially useful for our API), and ad-hoc caching for aggregate queries. Lately, we’ve begun to dive more deeply into the holy grail of Django data retrieval: cached QuerySets. Conveniently, there are a number of quality libraries available to facilitate this sort of thing, including Johnny Cache, Django Cache-Bot, and Django Cache Machine. We’ve decided to go with Cache Machine for the foreseeable future thanks to its dead simple integration, its common sensical handling of invalidation (including through Foreign Key relationships), useful ancillary features such as caching RawQuerySets and QuerySet counts, and its easy extensibility. A Quick Recap of How Cache Machine Works Cache Machine stores full model QuerySets as key value pairs in one of three … -
Made Up Statistics
At DjangoCon my good friend Miguel Araujo and I presented on Advanced Django Form Usage. Slide 18 of that talk mentioned some made up statistics. Here they are for reference:91% of Django projects use ModelForms.80% ModelForms require trivial logic.20% ModelForms require complex logic.Important Disclaimer: These numbers were cooked out of thin air by yours truly. I determined them with zero research, they carry absolutely not scientific weight, and shouldn't be used in any serious argument. They are wholly my opinion, which is good or bad depending on your point of view and your own opinion of my opinions.With that out of the way, I'm going to make a bar graph out of my fictional data:You'll notice that my bar titles could be stronger. I actually did that on purpose in case anyone tries to use that chart in real life. In any case, if you thought that was interesting, then read on. I have many more made-up statistics. For example, here are more numbers I've cooked up:Pydanny Made Up DevOps StatisticsDevOps is the new hotness. I know because every other Python meetup features someone speaking on it - just like every other Ruby, Perl, and PHP meetup. Anyway... numbers:24.3% Python developers … -
JsLint Checker for Sublime Text 2 with jslint4java
Just finished small JsLint Checker for Sublime Text 2. Configuration of two found on github packages was quite non-trivial from my point of view.I think that clean code is great improvement of development process and speed of development. Also JsLint is very good tool to avoid stupid errors like variables global scope leaks and so on.Check it out on github -
Code Month: Post Mortem
I had meant to post something on the first, but life got away from me in a crazy way. Last month, I talked about doing a Nanowrimo-style sprint-of-one for getting a website up. How'd that turn out? I didn't get the site up (otherwise, you would have had a joyous ... -
Deploying Django to Heroku
Heroku makes life easier for those web developers that just want to deploy our code and it work. In this screencast we walk you through creating a heroku app, deploying your actual code, and running south migrations. This will make development and deployment easier for everyone.Watch Now... -
Deploying Django to Heroku
Heroku makes life easier for those web developers that just want to deploy our code and it work. In this screencast we walk you through creating a heroku app, deploying your actual code, and running south migrations. This will make development and deployment easier for everyone.Watch Now... -
Deploying Django to Heroku
Heroku makes life easier for those web developers that just want to deploy our code and it work. In this screencast we walk you through creating a heroku app, deploying your actual code, and running south migrations. This will make development and deployment easier for everyone.Watch Now... -
The Story of Live-Noting
Like a lot of people, I've got this thing I do when I attend conferences, meetups, classes, and tutorials: I take notes. My open source based ones are mostly written in RestructuredText and I've kept in a particular folder since at least 2006.Putting notes in a DVCSOn September 13, 2009, I uploaded these notes to Github.com. I did that because I wasn't pleased with the workflow I established of moving items to Dropbox for backup. I use DVCS all the time and I figured why not just put my notes where I put my code? So I added my notes as a Github repo.DVCS Notes Based Management System?For a while I tried to use the Github folder README.rst trick to make a navigations system for my notes. But Github isn't designed for making a README into a dynamic custom content navigator, and it would make a silly feature request. I would rather the Github team work on Mercurial integration or other practical things before they honored a request to turn their system into my own custom Notes Management System. Eventually I just gave up on it and moved on.Sphinx + Read The Docs!In early July of 2011 I had a …