Projet

Général

Profil

« Précédent | Suivant » 

Révision fce3e1e6

Ajouté par Mikaël Ates il y a plus de 9 ans

Display a dialog for the reading of a cv2.

Voir les différences:

calebasse/dossiers/views.py
36 36

  
37 37
from calebasse.decorators import validator_only
38 38

  
39
from ..utils import get_service_setting, is_validator
39
from ..utils import get_service_setting, is_validator, get_last_file
40 40

  
41 41
class NewPatientRecordView(cbv.FormView, cbv.ServiceViewMixin):
42 42
    form_class = forms.NewPatientRecordForm
......
353 353

  
354 354
tab3_addresses = PatientRecordAddrView.as_view()
355 355

  
356
class ReadCV2View(cbv.FormView):
357
    template_name = 'dossiers/cv2.html'
358
    form_class = Form
359
    success_url = './view#tab=2'
360

  
361
    def get_context_data(self, **kwargs):
362
        ctx = super(ReadCV2View, self).get_context_data(**kwargs)
363
        cv_files_path = get_service_setting('cv_files_path')
364
        if not cv_files_path or not os.path.isdir(cv_files_path):
365
            return ctx
366
        reader_identifier = None
367
        try:
368
            reader_identifier = self.request.user.userworker.worker.cv2_reader_name
369
        except:
370
            pass
371
        filename = get_last_file(cv_files_path,
372
                prefix=reader_identifier, suffix='.xml')
373
        ctx['carte_vitale'] = filename
374
        return ctx
375

  
376
read_cv2 = validator_only(ReadCV2View.as_view())
377

  
356 378
class PatientRecordNotifsView(cbv.DetailView):
357 379
    model = PatientRecord
358 380
    template_name = 'dossiers/patientrecord_tab4_notifs.html'

Formats disponibles : Unified diff