mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Small refactor, and allow editing of ReportAsset in the admin interface
This commit is contained in:
parent
90bef69a59
commit
cbadb2a888
@ -18,7 +18,7 @@ class ReportTemplateAdmin(admin.ModelAdmin):
|
||||
|
||||
class ReportAssetAdmin(admin.ModelAdmin):
|
||||
|
||||
list_display = ('asset', 'description')
|
||||
list_display = ('id', 'asset', 'description')
|
||||
|
||||
|
||||
admin.site.register(ReportSnippet, ReportSnippetAdmin)
|
||||
|
@ -52,9 +52,7 @@ class TexResponse(HttpResponse):
|
||||
|
||||
def rename_template(instance, filename):
|
||||
|
||||
filename = os.path.basename(filename)
|
||||
|
||||
return os.path.join('report', 'report_template', instance.getSubdir(), filename)
|
||||
return instance.rename_file(filename)
|
||||
|
||||
|
||||
def validate_stock_item_report_filters(filters):
|
||||
@ -92,6 +90,13 @@ class ReportBase(models.Model):
|
||||
def getSubdir(self):
|
||||
return ''
|
||||
|
||||
def rename_file(self, filename):
|
||||
# Function for renaming uploaded file
|
||||
|
||||
filename = os.path.basename(filename)
|
||||
|
||||
return os.path.join('report', 'report_template', self.getSubdir(), filename)
|
||||
|
||||
@property
|
||||
def extension(self):
|
||||
return os.path.splitext(self.template.name)[1].lower()
|
||||
|
Loading…
Reference in New Issue
Block a user