excess.org

Ian Ward

Consulting
Boxkite Inc.
Software
Urwid 2014-02-09 (1.2.0)
Speedometer 2011-12-08 (2.8)

Writing
Moving to Python 3
2011-02-17

Presentations
Urwid Applications
2012-11-14
Urwid Intro
2012-01-22
Unfortunate Python
2011-12-19
Django 1.1
2009-05-16
Article Tags

Home

Ian Ward's email:
first name at this domain

wardi on OFTC, freenode and github

Locations of visitors to this page

Articles Tagged “Django” rss icon

Gerbi CMS
Posted on 2012-04-26.

Gerbi CMS (nee django-page-cms) is a multilingual content management system written in Python and based on the Django web framework. It's currently my favourite CMS software and use it for a number of web sites I administer.

I'll be giving a talk about Gerbi CMS at the next OCLUG and OPAG meetings resembling this article.

Read More …

Tags: Django Ottawa OCLUG Software Python


Posted on 2012-04-09.

If you've ever wanted to know if a Django template is using a variable it shouldn't be, or not using a variable it should, this code will make both cases fail loudly. Django's default template behaviour is to silently replace missing variables with an empty string, and ignore unused variables.

To use this code you can either:

  1. wrap your Context (or RequestContext) object in your view with a ParanoidContextProxy that will fail on any attempt to access a missing variable, or
  2. use the paranoid_render_to_response function (or similar) to also require that every variable you pass be used in the template.

Read More …

Tags: Django Software Python


Django Widget data flow
Posted on 2011-09-19.

In any web application user data must be translated from HTML form data to native types and database types, and back again. Django web applcations are no different.

The "right way" to handle custom types is to extend Django's widgets, form fields and model fields. However, understanding exactly how these types perform each step of the conversion can be confusing. This post will attempt to explain how the data is converted at each stage and offer some advice about creating custom widgets, form fields and model fields.

This article is based on Django 1.3 and assumes the reader has experience creating and using Django forms, models and validation.

Read More …

Tags: Django Software Python


Arevco Lighting 2011
New Arevco Site Launched link
Posted on 2011-09-06.

The third iteration the Arevco Lighting web site is now up.

The old site was simple HTML and images generated from a script, which I quite liked but wasn't the easiest thing for other people to update. The new site has been professionally skinned and is now running a Django CMS with some custom index code for product pages. I used the following:

I've used Gerbi now for a few public web sites. It's a well designed and usable CMS that is quite easy to extend. It also has good multilingual support that will make translating content as easy as editing the pages.

Tags: Django Ottawa Python


Python on Android, Django Unit Testing at OPAG link
Posted on 2011-05-25.

Ottawa Python Authors Group meeting tomorrow Thursday May 26 at 8p.m. Best of all it's not me talking this time!

Hope you can make it out.

Tags: Django Ottawa Software Python OPAG


Django Hides (some) Widget Exceptions link
Posted on 2010-12-13.

If you write any custom Django widgets or admin list_display callable functions you have probably run into this: Everything looks ok, except the place where your widget should be is just blank. Nothing. No traceback or any clue as to what went wrong.

It seems that Django suppresses all the exceptions sent by widgets rendering except for AssertionError and TypeError. Debugging under those conditions is tricky, so I wrote a function decorator to help. Just import this and put @assert_on_exception before your render method or admin list_display callable function:

def assert_on_exception(fn):
    import sys
    def wrap(*args, **kwargs):
        try:
            return fn(*args, **kwargs)
        except (AssertionError, TypeError):
            raise
        except:
            raise AssertionError(sys.exc_info()[0].__name__ + ": " + str(sys.exc_info()[1]))
    wrap.__name__ = fn.__name__
    wrap.__dict__.update(fn.__dict__)
    wrap.__doc__ = fn.__doc__
    wrap.__module__ = fn.__module__
    return wrap

Tags: Django Software Python


Non-trivial Django Forms slide
Posted on 2010-04-16.

This is the text from the Nontrivial Django Forms talk I gave last Tuesday at the April meeting of the Ottawa Python Authors Group.

This talk starts where the Django forms documentation leaves off.

Read More …

Tags: Django Ottawa Software Python OPAG


Posted on 2009-07-21, last modified 2009-11-19.

Django's forms have fields like models, but you access them in a completely different way. I've found it hard to remember the correct way to access form field data properly, so this is a summary of the things I need to do with forms and how to do them. In particular these are useful in the form's __init__ method after calling super() to set up the form the way you want to.

Read More …

Tags: Django


Ian Ward talking about Django 1.1
Posted on 2009-06-10, last modified 2010-08-29.

This is a video of the Django 1.1 talk I gave last night for the Ottawa Python Authors Group. We were bumped out of our reserved room so I did the talk in the pub. The timing worked out quite well, I just finished answering questions as game 6 was starting in the background.

Thank you to Andrew Ross and FOSSLC for doing the recording and setting everything up.

You will need Flash 10 to hear the audio for this presentation. If you don't like flash, please send a polite note to the ePresence people asking for them to support other formats.

Update: "we got screwed by the company we were dealing with for the software & hosting and the talk is lost" And sorry, I have no back-up either. The text from this talk is still available.

Read More …

Tags: Django Ottawa Software Video Python FOSSLC OPAG


Django 1.1 Talk at Ottawa Python Authors Group link
Posted on 2009-06-07, last modified 2009-06-10.

I will be giving my Django 1.1 talk at The Ottawa Python Authors Group meeting on Tuesday.

UPDATE: A video of my talk is now available

Tags: Django Ottawa Software Python OPAG


« page 1 2 3 page »