Sorry, here comes the form definition

class AttachForm(forms.Form):
    file = forms.FilePathField(label=_('Select a file to attach'),
path=POSTIMAGE_ROOT,
                           recursive=True, required=True)
    alt = forms.CharField(_('Description (Alternative text)'),
initial=_('Image'))

As you can see it's very basic.

V

On Sep 12, 4:26 pm, "Karen Tracey" <[EMAIL PROTECTED]> wrote:
> On Fri, Sep 12, 2008 at 4:21 AM, Vikti <[EMAIL PROTECTED]> wrote:
> > Hi!
>
> > I am trying to write a simple app on top of admin [1] that lists a
> > directories content using a FilePathField element.
>
> > It works kind of alright except that the list isn't updated. I presume that
> > this is something related to caching so I added @never_cache to the view
> > function, but it didn't solve my problem. Now the code is
>
> > @user_passes_test(lambda u: u.is_staff)
> > @never_cache
> > def select(request):
> >     '''
> >     Just pass back the form, we do only javascript magic
> >     '''
> >     t = loader.get_template('admin/postimage/attach.html')
>
> >     form = AttachForm(initial={'file': request.GET.get('s')})
> >     c = { 'title': _('Attach file'),
> >          'form': form,
> >          'media_url': STATIC_URL,
> >          'postimage_url': POSTIMAGE_URL,
> >          'postimage_root': POSTIMAGE_ROOT,
> >          'for': request.GET['for'], }
> >     c = Context(c)
> >     return HttpResponse(t.render(c))
>
> > Is there something obvious I miss?
>
> > [1]http://code.google.com/p/django-postimage/
>
> Rather than suspecting caching, I'd suspect you've got code running at
> import time instead of form instantiation time that is determining the file
> list.  You did not include the form definition, though, in what you showed
> us, so it's hard to be sure.
>
> Karen
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to