コード例 #1
0
ファイル: views.py プロジェクト: hackita02/MapApp
 def get_initial(self):
     d = super().get_initial()
     doc_id = self.kwargs['doc_id']
     self.record = primo.primo_request(doc_id)
     data = nli.parse_record(self.record)
     collection, created = models.Collection.objects.get_or_create(
             code=data['collection_code'],
             defaults={
                 'title': data['collection_title'],
             })
     data['collection'] = collection.id
     d.update(data)
     return d
コード例 #2
0
ファイル: nli_tests.py プロジェクト: hackita02/MapApp
 def parse_doc(self, doc_id):
     with open("test_data/{}.json".format(doc_id)) as f:
         d = json.load(f)
     result = nli.parse_record(d)
     return result