Re: Implement file upload in admin interface

2008-11-30 Thread Ben Lau
hi, It is mush easier then my approach. Thanks a lot! On Fri, Nov 28, 2008 at 9:28 PM, redbaron <[EMAIL PROTECTED]> wrote: > > > My current solution is. > > 1. Define new model Batches: > > class Batches(models.Model): > batchfile = model.FileField(upload_to="noop") > > 2. In admin.py define ne

Re: Implement file upload in admin interface

2008-11-28 Thread redbaron
My current solution is. 1. Define new model Batches: class Batches(models.Model): batchfile = model.FileField(upload_to="noop") 2. In admin.py define new form with custom validators: class BatchUploadForm(forms.ModelFormi): class Meta: model = Batches def clean_batchfile(se

Re: Implement file upload in admin interface

2008-11-28 Thread Ben Lau
Hi redbaron, My approach is to subclass ModelAdmin to implement a import command . It should need to override the __call__() and create a import_view() function to handle the import form. Example: class XXXAdmin(admin.ModelAdmin): def __call__(self, request, url):

Re: Implement file upload in admin interface

2008-11-28 Thread redbaron
I try to implement same thing.I need some place where I could upload file, django should parse it and populate database with new data. To make it more ease I defined new model BatchUpload with only one field batch. Now I need to customize upload handler method in admin site. Could anyone give advi

Implement file upload in admin interface

2008-11-27 Thread Ben Lau
Hi all, I would like to implement a data upload feature in admin interface for my application. A form with file upload field will be show for a data model. The file should be a XML file which is generated by another program and contain more than one record of data. Anybody implemented simila