mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Use django_import_export
- Allows import / export to multiple file formats - Provides admin interface - Work to be done to perform data tweaking - It would be really cool if the data fields could be associated 'intelligently' (i.e. not just based on PK, but name-lookup too).
This commit is contained in:
parent
8e6de1b832
commit
1027e812bc
@ -36,6 +36,7 @@ INSTALLED_APPS = [
|
||||
'rest_framework',
|
||||
'simple_history',
|
||||
'crispy_forms',
|
||||
'import_export',
|
||||
|
||||
# Core django modules
|
||||
'django.contrib.admin',
|
||||
@ -147,4 +148,8 @@ MEDIA_URL = '/media/'
|
||||
|
||||
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
|
||||
|
||||
# crispy forms use the bootstrap templates
|
||||
CRISPY_TEMPLATE_PACK = 'bootstrap'
|
||||
|
||||
# Use database transactions when importing / exporting data
|
||||
IMPORT_EXPORT_USE_TRANSACTIONS = True
|
||||
|
@ -1,10 +1,12 @@
|
||||
from django.contrib import admin
|
||||
from import_export.admin import ImportExportModelAdmin
|
||||
|
||||
from .models import PartCategory, Part
|
||||
from .models import BomItem
|
||||
from .models import PartAttachment
|
||||
|
||||
class PartAdmin(admin.ModelAdmin):
|
||||
#class PartAdmin(admin.ModelAdmin):
|
||||
class PartAdmin(ImportExportModelAdmin):
|
||||
|
||||
list_display = ('name', 'IPN', 'description', 'stock', 'category')
|
||||
|
||||
@ -13,7 +15,8 @@ class PartCategoryAdmin(admin.ModelAdmin):
|
||||
|
||||
list_display = ('name', 'pathstring', 'description')
|
||||
|
||||
class BomItemAdmin(admin.ModelAdmin):
|
||||
#class BomItemAdmin(admin.ModelAdmin):
|
||||
class BomItemAdmin(ImportExportModelAdmin):
|
||||
list_display=('part', 'sub_part', 'quantity')
|
||||
|
||||
class PartAttachmentAdmin(admin.ModelAdmin):
|
||||
|
@ -1,13 +1,18 @@
|
||||
from django.contrib import admin
|
||||
from import_export.admin import ImportExportModelAdmin
|
||||
|
||||
from .models import Supplier, SupplierPart, Customer, Manufacturer
|
||||
|
||||
|
||||
class CompanyAdmin(admin.ModelAdmin):
|
||||
class CompanyAdmin(ImportExportModelAdmin):
|
||||
list_display = ('name', 'website', 'contact')
|
||||
|
||||
|
||||
class SupplierPartAdmin(ImportExportModelAdmin):
|
||||
list_display = ('part', 'supplier', 'SKU')
|
||||
|
||||
|
||||
admin.site.register(Customer, CompanyAdmin)
|
||||
admin.site.register(Supplier, CompanyAdmin)
|
||||
admin.site.register(Manufacturer, CompanyAdmin)
|
||||
admin.site.register(SupplierPart)
|
||||
admin.site.register(SupplierPart, SupplierPartAdmin)
|
||||
|
@ -4,4 +4,5 @@ django_filter==1.0.2
|
||||
django-simple-history==1.8.2
|
||||
coreapi==2.3.0
|
||||
pygments==2.2.0
|
||||
django-crispy-forms==1.7.2
|
||||
django-crispy-forms==1.7.2
|
||||
django-import-export==1.0.0
|
Loading…
Reference in New Issue
Block a user