예제 #1
0
    def handle(self, *app_labels, **options):
        ser_format = options.get('format')

        outfilename = options.get('outfile')
        if outfilename is None:
            raise CommandError('No --outfile specified (this is a required option)')
        self.target_dir = join(dirname(abspath(outfilename)), 'media')

        for modelclass in models_with_filefields():
            pre_dump.connect(self.save_images_for_signal, sender=modelclass)

        self.set_up_serializer(ser_format)

        with File(open(outfilename, 'w')) as self.stdout:
            super(Command, self).handle(*app_labels, **options)
예제 #2
0
    def handle(self, *args, **options):
        ser_format = options.get('format')

        outfilename = options.get('outfile')
        if outfilename is None:
            raise CommandError('No --outfile specified (this is a required option)')
        self.target_dir = join(dirname(abspath(outfilename)), 'media')

        for modelclass in models_with_filefields():
            pre_dump.connect(self.save_images_for_signal, sender=modelclass)

        self.set_up_serializer(ser_format)

        with File(open(outfilename, 'w')) as self.stdout:
            super(Command, self).handle(*args, **options)
예제 #3
0
    def handle(self, *app_labels, **options):
        ser_format = options.get("format")

        outfilename = options.get("outfile")
        if outfilename is None:
            raise CommandError(
                "No --outfile specified (this is a required option)")
        self.target_dir = join(dirname(abspath(outfilename)), "media")

        for modelclass in models_with_filefields():
            pre_dump.connect(self.save_images_for_signal, sender=modelclass)

        self.set_up_serializer(ser_format)

        with File(open(outfilename, "w")) as self.stdout:
            super().handle(*app_labels, **options)