mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-31 05:05:42 +00:00 
			
		
		
		
	Refactor template helpers for displaying uploaded images (#3377)
* Refactor template helpers for displaying uploaded images * Unit test for asset tag * Unit tests for 'uploaded_image' tag * Add simple tests for part_image and company_image functions * Unit test for barcode constructor * Unit tests for qrcode * Refactor the 'company_logo.png' to be a new template tag - Add unit tests * Adds a new field to the report asset model - Unique key which can be used to identify particular assets - e.g. company logo * Refactor logo image tags - Make use of existing CUSTOM_LOGO setting - Adds a "logo_image" template tag for reports * Remove previous migration - strategy no longer required
This commit is contained in:
		| @@ -17,10 +17,10 @@ from stdimage.models import StdImageField | ||||
| import common.models | ||||
| import common.settings | ||||
| import InvenTree.fields | ||||
| import InvenTree.helpers | ||||
| import InvenTree.validators | ||||
| from common.settings import currency_code_default | ||||
| from InvenTree.fields import InvenTreeURLField | ||||
| from InvenTree.helpers import getBlankImage, getBlankThumbnail, getMediaUrl | ||||
| from InvenTree.models import InvenTreeAttachment | ||||
| from InvenTree.status_codes import PurchaseOrderStatus | ||||
|  | ||||
| @@ -177,16 +177,16 @@ class Company(models.Model): | ||||
|     def get_image_url(self): | ||||
|         """Return the URL of the image for this company.""" | ||||
|         if self.image: | ||||
|             return getMediaUrl(self.image.url) | ||||
|             return InvenTree.helpers.getMediaUrl(self.image.url) | ||||
|         else: | ||||
|             return getBlankImage() | ||||
|             return InvenTree.helpers.getBlankImage() | ||||
|  | ||||
|     def get_thumbnail_url(self): | ||||
|         """Return the URL for the thumbnail image for this Company.""" | ||||
|         if self.image: | ||||
|             return getMediaUrl(self.image.thumbnail.url) | ||||
|             return InvenTree.helpers.getMediaUrl(self.image.thumbnail.url) | ||||
|         else: | ||||
|             return getBlankThumbnail() | ||||
|             return InvenTree.helpers.getBlankThumbnail() | ||||
|  | ||||
|     @property | ||||
|     def parts(self): | ||||
|   | ||||
		Reference in New Issue
	
	Block a user