mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
commit
96565325a8
Binary file not shown.
Before Width: | Height: | Size: 1.2 MiB After Width: | Height: | Size: 461 KiB |
BIN
InvenTree/InvenTree/static/img/paper_splash_large.jpg
Normal file
BIN
InvenTree/InvenTree/static/img/paper_splash_large.jpg
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.2 MiB |
@ -1,13 +1,29 @@
|
||||
# Generated by Django 2.2 on 2019-05-20 12:04
|
||||
|
||||
import InvenTree.validators
|
||||
from django.conf import settings
|
||||
import django.core.validators
|
||||
import os
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
from django.conf import settings
|
||||
import django.core.validators
|
||||
|
||||
import InvenTree.validators
|
||||
import part.models
|
||||
|
||||
|
||||
def attach_file(instance, filename):
|
||||
"""
|
||||
Generate a filename for the uploaded attachment.
|
||||
|
||||
2021-11-17 - This was moved here from part.models.py,
|
||||
as the function itself is no longer used,
|
||||
but is still required for migration
|
||||
"""
|
||||
|
||||
# Construct a path to store a file attachment
|
||||
return os.path.join('part_files', str(instance.part.id), filename)
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
initial = True
|
||||
@ -61,7 +77,7 @@ class Migration(migrations.Migration):
|
||||
name='PartAttachment',
|
||||
fields=[
|
||||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
|
||||
('attachment', models.FileField(help_text='Select file to attach', upload_to=part.models.attach_file)),
|
||||
('attachment', models.FileField(help_text='Select file to attach', upload_to=attach_file)),
|
||||
('comment', models.CharField(help_text='File comment', max_length=100)),
|
||||
],
|
||||
),
|
||||
|
@ -2135,20 +2135,6 @@ def after_save_part(sender, instance: Part, created, **kwargs):
|
||||
InvenTree.tasks.offload_task('part.tasks.notify_low_stock_if_required', instance)
|
||||
|
||||
|
||||
def attach_file(instance, filename):
|
||||
""" Function for storing a file for a PartAttachment
|
||||
|
||||
Args:
|
||||
instance: Instance of a PartAttachment object
|
||||
filename: name of uploaded file
|
||||
|
||||
Returns:
|
||||
path to store file, format: 'part_file_<pk>_filename'
|
||||
"""
|
||||
# Construct a path to store a file attachment
|
||||
return os.path.join('part_files', str(instance.part.id), filename)
|
||||
|
||||
|
||||
class PartAttachment(InvenTreeAttachment):
|
||||
"""
|
||||
Model for storing file attachments against a Part object
|
||||
|
@ -28,6 +28,7 @@ djangorestframework==3.12.4 # DRF framework
|
||||
flake8==3.8.3 # PEP checking
|
||||
gunicorn>=20.1.0 # Gunicorn web server
|
||||
inventree # Install the latest version of the InvenTree API python library
|
||||
markdown==3.3.4 # Force particular version of markdown
|
||||
pep8-naming==0.11.1 # PEP naming convention extension
|
||||
pillow==8.3.2 # Image manipulation
|
||||
py-moneyed==0.8.0 # Specific version requirement for py-moneyed
|
||||
|
Loading…
Reference in New Issue
Block a user