solution:
user_extended_profile.userextendedprofilefavourites_set.all().delete()
before inserting the new related object works.

Am 05.07.2007 um 15:44 schrieb va:patrick.kranzlmueller:

>
> I´m having trouble using newforms with an intermediary table
> (although I´m not sure that my problem relates to newforms anyhow).
>
> models:
> class UserExtendedProfile(models.Model):
>       ...
> class UserExtendedProfileFavourites(models.Model):
>      userextendedprofile = models.ForeignKey(UserExtendedProfile,
> edit_inline=models.TABULAR, num_in_admin=5, max_num_in_admin=5,
> num_extra_on_change=1)
>      ...
>
> views:
> ...
> user_extended_profile.save()
> # set favourites
> user_extended_profile.userextendedprofilefavourites_set = [fav1,
> fav2, fav3]
>
> now, when saving the related favourites, the _old_ favourites are not
> deleted but the new ones are added.
> I thought it´s possible to update the favourites in a way that the
> old ones are deleted and the new ones are added. Am I wrong with my
> assumption or do I use the wrong code?
>
> thanks,
> patrick
>
>
>
>
>
> >


--~--~---------~--~----~------------~-------~--~----~
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