Project

General

Profile

« Previous | Next » 

Revision fcfb4f5b

Added by Mikaël Ates almost 12 years ago

Add a dedicated page for days not locked (#2034).

View differences:

calebasse/agenda/views.py
17 17
from calebasse.actes.validation_states import VALIDATION_STATES
18 18
from calebasse.actes.models import Act, ValidationMessage
19 19
from calebasse.actes.validation import (automated_validation,
20
    unlock_all_acts_of_the_day)
20
    unlock_all_acts_of_the_day, are_all_acts_of_the_day_locked)
21 21
from calebasse import cbv
22 22

  
23 23
from forms import (NewAppointmentForm, NewEventForm,
......
309 309

  
310 310
        return context
311 311

  
312
class JoursNonVerouillesView(TemplateView):
312 313

  
314
    template_name = 'agenda/days-not-locked.html'
315

  
316
    def get_context_data(self, **kwargs):
317
        context = super(JoursNonVerouillesView, self).get_context_data(**kwargs)
318
        acts = EventAct.objects.filter(is_billed=False,
319
            patient__service=self.service).order_by('date')
320
        days_not_locked = []
321
        for act in acts:
322
            current_day = datetime.datetime(act.date.year, act.date.month, act.date.day)
323
            if not current_day in days_not_locked:
324
                locked = are_all_acts_of_the_day_locked(current_day, self.service)
325
                if not locked:
326
                    days_not_locked.append(current_day)
327
        context['days_not_locked'] = days_not_locked
328
        return context

Also available in: Unified diff