Does nobody have any ideas about this?!? I stumbled across a link which
tells part of the story, so I now think it's more correct to use this:

    def save(self, data):
        temp = Message(
            contact_type = data['contact_type'],
            mobile_number = data['mobile_number'],
            message = data['message'],
            date_sent = datetime.datetime.now(),
            sender_id = data['sender'],
            date_sent_to_boom = datetime.datetime.now(),
        )
        temp.save()
        for t in data['teams']:
            temp.teams.add(Team.objects.get(pk=t))

However, only the last selected team in the list gets saved.

I would *really* appreciate it if someone could help me with this!

--
James



James Mulholland wrote:
> Hi, I have a routine like this in a custom manipulator (which handles
> SMS message-sending from a web-page):
>
> def save(self, data):
>     temp = Message(
>         contact_type = data['contact_type'],
>         mobile_number = data['mobile_number'],
>         message = data['message'],
>         date_sent = datetime.datetime.now(),
>         sender_id = data['sender'],
>     )
>     temp.set_teams(data['teams'])
>     temp.save()
>
> So "teams" is the M2M relationship which I'm attempting to save along
> with the message.  I get this error on submission:
>
> 'Message' object has no attribute 'set_teams'
> 
> Any ideas? TIA.
> 
> --
> James


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

Reply via email to