#4165: Upload Progress Middleware and Integration into the Admin
---------------------------------------------+------------------------------
   Reporter:  Michael Axiak <[EMAIL PROTECTED]>  |                Owner:  
nobody                
     Status:  new                            |            Component:  Admin 
interface       
    Version:  SVN                            |           Resolution:            
            
   Keywords:  upload, progress, ajax         |                Stage:  Design 
decision needed
  Has_patch:  1                              |           Needs_docs:  1         
            
Needs_tests:  1                              |   Needs_better_patch:  1         
            
---------------------------------------------+------------------------------
Comment (by Faheem Mitha <[EMAIL PROTECTED]>):

 Hi,

 I've been unable to get the most recent patch from #4165
 ([http://code.djangoproject.com/ticket/4165])
 to work. If anyone suggest what I might be doing wrong, or provide a
 minimal working example, that would be most helpful.

 My understanding is that #4165 should work more or less out of the box
 with the default admin view, once a few configurations have been made.
 Specifically, I should see an upload progress bar in a model which
 contains eg a FileField when I try to upload something. Note also that JS
 is enabled in the browsers I'm using -- I tried a couple of different
 ones.

 So, I have followed the most recent instructions on the wiki as far as I
 was able. See below.

 The model I am using is

 == extract from models.py ==
 {{{
 class FileUpload(models.Model):
     upload_date = models.DateTimeField(default=datetime.now(), blank=True,
 editable=False)
     upload = models.FileField(upload_to="bixfile")
     name = models.CharField(core=True, maxlength=100)
     description = models.CharField(blank=True, maxlength=200)
     folder = models.ForeignKey(FolderUpload, null=True, blank=True,
 related_name='parentfolder',
 edit_inline=models.TABULAR)

     class Admin:
         pass
 }}}

 I checked that a table called uploadprogress_fileprogress is created in
 the db, as see below

 == sqlite output ==
 {{{
 sqlite> .dump uploadprogress_fileprogress
 BEGIN TRANSACTION;
 CREATE TABLE "uploadprogress_fileprogress" (
     "id" integer NOT NULL PRIMARY KEY,
     "remote_addr" varchar(64) NOT NULL,
     "progress_id" varchar(32) NOT NULL,
     "progress_text" text NOT NULL,
     "last_ts" datetime NOT NULL,
     UNIQUE ("remote_addr", "progress_id")
 );
 }}}

 I see the expected listing in the admin view.

 == admin listing for add file progress ==

 {{{
 Add file progress

 Remote addr:
 Progress id:
 Last ts:

 Date:  Today | Calendar
 Time:  Now | Clock
 }}}

 However, there is nothing corresponding to a progress bar in FileUpload.
 What am I doing wrong, if anything? If you don't have the time or
 inclination to debug my setup, could you provide a minimal working
 example?

                                                          Thanks, Faheem.

 == installation notes ==
 > INSTALLATION

 > The above docs don't really work. Here's a revised version.

 > 1. Add #2070 to your source tree

 Used 6469_streaming_file_upload.diff as uploaded to
 [http://code.djangoproject.com/ticket/2070]. When tested separately,
 this seems to work fine.

 > 2. Add the latest patch (of this ticket) to your source tree.

 Patched against svn 6469 + 6469_streaming_file_upload.diff, and added an
 empty
 django/contrib/uploadprogress/__init__.py.

 > 3. Setup your middleware/models to track file progress.

 Did the following as detailed below:

 * Added 'django.contrib.uploadprogress.middleware.FileProgressDB' to
   my MIDDLEWARE_CLASSES.[[BR]]
 * Added 'django.contrib.uploadprogress' to my INSTALLED_APPS.[[BR]]
 * Issued a ./manage.py syncdb [[BR]]

 > 4. Set FILE_UPLOAD_DIR to a writable folder in your settings.py file.

 Set this as

 FILE_UPLOAD_DIR='/tmp'.

 > For (3), there are two options that come in the patch (as uploadprogress
 contrib):

 >     * FileProgressCached -- uses the cache framework for quicker ajax
 (will NOT > work if your cache framework doesn't) [[BR]]
 >     * FileProgressDB -- uses Database models [[BR]]

 > Depending on what you choose, continue below.

 See above.

 > FileProgressCached

 > To enable this, add
 'django.contrib.uploadprogress.middleware.FileProgressCached' to your
 > MIDDLEWARE_CLASSES.

 > FileProgressDB

 > To enable this:

 >     * Add 'django.contrib.uploadprogress.middleware.FileProgressDB' to
 your MIDDLEWARE_CLASSES.[[BR]]
 >     * Add 'django.contrib.uploadprogress' to your INSTALLED_APPS.[[BR]]
 >     * Issue a ./manage.py syncdb [[BR]]

-- 
Ticket URL: <http://code.djangoproject.com/ticket/4165#comment:21>
Django Code <http://code.djangoproject.com/>
The web framework for perfectionists with deadlines
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to