Alex,

That's the one.  And it works!

Just for once it wasn't my fault - and I can go to bed (it's after
midnight, again).

Thanks so much for that.

Have a good day/evening/morning...

Phoebe.

On Feb 12, 12:04 am, Alex Gaynor <alex.gay...@gmail.com> wrote:
> On Wed, Feb 11, 2009 at 7:02 PM, phoebebright 
> <phoebebright...@gmail.com>wrote:
>
>
>
>
>
> > It sounds like it.  I've tried to get the version 9765 as suggested
> > but I don't think I have the right syntax:
> > [r...@viv site-packages]# svn co
> >http://code.djangoproject.com/svn/django/trunk/
> > 9765
> > [r...@viv site-packages]# svn co
> >http://code.djangoproject.com/svn/django/trunk/
> > r9765 <http://code.djangoproject.com/svn/django/trunk/%0Ar9765>
> > [r...@viv site-packages]# svn checkout
> >http://code.djangoproject.com/svn/django/trunk/
> > 9765
>
> > Don't seem to do the job:
>
> > ...
> > A    9765/examples/hello/urls.py
> > A    9765/examples/views.py
> > A    9765/examples/__init__.py
> > A    9765/examples/settings.py
> > A    9765/examples/urls.py
> > A    9765/setup.cfg
> >  U   9765
> > Checked out revision 9824.
>
> > And dates are Feb 2
>
> > Any suggestions?
>
> > On Feb 11, 11:32 pm, Alex Gaynor <alex.gay...@gmail.com> wrote:
> > > On Wed, Feb 11, 2009 at 6:30 PM, phoebebright <phoebebright...@gmail.com
> > >wrote:
>
> > > > I thought I had a custom widget which would allow images to be deleted
> > > > working and was dead chuffed (http://groups.google.com/group/django-
> > > > users/browse_thread/thread/ebf646208fa8880f/c22f87e85b5d78ef?
> > > > lnk=gst&q=admin+image#c22f87e85b5d78ef<
> >http://groups.google.com/group/django-%0Ausers/browse_thread/thread/e...>)
> > > > but unfortunately it doesn't
> > > > work.  I have spent the whole evening trying to work out what exactly
> > > > is going on and have to admit defeat.
>
> > > > The widget adds a delete checkbox next to each image as well as
> > > > displaying it, then in the save_model() method it checks to see if
> > > > this checkbox was set and clears the field if it is.
>
> > > >  def save_model(self, request, obj, form, change):
>
> > > >            #handle delete checkbox for pics
> > > >            if request.POST.get('delete_pic1','off')=='on':
> > > >                obj.pic1=''
>
> > > > This is what happens:
> > > > 1. create a new record and add an image - OK
> > > > 2. edit the record - image is displayed - make no changes and click
> > > > save - OK
> > > > 3. edit the record again and the image is gone - NOT OK!
>
> > > > This is my thinking so far:
> > > > I wondered if I needed to set the value when assigning the widget to
> > > > the field, but as the image is displayed in step 2, I recon not.
> > > > I tried also saving the value of pic in a hidden field and modifying
> > > > save_model
>
> > > >            if request.POST.get('delete_pic2','off')=='on':
> > > >                obj.pic2=''
> > > >            else:
> > > >                obj.pic2=request.POST.get('old_pic2','')
>
> > > > But it never even gets uploaded in step 1. So I tried:
>
> > > >           try:
> > > >                p=request.FILES.get('pic1')
> > > >            except:
> > > >                if request.POST.get('delete_pic1','off')=='on':
> > > >                    obj.pic1=''
>
> > > > And this goes back to the behaviour in the original step.
>
> > > > I have tried putting in various breaks in the django code in files.py
> > > > to try and understand what is happening but my lack of debugging
> > > > skills are not helping!  The client is expecting to see this tomorrow
> > > > so despite having plagued this list today with my problems, I hope to
> > > > prevail upon you to help me one more time...
>
> > > If you are on trunk it looks like you are experiencinghttp://
> > code.djangoproject.com/ticket/10121.
>
> > > Alex
>
> > > --
> > > "I disapprove of what you say, but I will defend to the death your right
> > to
> > > say it." --Voltaire
> > > "The people's good is the highest law."--Cicero
>
> I'm not an svn user, but I think the sytnax is svn co -r <n> <url>
>
> --
> "I disapprove of what you say, but I will defend to the death your right to
> say it." --Voltaire
> "The people's good is the highest law."--Cicero
--~--~---------~--~----~------------~-------~--~----~
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 
django-users+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to