Beispiel #1
0
    def save(self, metadata, original, instance, preview=None):
        files = dict(original=original, preview=preview)
        form = DocumentForm(data=metadata, files=files, instance=instance)

        if form.is_valid():
            if self.dry_run:
                self.report.notice('Metadata valid', metadata['title'])
            else:
                doc = form.save()
                self.report.notice('Uploaded media', str(doc))
        else:
            for field, error in form.errors.items():
                self.report.error('{}: {}'.format(field, error.as_text()),
                                  metadata)
Beispiel #2
0
    def save(self, metadata, original, instance, preview=None):
        files = dict(original=original, preview=preview)
        form = DocumentForm(data=metadata, files=files, instance=instance)

        if form.is_valid():
            if self.dry_run:
                self.stdout.write(u'✔ Metadata valid {}'.format(
                                                            metadata['title']))
            else:
                doc = form.save()
                self.stdout.write(u'✔ Uploaded media {}'.format(doc))
        else:
            for field, error in form.errors.items():
                self.skip('{}: {}'.format(field, error.as_text()), metadata)
Beispiel #3
0
    def save(self, metadata, original, instance, preview=None):
        files = dict(original=original, preview=preview)
        form = DocumentForm(data=metadata, files=files, instance=instance)

        if form.is_valid():
            if self.dry_run:
                self.report.notice('Metadata valid', metadata['title'])
            else:
                doc = form.save()
                self.report.notice('Uploaded media', str(doc))
        else:
            for field, error in form.errors.items():
                self.report.error('{}: {}'.format(field, error.as_text()),
                                  metadata)