Projet

Général

Profil

« Précédent | Suivant » 

Révision d17efc19

Ajouté par Mikaël Ates (de retour le 29 avril) il y a plus de 9 ans

It is no longer possible in Django 1.7 to reference a model at import time.

Voir les différences:

calebasse/dossiers/__init__.py
1
from django.apps import AppConfig
2

  
3

  
4
class DossiersConfig(AppConfig):
5
    name = 'calebasse.dossiers'
6

  
7
    def ready(self):
8
        PatientRecord = self.get_model('PatientRecord')
9
        PatientRecord.DEFICIENCY_FIELDS = [field for field in PatientRecord._meta.get_all_field_names() if field.startswith('deficiency_')]
10
        PatientRecord.MISES_FIELDS = [field for field in PatientRecord._meta.get_all_field_names() if field.startswith('mises_')]
11

  
12

  
13
default_app_config = 'calebasse.dossiers.DossiersConfig'
calebasse/dossiers/models.py
1063 1063
    patient.policyholder = patient.patientcontact
1064 1064
    patient.save()
1065 1065
    return patient
1066

  
1067
PatientRecord.DEFICIENCY_FIELDS = [field for field in PatientRecord._meta.get_all_field_names() if field.startswith('deficiency_')]
1068
PatientRecord.MISES_FIELDS = [field for field in PatientRecord._meta.get_all_field_names() if field.startswith('mises_')]

Formats disponibles : Unified diff