Created
July 5, 2009 11:30
-
-
Save buriy/140945 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class BlogApp(Controller): | |
urls = { # will be deduced automatically | |
/ -> show list of users and blogs | |
/create/blog/ -> add a blog | |
/create/user/ -> add an user | |
/blog/:name/ -> connects to a blog page | |
/user/:name/ -> connects to an user page | |
} | |
ancestors = [ # these two controllers are subobjects | |
UserController, | |
BlogController, | |
] | |
class UserController(Controller): | |
urls = { | |
/ -> show blog info and list of blog entries | |
/edit/ -> edit current user | |
} | |
model = Author | |
lists = [ # what lists are referenced | |
BlogController, | |
] | |
class BlogController(Controller): | |
urls = { | |
/ -> show blog info and list of blog entries | |
/edit/ -> edit current entry | |
/create/entry/ -> add an entry to a blog | |
/entry/:name/ -> connects to an entry page | |
} | |
model = Blog # will contain blog options | |
ancestors = [ | |
EntryController, | |
] | |
elements = [ # also just an idea of what can happen | |
sidebar, | |
last comments, | |
last entries, | |
categories, | |
months, | |
friends, | |
menu | |
] | |
list_filters = [ | |
author, | |
name | |
] | |
class EntryController(DateController): | |
model = Entry # will create add form, view form and edit form for you. | |
add_form = EntryForm # we'll customize it a bit | |
edit_form = EntryForm | |
urls = { | |
/ -> show blog info and list of blog entries | |
/edit/ -> edit current entry | |
/create/comment/ -> add a comment to an entry | |
} | |
ancestors = [ | |
Comment | |
] | |
elements = [ | |
best_comments, | |
] | |
list_filters = [ | |
authors, | |
categories, | |
date, | |
drafts, | |
] | |
filters = [ | |
authors, | |
] | |
class CommentsController(ItemController): | |
add_form = AddForm |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
urlpatterns = patterns('', | |
('/', BlogApp.urls) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment