Skip to content

Commit

Permalink
Request the full path of a photo
Browse files Browse the repository at this point in the history
The config being module-specific and the path being based on two fields + config, a Model feature makes a lot of sense.
  • Loading branch information
edarchis committed Sep 23, 2022
1 parent fd90946 commit 126f1a6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions insuree/models.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import os.path
import uuid

import core
Expand Down Expand Up @@ -45,6 +46,11 @@ class InsureePhoto(core_models.VersionedModel):
db_column='AuditUserID', blank=True, null=True)
# rowid = models.TextField(db_column='RowID', blank=True, null=True)

def full_file_path(self):
if not InsureeConfig.insuree_photos_root_path or not self.filename:
return None
return os.path.join(InsureeConfig.insuree_photos_root_path, self.folder, self.filename)

class Meta:
managed = False
db_table = 'tblPhotos'
Expand Down

0 comments on commit 126f1a6

Please sign in to comment.