mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-30 20:55:42 +00:00 
			
		
		
		
	Part image field now uses django-stdimage
This commit is contained in:
		
							
								
								
									
										20
									
								
								InvenTree/part/migrations/0033_auto_20200404_0445.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								InvenTree/part/migrations/0033_auto_20200404_0445.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,20 @@ | |||||||
|  | # Generated by Django 2.2.10 on 2020-04-04 04:45 | ||||||
|  |  | ||||||
|  | from django.db import migrations | ||||||
|  | import part.models | ||||||
|  | import stdimage.models | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class Migration(migrations.Migration): | ||||||
|  |  | ||||||
|  |     dependencies = [ | ||||||
|  |         ('part', '0032_auto_20200322_0453'), | ||||||
|  |     ] | ||||||
|  |  | ||||||
|  |     operations = [ | ||||||
|  |         migrations.AlterField( | ||||||
|  |             model_name='part', | ||||||
|  |             name='image', | ||||||
|  |             field=stdimage.models.StdImageField(blank=True, null=True, upload_to=part.models.rename_part_image), | ||||||
|  |         ), | ||||||
|  |     ] | ||||||
| @@ -27,6 +27,8 @@ from django_cleanup import cleanup | |||||||
|  |  | ||||||
| from mptt.models import TreeForeignKey | from mptt.models import TreeForeignKey | ||||||
|  |  | ||||||
|  | from stdimage.models import StdImageField | ||||||
|  |  | ||||||
| from decimal import Decimal | from decimal import Decimal | ||||||
| from datetime import datetime | from datetime import datetime | ||||||
| from rapidfuzz import fuzz | from rapidfuzz import fuzz | ||||||
| @@ -373,7 +375,13 @@ class Part(models.Model): | |||||||
|  |  | ||||||
|     URL = InvenTreeURLField(blank=True, help_text=_('Link to extenal URL')) |     URL = InvenTreeURLField(blank=True, help_text=_('Link to extenal URL')) | ||||||
|  |  | ||||||
|     image = models.ImageField(upload_to=rename_part_image, max_length=255, null=True, blank=True) |     image = StdImageField( | ||||||
|  |         upload_to=rename_part_image, | ||||||
|  |         null=True, | ||||||
|  |         blank=True, | ||||||
|  |         variations={'thumbnail': (200, 200)}, | ||||||
|  |         delete_orphans=True | ||||||
|  |         ) | ||||||
|  |  | ||||||
|     default_location = TreeForeignKey('stock.StockLocation', on_delete=models.SET_NULL, |     default_location = TreeForeignKey('stock.StockLocation', on_delete=models.SET_NULL, | ||||||
|                                       blank=True, null=True, |                                       blank=True, null=True, | ||||||
|   | |||||||
| @@ -18,3 +18,4 @@ flake8==3.3.0                   # PEP checking | |||||||
| coverage==4.0.3                 # Unit test coverage | coverage==4.0.3                 # Unit test coverage | ||||||
| python-coveralls==2.9.1         # Coveralls linking (for Travis) | python-coveralls==2.9.1         # Coveralls linking (for Travis) | ||||||
| rapidfuzz==0.2.1                # Fuzzy string matching | rapidfuzz==0.2.1                # Fuzzy string matching | ||||||
|  | django-stdimage==5.0.3          # Advanced ImageField management | ||||||
		Reference in New Issue
	
	Block a user