ok I figured out my problem. (I think) when a update is applied it happens in the following order.. please correct me if i'm wrong.
..apply the edits on the object in question _save function called apply the edits to the one-to-many & many-to-many fields referenced. my issue is that the many to many has a custom update method which I am calling in _post_save and not in the actual field's manipulator.. Is this correct? is it as simple as just moving the code into tags manipulator??? regards Ian. On 10/17/05, Ian Holsman <[EMAIL PROTECTED]> wrote: > hi. > > I have a many to many table in django, which I'm having troubles updating. > > > class Keyword( meta.Model ): > URL = meta.URLField(core=True) > pagetype = meta.ForeignKey( PageType, verbose_name="the type of page") > regex = meta.CharField(maxlength=250) > to_match = meta.BooleanField() > description = meta.CharField(maxlength=255) > what_testing = meta.TextField(verbose_name="What are you testing") > tags = meta.ManyToManyField(Tag,blank=True) > tagField = meta.CharField(maxlength=255, > blank=True,verbose_name="List of tags you would like to categorize > this > post as") > > def _pre_save(self): > from django.models.conf import * > tagnames = self.tagField.split() > taglist = [] > for tagname in tagnames: > try: > tag_ref = tags.get_object(name__exact = tagname.lower()) > except tags.TagDoesNotExist,msg: > tag_ref = Tag(name=tagname.lower()) > tag_ref.save() > taglist.append(tag_ref.id) > self.set_tags(taglist) > > when I run the following from a python command line it works nicely. > > >>> from django.models.conf import * > >>> a=keywords.get_object(id__exact=1) > >>> a.tagField="moo baa lah lah" > >>> a.save() > >>> a.get_tag_list() > [moo, baa, lah] > > but when I use the generic update view from a web page it deletes the > reference (and it also removes the page-type Foreign key as well. > > any hints would be appreciated.. this has me stuck ;( > > -- > [EMAIL PROTECTED] -- ++61-3-9877-0909 > If everything seems under control, you're not going fast enough. - > Mario Andretti > -- [EMAIL PROTECTED] -- ++61-3-9877-0909 If everything seems under control, you're not going fast enough. - Mario Andretti