Browse Source

Merge remote-tracking branch 'origin' into prod

root 2 years ago
parent
commit
84124c0355
1 changed files with 23 additions and 16 deletions
  1. 23
    16
      app/main/views.py

+ 23
- 16
app/main/views.py View File

@@ -67,19 +67,21 @@ def index():
67 67
 @main.route('/about')
68 68
 @partial_content
69 69
 def about():
70
-    page = Page.query.filter_by(id=1).first_or_404()
70
+    page = Page.query.get_or_404(1)
71 71
     return [ 'displayMain',
72 72
            { "content": render_template("main_pages/about.html",
73
-                                        page=page) } ]
73
+                                        page=page),
74
+             "title": "À propos"} ]
74 75
 
75 76
 @main.route('/contrib')
76 77
 @partial_content
77 78
 def contribute():
78 79
     # create a real "contribute" page
79
-    page = Page.query.filter_by(id=2).first_or_404()
80
+    page = Page.query.get_or_404(2)
80 81
     return [ 'displayMain',
81 82
              { "content": render_template("main_pages/contribute.html",
82
-                                          page=page) } ]
83
+                                          page=page),
84
+               "title": "Contribuer"} ]
83 85
 
84 86
 #########################
85 87
 #  Podcasts             #
@@ -97,12 +99,13 @@ def podcasts():
97 99
     return [ 'displayMain',
98 100
              { "content": render_template("main_pages/podcasts.html",
99 101
                                           podcasts=podcasts,
100
-                                          pagination=pagination) } ]
102
+                                          pagination=pagination),
103
+               "title": "Podcasts" } ]
101 104
 
102 105
 @main.route('/podcasts/<id>')
103 106
 @partial_content
104 107
 def podcast(id):
105
-    podcast = Podcast.query.get(id)
108
+    podcast = Podcast.query.get_or_404(id)
106 109
     return [ 'displayMain',
107 110
              { "content": render_template("elem_pages/podcast.html",
108 111
                                           elem=podcast),
@@ -112,10 +115,11 @@ def podcast(id):
112 115
 @main.route('/podcasts/<id>/play')
113 116
 @partial_content_no_history
114 117
 def play(id):
115
-    podcast = Podcast.query.get(id)
118
+    podcast = Podcast.query.get_or_404(id)
116 119
     return [ "player.load.bind(player)",
117 120
              { "link" : podcast.link,
118
-               "title" : podcast.name } ]
121
+               "title" : podcast.name,
122
+               "channel": podcast.channel_id } ]
119 123
 
120 124
 ##############################
121 125
 #  Contributors/Collectives  #
@@ -129,23 +133,23 @@ def contributors():
129 133
              { "content": render_template("main_pages/contributors.html",
130 134
                                           contributors=Contributor.list(),
131 135
                                           collectives=Collective.list()),
132
-               "title": podcast.name,
133
-               "description" : podcast.description }]
136
+               "title": "Contributeurs",
137
+               "description" : "Liste des contributeurs de Radio Rhino." }]
134 138
 
135 139
 @main.route('/contributors/<id>')
136 140
 @partial_content
137 141
 def contributor(id):
138
-    contributor = Contributor.query.get(id)
142
+    contributor = Contributor.query.get_or_404(id)
139 143
     return [ 'displayMain',
140 144
              { "content": render_template("elem_pages/contributor.html",
141 145
                                           elem=contributor),
142
-               "title": podcast.name,
143
-               "description" : podcast.description }]
146
+               "title": contributor.name,
147
+               "description" : contributor.description }]
144 148
 
145 149
 @main.route('/collectives/<id>')
146 150
 @partial_content
147 151
 def collective(id):
148
-    collective = Collective.query.filter_by(id = id).first()
152
+    collective = Collective.query.get_or_404(id)
149 153
     return [ 'displayMain',
150 154
              { "content": render_template("elem_pages/contributor.html",
151 155
                                           elem=collective),
@@ -183,13 +187,16 @@ def blog(id):
183 187
 def agendas():
184 188
     return [ 'displayMain',
185 189
              { "content": render_template("main_pages/agendas.html",
186
-                                          events = Event.list(number=10)) } ]
190
+                                          events = Event.list(number=10)),
191
+               "title": "Agendas" } ]
187 192
 
188 193
 @main.route('/agendas/<id>')
189 194
 @partial_content
190 195
 def agenda(id):
196
+    event = Event.query.get_or_404(id)
191 197
     return [ 'displayMain',
192
-             { "content": render_template("notimplemented.html") }]
198
+             { "content": render_template("notimplemented.html"),
199
+               "title": event.name} ]
193 200
 
194 201
 #########################
195 202
 #  Static stuff         #

Loading…
Cancel
Save