UPDATE: Brad Tweets to say that he actually uses vim for his coding, not XCode as I observed below. Thanks Brad!
9 am session: Brad Montgomery
Zero to Wiki in 30 minutes or Building a Wiki with Django
Brad’s official notes on this session with source code, presentation, and contact info http://bradmontgomery.net/barcampmemphis
@bkmontgomery on twitter
Django is a python framework
Brad’s IDE: XCode on OSX
Django creates an app as a collection of empty files that Brad’s
going to code into
FILES
models.py
Include libraries with the from statement e.g.
from django.db import models
Using “creoleparser” to import wiki markup language from
‘creole’ lib
Django “Automatic admin” creates an automatic CRUD interface so that content developers can start filling up the system before the real UI is live
- This is available immediately once the model is defined and connected w/Django
Slug: 255 char UID for each wiki page. /These-slugs-show-up-as-verbose-URls
Slug is a newspaper term for something I’ve forgotten already
Django promotes “Clean URLs”. URLConf maps URLs to callback functions aka views. See “urls.py“.
Django’s output is consumed through TEMPLATES - xml, html, csv, json, etc
- The template language is not python
- Consists of tags, variables, filters, etc
- Tags: Presentational logic { % for page in pages % } { % endfor % }
- Filters: {{page|title}} or {{t|timesince}}
Templates can be extended
blocks can be overridden
Creole offers a **text2html** function to convert wiki markup to presentable HTML!
We’re looking at the creole wiki markup in Brad’s editor page
Now onto DJANGO FORMS
Forms are derived from a Form class
Forms consist of fields.
The type of the field determines the possible inputs it can expect
class WikiPageForm inherits from ModelForm
excludes Slug from the form so end users can’t change it
- that would break the app!
Django has a SLUGIFY method
All text is escaped by default in Django.
The actual app development took Brad about two hours
Django hit v1.0 a month ago. it’s about 2 years old
Brad offers a list of django resources at the end of his shot.
djangoproject.com, a google groups mailing list, #django on freenode IRC, books, more?
There may be an inactive python user group in Memphis?
Q&A:
Q:
How do you think Django stacks up with ruby(rails), PHP, etc Django design is borrowed from rails in some ways
A:
Brad hasn’t used Ruby much Brad doesn’t find PHP frameworks quite as clean/elegant as Django.
Brad’s been using Python for a year or so, Django for a few months.
One pro to Django – Python has more code libraries available than does Ruby
Django doesn’t have as many sample apps from which to draw inspiration
Related articles by Zemanta
- Facebook Tornado: FriendFeed’s Real-Time Web Framework Goes Open Source (mashable.com)
- Book Review: Django 1.0 Template Development (mehmetalierturk.com)
- WTF is Python (slideshare.net)


![Reblog this post [with Zemanta]](http://img.zemanta.com/reblog_e.png?x-id=dccbe8e8-49fc-4d79-887e-a2690e0f937e)

