Thanks, it works! I missed the forms.ModelChoiceField in the documentation!
On Jul 20, 10:23 am, Nathan Ostgard <[EMAIL PROTECTED]> wrote: > Use forms.ModelChoiceField instead: > > immagine = > forms.ModelChoiceField(queryset=Pics.objects.all().order_by('immagine'), > cache_choices=False, label='Pic', required=False) > > On Jul 20, 1:15 am, ilDave <[EMAIL PROTECTED]> wrote: > > > I've a form that handles file uploading to the database: it works > > fine, the file is uploaded in the right place and the path is written > > on the database (I use a models.ImageField field in a model). > > > Than I have another form, that uses newforms, with a <select> field > > that should be populated with all the images path inside the db: > > > class MyForm(forms.Form): > > imgchoice = [('', 'Select:'),] > > imgs = Pics.objects.all().order_by('immagine') > > for i in imgs: > > imgchoice.append((i.id, i.immagine)) > > > immagine = forms.ChoiceField(choices=imgchoice, label='Pic', > > initial='', required=False) > > > The problem is that if I insert a new image and that I open the other > > form, the image that i just uploaded does not show in the select > > field. > > I'm using Apache and mod_pyton, and I noticed that if I restart Apache > > the new images whow up. > > > How can I do to resolve without the need to restart the webserver? > > > Thanks. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---