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
96 97 98 99 100 101 102 | |
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
112 113 114 115 116 117 | |
get_context_data(**kwargs)
¤
Add HTML components and Bokeh version to the context.
Source code in main/views.py
119 120 121 122 123 124 125 | |
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
145 146 147 148 149 150 151 152 | |
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 or phase 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
154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 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 | |
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
307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 | |
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 Funding/Phase formsets pre-filled.
Source code in main/views.py
221 222 223 224 225 226 227 228 229 230 231 232 233 234 | |
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 three forms/formsets can be validated together up front.
Source code in main/views.py
236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 | |
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
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | |
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.
Functions:¤
index(request)
¤
View for the index page, using the home template.
Source code in main/views.py
25 26 27 | |