-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathviews.txt
356 lines (235 loc) · 8.24 KB
/
views.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
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
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
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
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
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
344
345
346
347
348
349
350
351
352
353
354
355
356
=====
Views
=====
calendar
========
This view is for displaying meta_data about calendars. Upcoming events, Name, description and so on and so forth. It should be noted that this is probably not the best view for displaying a calendar in a traditional sense, i.e. displaying a month calendar or a year calendar, as it does not equip the context with any period objects. If you would like to do this you should use calendar_by_period.
Required Arguments
------------------
``request``
As always the request object
``calendar_slug``
The slug of the calendar to be displayed
Optional Arguments
------------------
``template_name``
default
'schedule/calendar.html'
This is the template that will be rendered
Context Variables
-----------------
``calendar``
The Calendar object designated by the ``calendar_slug``.
calendar_by_period
==================
This view is for getting a calendar, but also getting periods with that
calendar. Which periods you get, is designated with the list periods. You
can designate which date you the periods to be initialized to by passing
a date in request.GET. See the template tag ``query_string_for_date``
Required Arguments
------------------
``request``
As always the request object
``calendar_slug``
The slug of the calendar to be displayed
Optional Arguments
------------------
``template_name``
default
'schedule/calendar_by_period .html'
This is the template that will be rendered
``periods``
default
``[]``
This is a list of Period Subclasses that designates which periods you would like to instantiate and put in the context
Context Variables
-----------------
``date``
This was the date that was generated from the query string.
``periods``
this is a dictionary that returns the periods from the list you passed
in. If you passed in Month and Day, then your dictionary would look
like this
::
{
'month': <schedule.periods.Month object>
'day': <schedule.periods.Day object>
}
So in the template to access the Day period in the context you simply
use ``periods.day``.
``calendar``
This is the Calendar that is designated by the ``calendar_slug``.
``weekday_names``
This is for convenience. It returns the local names of weekedays for
internationalization.
event
=====
This view is for showing an event. It is important to remember that an
event is not an occurrence. Events define a set of reccurring occurrences.
If you would like to display an occurrence (a single instance of a
recurring event) use ``occurrence``.
Required Arguments
------------------
``request``
As always the request object
``event_id``
the id of the event to be displayed
Optional Arguments
------------------
``template_name``
default
'schedule/calendar_by_period.html'
This is the template that will be rendered
Context Variables
-----------------
``event``
This is the event designated by the event_id
``back_url``
this is the url that referred to this view.
occurrence
==========
This view is used to display an occurrence. There are two methods of
displaying an occurrence.
Required Arguments
------------------
``request``
As always the request object
``event_id``
the id of the event that produces the occurrence
from here you need a way to distinguish the occurrence and that involves
``occurrence_id``
if its persisted
**or** it requires a distinguishing datetime as designated by the keywords below. This should designate the original start date of the occurrence that you wish to access. Using ``get_absolute_url`` from the Occurrence model will help you standardize this.
* ``year``
* ``month``
* ``day``
* ``hour``
* ``minute``
* ``second``
Optional Arguments
------------------
``template_name``
default
'schedule/calendar_by_period.html'
This is the template that will be rendered
Context Variables
-----------------
``event``
the event that produces the occurrence
``occurrence``
the occurrence to be displayed
``back_url``
the url from which this request was refered
edit_occurrence
===============
This view is used to edit an occurrence.
Required Arguments
------------------
``request``
As always the request object
``event_id``
the id for the event
from here you need a way to distinguish the occurrence and that involves
``occurrence_id``
the id of the occurrence if its persisted
**or** it requires a distinguishing datetime as designated by the keywords below. This should designate the original start date of the occurrence that you wish to access. Using ``get_edit_url`` from the Occurrence model will help you standardize this.
* ``year``
* ``month``
* ``day``
* ``hour``
* ``minute``
* ``second``
Optional Arguments
------------------
``template_name``
default
'schedule/calendar_by_period.html'
This is the template that will be rendered
Context Variables
-----------------
``form``
an instance of OccurrenceForm to be displayed
``occurrence``
an instance of the occurrence being modified
cancel_occurrence
=================
This view is used to cancel and occurrence. It is worth noting that canceling an occurrence doesn't stop it from being in occurrence lists or being persisted, it just changes the ``cancelled`` flag on the instance. It is import to check this flag when listing occurrences.
Also if this view is requested via POST, it will cancel the event and redirect. If this view is accessed via a GET request it will display a confirmation page.
Required Arguments
------------------
``request``
As always the request object
from here you need a way to distinguish the occurrence and that involves
``occurrence_id``
if its persisted
**or** it requires a distinguishing datetime as designated by the keywords below. This should designate the original start date of the occurrence that you wish to access. Using get_cancel_url from the Occurrence model will help you standardize this.
* ``year``
* ``month``
* ``day``
* ``hour``
* ``minute``
* ``second``
Optional Arguments
------------------
``template_name``
default
'schedule/calendar_by_period.html'
This is the template that will be rendered, if this view is accessed via GET
``next``
default
the event detail page of ``occurrence.event``
This is the url you wish to be redirected to after a successful cancelation
Context Variables
-----------------
``occurrence``
an instance of the occurrence being modified
create_or_edit_event
====================
This view is used for creating or editing events. If it receives a GET request or if given an invalid form in a POST request it will render the template, or else it will redirect.
Required Arguments
------------------
``request``
As always the request object
``calendar_id``
This is the calendar id of the event being created or edited.
Optional Arguments
------------------
``template_name``
default
'schedule/calendar_by_period.html'
This is the template that will be rendered
``event_id``
if you are editing an event, you need to pass in the id of the event, so that the form can be pre-propagated with the correct information and also so save works correctly
``next``
The url to redirect to upon successful completion or edition.
Context Variables
-----------------
``form``
an instance of EventForm to be displayed.
``calendar``
a Calendar with id=calendar_id
delete_event
============
This view is for deleting events. If the view is accessed via a POST request it will delete the event. If it is accessed via a GET request it will render a template to ask for confirmation.
Required Arguments
------------------
``request``
As always the request object
``event_id``
the id of the event to be deleted.
Optional Arguments
------------------
``template_name``
default
'schedule/calendar_by_period.html'
This is the template that will be rendered
``next``
The url to redirect to after successful deletion
``login_required``
default
``True``
if you want to require a login before deletion happens you can set that here
Context Variables
-----------------
``object``
The event object to be deleted