equal
deleted
inserted
replaced
25 It defines the type of content your application will handle. |
25 It defines the type of content your application will handle. |
26 |
26 |
27 The data model of your cube ``blog`` is defined in the file ``schema.py``: |
27 The data model of your cube ``blog`` is defined in the file ``schema.py``: |
28 |
28 |
29 :: |
29 :: |
|
30 |
|
31 from yams.buildobjs import EntityType, String, SubjectRelation, Date |
30 |
32 |
31 class Blog(EntityType): |
33 class Blog(EntityType): |
32 title = String(maxsize=50, required=True) |
34 title = String(maxsize=50, required=True) |
33 description = String() |
35 description = String() |
34 |
36 |
36 title = String(required=True, fulltextindexed=True, maxsize=256) |
38 title = String(required=True, fulltextindexed=True, maxsize=256) |
37 publish_date = Date(default='TODAY') |
39 publish_date = Date(default='TODAY') |
38 content = String(required=True, fulltextindexed=True) |
40 content = String(required=True, fulltextindexed=True) |
39 entry_of = SubjectRelation('Blog', cardinality='?*') |
41 entry_of = SubjectRelation('Blog', cardinality='?*') |
40 |
42 |
|
43 The first step is the import of the EntityType (generic class for entityĆ and |
|
44 attributes that will be used in both Blog and BlogEntry entities. |
41 |
45 |
42 A Blog has a title and a description. The title is a string that is |
46 A Blog has a title and a description. The title is a string that is |
43 required and must be less than 50 characters. The |
47 required and must be less than 50 characters. The |
44 description is a string that is not constrained. |
48 description is a string that is not constrained. |
45 |
49 |
62 |
66 |
63 To use this cube as an instance and create a new instance named ``blogdemo``, do:: |
67 To use this cube as an instance and create a new instance named ``blogdemo``, do:: |
64 |
68 |
65 cubicweb-ctl create blog blogdemo |
69 cubicweb-ctl create blog blogdemo |
66 |
70 |
67 |
|
68 This command will create the corresponding database and initialize it. |
71 This command will create the corresponding database and initialize it. |
|
72 |
69 |
73 |
70 Welcome to your web instance |
74 Welcome to your web instance |
71 ------------------------------- |
75 ------------------------------- |
72 |
76 |
73 Start your instance in debug mode with the following command: :: |
77 Start your instance in debug mode with the following command: :: |