Django Admin拖放

时间:2015-09-25 18:16:09

标签: django drag-and-drop admin dropzone.js

寻找一些指导因为我在Django的经历方面进入了新的领域。我正在写一个reprographics请求应用程序,所以创建了几个模型:

class Job(models.Model):
  id = models.AutoField(primary_key=True) # AutoField?


class Resource(models.Model):
  id = models.AutoField(primary_key=True) # AutoField?
  job = models.ForeignKey(Job)
  file = models.FileField(upload_to="repro/")

管理视图包含内联资源

class ResourceInline(admin.TabularInline):
        model = Resource
        extra = 0

class JobAdmin(admin.ModelAdmin):
    model = Job
    list_display = ['requestedby','account','requestdate','requireddate','noofsides','noofcopies']
    list_filter = ['requireddate']
    search_fields = ['requestedby','account']
    form = JobForm
    fieldsets = [
        (None, {'fields': ['requestedby','account','requestdate','requireddate','noofsides','noofcopies'] }),
        ('Requirements', {'fields': ['color','sided','paper','finishing']}),
        ('Additional Information', {'fields': ['additionalinfo']}),

    ]
    inlines = [ResourceInline]
admin.site.register(Job,JobAdmin)

我打算使用dropzone.js并且自己有一个我可以自定义的change_form.html,但此时我有点迷失了。如何使用我的dropzone区域替换内联并使其正常工作?

感谢您提供任何帮助或指示。

克里斯

0 个答案:

没有答案