Found 9 entries, viewing 6 through 9.

previous

Month of Django Tips

James Bennett is going to try to blog everyday for the month of November with a new Django tip each day. Let me just say that the first post is quite good, and I can only hope the rest of the month is filled with such useful information. His blog archives will quickly become an excellent reference.

Permalink | Posted: Nov 01, 2007 | Tags: django python

Django Master Class

This was an excelllent presentation. Jacob Kaplan-Moss, Simon Wilson and Jeremy Dunck presented on Django, covering a number of very useful topics. A couple of these things were areas I really needed to get my head around, so this helped a lot. My highlights:

  1. Unit Testing - An excellent overview of the testing available testing methods and how to use them.
  2. Middleware == Rails Filters (not Java/Enterprise Middleware)
  3. Forms with AJAX how-to. jQuery looks like a nice AJAX library.
  4. Custom Model Fields - actually telling you how to do this.

Jacob has posted the slides and notes online, read them and take advantage of this cool stuff and more.

Permalink | 3 comments | Posted: Jul 26, 2007 | Tags: django python OSCON OSCON07

UTOSC Presentation

Well, I'm presenting at the Utah Open Source Conference this coming September. My topic is Using Django to Drive Internal Development and Tools. I'll be starting off with the Django basics, giving a good tutorial on how things work. From there we'll dive into running your existing tools and code from a web interface with Django. Finally I'll discuss some tips for integrating with your existing environment. It should be pretty fun, and I'm looking forward to the presentation.

Permalink | Posted: Jul 09, 2007 | Tags: django python

Improving Django's direct_to_template Static Page System

For this site I have a large number of static pages. Django provides two ways of serving such content: flatpages and the generic view direct_to_template. I prefer the direct_to_template system, but it gets a bit overwhelming when you have a lot pages. I didn't want to define a url pattern for each page, so I wrote a system to handle it. With this system I never have to write a single url pattern, or even an explicit URL.

First we add to our urls.py the pattern:

(r'^(?P<page>.+?)/(?P<path>.*?)/?$', 'website.site.views.static_page')

Now we define the actual view; take note this depends on a dictionary of lists called pages:

def static_page(request, path, page):
     if not path and page in pages:
         template = ''.join((page,"/index.html"))
    elif page in pages and path in pages[page]:
        template = ''.join((page, "/", path, ".html"))
    else:
        raise Http404
    return render_to_response ...

Continue Reading

Permalink | Posted: May 10, 2007 | Tags: django python

previous

Tags

42 | django | python | oggify | OSCON | OSCON07 | osx | utosc | mythtv | security | reading | music | gaming | programming | tips | shell | vim | pyobjc | cocoa | iphone | blog | git

Calendar

<< Sep >>
Mo Tu We Th Fr Sa Su
30 31 1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 1 2 3

Search

This space reserved for a search box

RSS Feeds

A Django site. Hosted on a Slicehost Slice