Example #1
0
 def duyuru_belge_indir(self):
     s3 = S3FileManager()
     keys = [dosya.ek_dosya for dosya in self.object.EkDosyalar]
     zip_name = "%s-duyuru-belgeler" % self.object.__unicode__()
     zip_url = s3.download_files_as_zip(keys, zip_name)
     self.set_client_cmd('download')
     self.output['download_url'] = zip_url
Example #2
0
 def sartname_indir(self):
     s3 = S3FileManager()
     keys = []
     for bt in self.current.task_data['secilen_butce_planlari']:
         butce_plani = BAPButcePlani.objects.get(bt)
         if butce_plani.teknik_sartname:
             keys.append(butce_plani.teknik_sartname.sartname_dosyasi)
     zip_name = "teknik-sartnameler"
     zip_url = s3.download_files_as_zip(keys, zip_name)
     self.set_client_cmd('download')
     self.current.output['download_url'] = zip_url
Example #3
0
    def post_save(self):
        """
        Get last_modified from S3 and update modify_date of this object.
        Returns:

        """
        s3_manager = S3FileManager()
        s3_time = s3_manager.get_last_modified_date(self.template)

        modify_date = self.change_date_format(s3_time)
        self.modify_date = modify_date

        self.save(internal=True)
Example #4
0
    def belge_indir(self):
        """
        Duyuruya teklif vermiş bütün firmaların teklifleri topluca bir zip dosyası halinde
        indirilir.

        """
        teklifler = BAPTeklif.objects.filter(satin_alma=self.object)
        keys = [
            belge.belge for teklif in teklifler for belge in teklif.Belgeler
        ]
        s3 = S3FileManager()
        zip_url = s3.download_files_as_zip(
            keys, "{}FirmaTeklifBelgeleri".format(self.object.ad))
        self.set_client_cmd('download')
        self.current.output['download_url'] = zip_url
Example #5
0
    def teklif_belgeleri_indir(self):
        """
        Seçilen teklife ait teklif belgeler zip dosyası olarak indirilir.
                
        """
        s3 = S3FileManager()
        if 'data_key' in self.current.input:
            teklif = BAPTeklif.objects.get(self.current.input['data_key'])
        else:
            teklif = BAPTeklif.objects.get(firma=self.firma, satin_alma=self.object)

        keys = [belge.belge for belge in teklif.Belgeler]
        zip_name = "%s-teklif-belgeler" % teklif.__unicode__()
        zip_url = s3.download_files_as_zip(keys, zip_name)
        self.set_client_cmd('download')
        self.current.output['download_url'] = zip_url
Example #6
0
 def _generate_temp_file(name, content, file_type, ext):
     f = S3FileManager()
     key = f.store_file(name=name, content=content, type=file_type, ext=ext)
     return get_file_url(key)