views
main.views
¤
Views for the main app.
Classes¤
CapacitiesListView
¤
Bases: LoginRequiredMixin, PermissionRequiredMixin, SingleTableMixin, FilterView
View to display the list of capacities.
CapacityPlanningView
¤
Bases: LoginRequiredMixin, PermissionRequiredMixin, TemplateView
View that renders the Capacity Planning page.
Methods:¤
get_context_data(**kwargs)
¤
Add HTML components and Bokeh version to the context.
Source code in main/views.py
109 110 111 112 113 114 115 | |
CostRecoveryView
¤
Bases: LoginRequiredMixin, PermissionRequiredMixin, FormView
View that renders the Cost Recovery page.
Methods:¤
form_valid(form)
¤
Generate csv using the dates provided in the form.
Source code in main/views.py
125 126 127 128 129 130 | |
get_context_data(**kwargs)
¤
Add HTML components and Bokeh version to the context.
Source code in main/views.py
132 133 134 135 136 137 138 | |
IndexView
¤
Bases: TemplateView
View for the index page, using the home template.
Methods:¤
get_context_data(**kwargs)
¤
Add HTML components and Bokeh version to the context.
Create the Bokeh plots for project analytics overview, generate their HTML and add them to the homepage.
Source code in main/views.py
30 31 32 33 34 35 36 37 38 39 40 | |
ProjectCreateInlineView
¤
Bases: PermissionRequiredMixin, View
Create a Project together with its Funding and Phases in one page.
This view lets a new project be created with its funding and phases all
filled in together on a single page, via the FundingInlineFormSet and
ProjectPhaseInlineFormSet formsets, rather than requiring the project
to be created first and its funding/phases added separately afterwards.
Methods:¤
get(request)
¤
Render an empty Project form with empty Funding/Phase formsets.
Source code in main/views.py
159 160 161 162 163 164 165 166 167 | |
post(request)
¤
Validate and save the Project, then its Funding and Phase rows.
The project is saved first, so that the funding and phase rows (which reference it via a foreign key) can be validated and saved against a real primary key. Everything happens inside one atomic transaction: if the funding, phase or allocation formsets turn out to be invalid, the project creation is rolled back too, and the whole page is redisplayed with every error shown together.
Source code in main/views.py
169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | |
ProjectDetailInlineView
¤
Bases: PermissionRequiredMixin, View
Display a Project together with its Funding and Phases in one page.
This is the read-only counterpart of ProjectCreateInlineView and
ProjectUpdateInlineView: it shows the same Project/Funding/Phases
layout, but with every field disabled and without any of the
add-row/save affordances, since nothing here can be edited.
Methods:¤
get(request, pk)
¤
Render the Project, Funding and Phase details, all read-only.
Unlike the create/update views, no formsets are used here: each
existing Funding/Phase row is rendered as its own disabled
ModelForm, since there is no need for the extra blank rows,
management form, or delete checkboxes that a formset would add.
Source code in main/views.py
342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 | |
ProjectUpdateInlineView
¤
Bases: PermissionRequiredMixin, View
Update a Project together with its Funding and Phases in one page.
Methods:¤
get(request, pk)
¤
Render the Project form with its inline formsets pre-filled.
Source code in main/views.py
246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 | |
post(request, pk)
¤
Validate and save the Project together with its Funding/Phase rows.
Unlike the create view, the project already has a primary key, so all forms/formsets can be validated together up front.
Source code in main/views.py
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | |
ProjectsListView
¤
Bases: LoginRequiredMixin, PermissionRequiredMixin, FilterView
View to display the list of projects split in five pre-filtered tables.
Methods:¤
get_context_data(**kwargs)
¤
Add multiple pre-filtered tables to the context.
Source code in main/views.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
RegistrationView
¤
Bases: CreateView
View to register new users.
TODO: This is a placeholder for development. When SSO is implemented, this won't be needed since available users will be retrieved automatically.