Nevermind, found this:
http://www.djangoproject.com/documentation/models/many_to_many/

And got it working.  woo WOOO!!!

On Tue, Jul 14, 2009 at 2:28 PM, Jesse Warden <jesse.war...@gmail.com>wrote:

> n00b here.  I'd like to create a complex Model from a Flex Object
> (basically decoded JSON).  I've created a Model successfully already, but am
> unsure how to do this with the multiple Models that have ManyToMany
> relationships with each other.
> This works:
>
> def create_power(request, powerObj):
> try:
> p = Power()
>  p.name = powerObj.name
> p.level = powerObj.level
>  p.save()
> ...
>
>
> However, I'd like to create the other models too.  Psuedo structure:
>
> class PowerSource(models.Model):
> label = models.CharField(max_length=200)
> power = models.ManyToManyField(Power)
>
> What would the code look like... maybe like this?
>
> ps = PowerSource()
> ps.label = powerObj.powerSource.label;
> ps.power = p;
> ps.save()
>
> Thanks if you can help!
>

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