Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Finished tutorial02 and added a link to it from tutorial01

git-svn-id: http://code.djangoproject.com/svn/django/trunk@142 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit c9cc6f87f9fb77a3d12db1b5640ac465f80418c3 1 parent 7ade767
Adrian Holovaty authored July 17, 2005
23  docs/tutorial01.txt
... ...
@@ -1,6 +1,8 @@
1  
-=======================================
2  
-Tutorial: Writing your first Django app
3  
-=======================================
  1
+=====================================
  2
+Writing your first Django app, part 1
  3
+=====================================
  4
+
  5
+By Adrian Holovaty <holovaty@gmail.com>
4 6
 
5 7
 Let's learn by example.
6 8
 
@@ -368,15 +370,8 @@ Let's jump back into the Python interactive shell::
368 370
 
369 371
 For full details on the database API, see our `Database API reference`_.
370 372
 
371  
-.. _Database API reference: http://www.djangoproject.com/documentation/db_api/
372  
-
373  
-Coming soon
374  
-===========
  373
+When you're comfortable with the API, read `part 2 of this tutorial`_ to get
  374
+Django's automatic admin working.
375 375
 
376  
-The tutorial ends here for the time being. But check back within 48 hours for
377  
-the next installments:
378  
-
379  
-* Using the dynamically-generated admin site
380  
-* Writing public-facing apps
381  
-* Using the cache framework
382  
-* Using the RSS framework
  376
+.. _Database API reference: http://www.djangoproject.com/documentation/db_api/
  377
+.. _part 2 of this tutorial: http://www.djangoproject.com/documentation/tutorial2/
70  docs/tutorial02.txt
@@ -434,7 +434,69 @@ default is to display 50 items per page. Change-list pagination, search boxes,
434 434
 filters, date-hierarchies and column-header-ordering all work together like you
435 435
 think they should.
436 436
 
437  
-More
438  
-====
439  
-
440  
-There's much more to come. This document is not finished.
  437
+Customize the admin look and feel
  438
+=================================
  439
+
  440
+Clearly having "Django administration" and "mysite.com" at the top of each
  441
+admin page is ridiculous. It's just placeholder text.
  442
+
  443
+That's easy to change, though, using Django's template system.
  444
+
  445
+Open your admin settings file and look at the ``TEMPLATE_DIRS`` setting.
  446
+``TEMPLATE_DIRS`` is a tuple of filesystem directories to check when loading
  447
+Django templates. It's a search path.
  448
+
  449
+The ``django-admin.py startproject`` command automatically prepopulated
  450
+this setting with the location of Django's default admin templates, according
  451
+to where you have Django installed. But let's add an extra line to
  452
+``TEMPLATE_DIRS`` so that it checks a custom directory first, before checking
  453
+the default admin template directory::
  454
+
  455
+    TEMPLATE_DIRS = (
  456
+        "/home/mytemplates/admin",
  457
+        "/usr/lib/python2.3/site-packages/django/conf/admin_templates",
  458
+    )
  459
+
  460
+Now copy the template ``base_site.html`` from within the default Django admin
  461
+template directory, into ``/home/mytemplates/admin`` (or wherever you're
  462
+putting your custom admin templates). Edit the file and replace the generic
  463
+Django stuff with your own site's name as you see fit.
  464
+
  465
+Note that any of Django's default admin templates can be overridden. To
  466
+override a template, just do the same thing you did with ``base_site.html`` --
  467
+copy it from the default directory into your custom directory, and make
  468
+changes.
  469
+
  470
+Customize the admin index page
  471
+==============================
  472
+
  473
+On a similar note, you might want to customize the look and feel of the Django
  474
+admin index page.
  475
+
  476
+By default, it displays all available apps, according to your ``INSTALLED_APPS``
  477
+setting. But the order in which it displays things is random, and you may want
  478
+to make significant changes to the layout. After all, the index is probably the
  479
+most important page of the admin, and it should be easy to use.
  480
+
  481
+The template to customize is ``index.html``. (Do the same as with
  482
+``base_site.html`` in the previous section -- copy it from the default directory
  483
+to your custom template directory.) Edit the file, and you'll see it uses a
  484
+template tag called ``{% get_admin_app_list as app_list %}``. That's the magic
  485
+that retrieves every installed Django app. Instead of using that, you can
  486
+hard-code links to object-specific admin pages in whatever way you think is
  487
+best.
  488
+
  489
+Django offers another shortcut in this department. Run the command
  490
+``django-admin.py adminindex polls`` to get a chunk of template code for
  491
+inclusion in the admin index template. It's a useful starting point.
  492
+
  493
+Coming soon
  494
+===========
  495
+
  496
+The tutorial ends here for the time being. But check back within 48 hours for
  497
+the next installments:
  498
+
  499
+* Writing public-facing apps
  500
+* Using the cache framework
  501
+* Using the RSS framework
  502
+* Using the comments framework

0 notes on commit c9cc6f8

Please sign in to comment.
Something went wrong with that request. Please try again.