Projet

Général

Profil

« Précédent | Suivant » 

Révision 8a5069a6

Ajouté par Serghei Mihai (congés, retour 15/05) il y a presque 10 ans

agenda: checking if the event object has "act" attribute

Voir les différences:

calebasse/agenda/views.py
277 277

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

  
284
    if not event.act.id or \
285
            not event.act.is_billed:
281
    # in case of "event" is an instance of "Event" model and not "EventWithAct"
282
    # and so doesn't have 'act' attribute
283
    try:
284
        if event.act.id \
285
           and not event.act.is_billed:
286
            event.act.delete()
287

  
288
        if not event.act.id or \
289
           not event.act.is_billed:
290
            event.delete()
291
    except AttributeError:
286 292
        event.delete()
287 293

  
288 294
class DeleteOccurrenceView(TodayOccurrenceMixin, cbv.DeleteView):

Formats disponibles : Unified diff