doc/book/fr/04-develop-views.fr.txt
changeset 50 d642f43eb87d
parent 43 c1a51436db9c
equal deleted inserted replaced
48:0adf4d507ede 50:d642f43eb87d
       
     1 .. -*- coding: utf-8 -*-
       
     2 
       
     3 Définir l'interface utilisateur avec des vues
       
     4 =============================================
       
     5 
       
     6 `LAX` provides out-of-the-box a web interface that is generated from
       
     7 the schema definition: entities can be created, displayed, updated and
       
     8 deleted. As display views are not very fancy, it is usually necessary
       
     9 to develop your own.
       
    10 
       
    11 
       
    12 With `LAX`, views are defined by Python classes. A view includes :
       
    13 
       
    14 - an identifier (all objects in `LAX` are entered in a registry
       
    15   and this identifier will be used as a key)
       
    16   
       
    17 - a filter to select the resulsets it can be applied to
       
    18 
       
    19 `LAX` provides a lot of standard views, for a complete list, you
       
    20 will have to read the code in directory views (XXX improve doc).
       
    21 For example, the view named ``primary`` is the one used to display
       
    22 a single entity.
       
    23 
       
    24 If you want to change the way a ``BlogEntry`` is displayed, just
       
    25 override the view ``primary`` in ``BlogDemo/views.py`` ::
       
    26 
       
    27   from ginco.web.views import baseviews
       
    28   
       
    29   class BlogEntryPrimaryView(baseviews.PrimaryView):
       
    30 
       
    31       accepts = ('BlogEntry',)
       
    32       
       
    33       def cell_call(self, row, col):
       
    34           entity = self.entity(row, col)
       
    35           self.w(u'<h1>%s</h1>' % entity.title)
       
    36           self.w(u'<div>%s</div>' % entity.publish_date)
       
    37           self.w(u'<div>%s</div>' % entity.category)
       
    38           self.w(u'<div>%s</div>' entity.content)
       
    39 
       
    40 [WRITE ME]
       
    41 
       
    42 * Defining views with selection/views
       
    43 
       
    44 * implementing interfaces, calendar for blog entries
       
    45 
       
    46 * show that a calendar view can export data to ical
       
    47 
       
    48 * create view "blogentry table" with title, publish_date, category
       
    49 
       
    50 * in view blog, select blogentries and apply view "blogentry table"
       
    51 
       
    52 * demo ajax by filtering blogentry table on category
       
    53 
       
    54 Components
       
    55 ===========
       
    56 
       
    57 [WRITE ME]
       
    58 
       
    59 * explain the component architecture
       
    60 
       
    61 * add comments to the blog by importing the comments component
       
    62 
       
    63 MainTemplate
       
    64 ============
       
    65 
       
    66 [WRITE ME]
       
    67 
       
    68 * customize MainTemplate and show that everything in the user
       
    69   interface can be changed
       
    70 
       
    71 
       
    72 RSS Channel
       
    73 ===========
       
    74 
       
    75 [WRITE ME]
       
    76 
       
    77 * show that the RSS view can be used to display an ordered selection
       
    78   of blog entries, thus providing a RSS channel
       
    79 
       
    80 * show that a different selection (by category) means a different channel
       
    81 
       
    82 RQL
       
    83 ====
       
    84 
       
    85 [WRITE ME]
       
    86 
       
    87 * talk about the Relation Query Language
       
    88 
       
    89 URL Rewriting
       
    90 =============
       
    91 
       
    92 [WRITE ME]
       
    93 
       
    94 * show how urls are mapped to selections and views and explain URLRewriting 
       
    95 
       
    96 Security
       
    97 =========
       
    98 
       
    99 [WRITE ME]
       
   100 
       
   101 * talk about security access rights and show that security is defined
       
   102   using RQL
       
   103