Skip to content

Commit

Permalink
Call before_save on Canvas model
Browse files Browse the repository at this point in the history
  • Loading branch information
jayvarner committed Apr 24, 2024
1 parent c35b37a commit 623b3ed
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
8 changes: 6 additions & 2 deletions readux_ingest_ecds/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -194,15 +194,19 @@ def create_canvases(self):
except IndexError:
ocr_file_path = None

new_canvases.append(Canvas(
new_canvas = Canvas(
manifest=self.manifest,
image_server=self.image_server,
pid=canvas_pid,
ocr_file_path=ocr_file_path,
position=position,
width=width,
height=height
))
)

new_canvas.before_save()

new_canvases.append(new_canvas)

Canvas.objects.bulk_create(new_canvases)

Expand Down
3 changes: 3 additions & 0 deletions test_app/iiif/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class Canvas(models.Model):
default_ocr = models.CharField(max_length=30, choices=preferred_ocr, default="word")
image_server = models.ForeignKey(ImageServer, on_delete=models.DO_NOTHING, null=True)

def before_save(self):
return True

class OCR(models.Model):
OCR = 'cnt:ContentAsText'
TEXT = 'dctypes:Text'
Expand Down

0 comments on commit 623b3ed

Please sign in to comment.