Projet

Général

Profil

« Précédent | Suivant » 

Révision dd986559

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

agenda: room renamed to ressource

Closes #4653

Voir les différences:

calebasse/agenda/views.py
15 15
from calebasse.personnes.models import TimeTable, Holiday
16 16
from calebasse.agenda.appointments import get_daily_appointments, get_daily_usage
17 17
from calebasse.personnes.models import Worker
18
from calebasse.ressources.models import WorkerType, Room
18
from calebasse.ressources.models import WorkerType, Ressource
19 19
from calebasse.actes.validation import (get_acts_of_the_day,
20 20
        get_days_with_acts_not_locked)
21 21
from calebasse.actes.validation_states import VALIDATION_STATES
......
72 72

  
73 73
        # ressources
74 74
        context['ressources_types'] = []
75
        data = {'type': Room._meta.verbose_name_plural,
76
                'ressources': Room.objects.all()}
75
        data = {'type': Ressource._meta.verbose_name_plural,
76
                'ressources': Ressource.objects.all()}
77 77
        context['ressources_types'].append(data)
78 78

  
79 79
        return context
......
146 146
        initial['date'] = self.date
147 147
        initial['participants'] = self.request.GET.getlist('participants')
148 148
        initial['time'] = self.request.GET.get('time')
149
        initial['room'] = self.request.GET.get('room')
149
        initial['ressource'] = self.request.GET.get('ressource')
150 150
        return initial
151 151

  
152 152
    def get_form_kwargs(self):
......
222 222
        initial['participants'] = self.request.GET.getlist('participants')
223 223
        initial['time'] = self.request.GET.get('time')
224 224
        initial['event_type'] = 2
225
        initial['room'] = self.request.GET.get('room')
225
        initial['ressource'] = self.request.GET.get('ressource')
226 226
        if not initial.has_key('services'):
227 227
            initial['services'] = [self.service]
228 228
        return initial
......
589 589

  
590 590
    def get_context_data(self, ressource_id, **kwargs):
591 591
        context = super(AjaxRessourceTabView, self).get_context_data(**kwargs)
592
        ressource = Room.objects.get(pk=ressource_id)
592
        ressource = Ressource.objects.get(pk=ressource_id)
593 593
        plain_events = Event.objects.for_today(self.date) \
594 594
                                    .order_by('start_datetime').select_subclasses()
595 595
        events = [ e.today_occurrence(self.date) for e in plain_events ]
596
        events_ressource = [e for e in events if ressource == e.room]
596
        events_ressource = [e for e in events if ressource == e.ressource]
597 597
        context['ressource_agenda'] = {'appointments': get_daily_usage(context['date'],
598 598
                                                                       ressource,
599 599
                                                                       self.service,
......
607 607
    cookies_to_clear = []
608 608

  
609 609
    def get_ressource_context_data(self, ressource_id, context):
610
        ressource = Room.objects.get(pk = ressource_id)
610
        ressource = Ressource.objects.get(pk = ressource_id)
611 611
        context['initials'] = ressource.name[:3]
612 612
        disponibility = dict()
613 613
        start_datetime = datetime.datetime(self.date.year,
......
615 615
                                           self.date.day, 8, 0)
616 616
        end_datetime = datetime.datetime(self.date.year, self.date.month,
617 617
                                         self.date.day, 8, 15)
618
        events = Event.objects.filter(room__id=ressource_id).today_occurrences(self.date)
618
        events = Event.objects.filter(ressource__id=ressource_id).today_occurrences(self.date)
619 619

  
620 620
        while (start_datetime.hour <= 19):
621 621
            if start_datetime.hour not in disponibility:

Formats disponibles : Unified diff