Exemplo n.º 1
0
Arquivo: doc.py Projeto: vikoivun/kamu
 def save_stages(self, doc, info):
     for st in info['phases']:
         args = {'doc': doc, 'index': st[0]}
         try:
             st_obj = DocumentProcessingStage.objects.get(**args)
         except DocumentProcessingStage.DoesNotExist:
             st_obj = DocumentProcessingStage(**args)
         st_obj.stage = st[1]
         st_obj.date = st[2]
         st_obj.save()
Exemplo n.º 2
0
    def save_stages(self, doc, info):
        for st in info['phases']:
            args = {'doc': doc, 'index': st['index']}
            try:
                st_obj = DocumentProcessingStage.objects.get(**args)
            except DocumentProcessingStage.DoesNotExist:
                st_obj = DocumentProcessingStage(**args)
            st_obj.stage = st['phase']
            st_obj.date = st['date']
            st_obj.save()

            for pli in st.get('plsess_items', []):
                try:
                    item = PlenarySessionItem.objects.get(
                        plsess__name=pli['plsess'],
                        number=pli['index'],
                        sub_number=None)
                except PlenarySessionItem.DoesNotExist:
                    raise Exception('Plenary session item %s/%s not found' %
                                    (pli['plsess'], pli['index']))
                try:
                    item_doc = PlenarySessionItemDocument.objects.get(
                        doc=doc, item=item)
                    item_doc.stage = st['phase']
                    item_doc.save(update_fields=['stage'])
                except PlenarySessionItemDocument.DoesNotExist:
                    pass
Exemplo n.º 3
0
    def save_stages(self, doc, info):
        for st in info['phases']:
            args = {'doc': doc, 'index': st['index']}
            try:
                st_obj = DocumentProcessingStage.objects.get(**args)
            except DocumentProcessingStage.DoesNotExist:
                st_obj = DocumentProcessingStage(**args)
            st_obj.stage = st['phase']
            st_obj.date = st['date']
            st_obj.save()

            for pli in st.get('plsess_items', []):
                try:
                    item = PlenarySessionItem.objects.get(plsess__name=pli['plsess'], number=pli['index'],
                                                          sub_number=None)
                except PlenarySessionItem.DoesNotExist:
                    raise Exception('Plenary session item %s/%s not found' % (pli['plsess'], pli['index']))
                try:
                    item_doc = PlenarySessionItemDocument.objects.get(doc=doc, item=item)
                    item_doc.stage = st['phase']
                    item_doc.save(update_fields=['stage'])
                except PlenarySessionItemDocument.DoesNotExist:
                    pass