Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Changes between Version 1 and Version 2 of AutoCompleteField


Ignore:
Timestamp:
02/12/06 06:13:55 (9 years ago)
Author:
alberto
Comment:

one more example + xml syntax highlight for the kid code.

Legend:

Unmodified
Added
Removed
Modified
  • AutoCompleteField

    v1 v2  
    55 1. Create a new probject (`tg-admin quickstart`) and name it autocomplete, or reuse an old one. We will mount the code required for the `AutoCompleteField` one level below your `RootController`. 
    66 1. If you created a new project, remove the methods `login` and `logout` from your `controllers.py` file. We won't use them for this tutorial. 
    7  1. Import the AutoCompleteField widget to `controllers.py` with  
     7 1. Import the AutoCompleteField widget to `controllers.py` with:  
    88{{{ 
    99#!python 
     
    2424    testcompletion = TestInputCompletion() 
    2525}}} 
    26  Create the `complete.kid` file necessary to display the empty page by copying `welcome.kid` to `complete.kid` and clearing out everything inside the body. The file should look like this: 
     26 1. Create the `complete.kid` file necessary to display the empty page by copying `welcome.kid` to `complete.kid` and clearing out everything inside the body. The file should look like this: 
    2727{{{ 
     28#!xml 
    2829<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
    2930<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#" 
     
    4647    self.acfield = AutoCompleteField()  
    4748}}} 
    48  1. Modify complete.kid and add {{{${acfield.display()}}}} inside the `<body>` tag. That code automagically inserts all the HTML and Javascript code necessary to display the AutoCompleteField if we pass it an instance. Then change the `index` method so that the template gets passed our widget: 
     49 1. Modify complete.kid and add {{{${acfield.display()}}}} inside the `<body>` tag. That code automagically inserts all the HTML and Javascript code necessary to display the AutoCompleteField if we pass it an instance. It should look something like:  
     50{{{ 
     51#!xml 
     52<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
     53<html xmlns="http://www.w3.org/1999/xhtml" xmlns:py="http://purl.org/kid/ns#" 
     54    py:extends="'master.kid'"> 
     55 
     56<head> 
     57    <meta content="text/html; charset=UTF-8" http-equiv="content-type" py:replace="''"/> 
     58    <title>Testing the AutoCompleteField widget!</title> 
     59</head> 
     60 
     61<body> 
     62    ${acfield.display() 
     63</body> 
     64</html> 
     65}}} 
     66 1. Then change the `index` method so that the template gets passed our widget: 
    4967{{{ 
    5068#!python