Tutorial 1:
Set up environment
Modify proj/settings.py proj/urls.py
Show django admin site
Python manage.py startapp app_name
Modify proj/app_name/models.py
Tutorial 2:
Show app_name in admin site(create admin.py in proj/app_name/)
Custom the admin form(proj/app_name/admin.py)
Customize the admin change list(list_display, list_filter, search_fields, date_hierarchy)
Customize the admin look and feel(Use django template system, create proj/templates/admin/)
Introduce template language {% tags %} {{ variables }} {{ foo | bar }} {% block %}
Tutorial 3:
Design URLs(regular expression, Python callback function [, optional dictionary])
Write views(callback functions when you type url), you can treat views.py as controllers in MVC
from django.shortcuts import render_to_response, get_object_or_404, get_list_or_404
404 error page and 500 error page: from django.conf.urls.defaults import *, use default error page is recommended, but you also can create your own error page in template root dir
Simplify and decouple the URLconfs
Tutorial 4:
Code-shuffle: Why? It intentionally ensure you must understand the basic django knowledge, then turn your face to advanced solutions.
Use generic views for less code:Convert URLconf; Delete some codes of views; Fix up URL handling for new views
阅读(1881) | 评论(2) | 转发(0) |