Project

General

Profile

« Previous | Next » 

Revision 1e0ec553

Added by Serghei Mihai almost 10 years ago

agenda: checking correctly the event type while deleting events

View differences:

calebasse/agenda/views.py
276 276
    template_name = 'agenda/new-event.html'
277 277

  
278 278
def delete_eventwithact(event):
279
    assert event.event_type == 1
279
    assert event.event_type.id == 1
280 280
    if event.act.id \
281 281
            and not event.act.is_billed:
282 282
        event.act.delete()
......
291 291

  
292 292
    def delete(self, request, *args, **kwargs):
293 293
        self.object = self.get_object()
294
        if self.object.event_type == 1:
294
        if self.object.event_type.id == 1:
295 295
            delete_eventwithact(self.object)
296 296
        else:
297 297
            self.object.delete()
......
310 310
            exception.recurrence_periodicity = None
311 311
            exception.exception_to = None
312 312
            exception.save()
313
            if exception.event_type == 1:
313
            if exception.event_type.id == 1:
314 314
                delete_eventwithact(exception)
315 315
            else:
316 316
                exception.delete()
317 317

  
318
        if self.object.event_type == 1:
318
        if self.object.event_type.id == 1:
319 319
            delete_eventwithact(self.object)
320 320
        else:
321 321
            self.object.delete()

Also available in: Unified diff