On Jan 22, 4:50 am, "Joni @ mindpulse" <decimea...@gmail.com> wrote:
> Comparing all of them, It looks like PyAMF is the way to go, having
> oficial sopport for django and all.
>
> Though I'm concerned about one particular issue... Suppose I have two
> django models related by a FK.
>
> class Category(models.Model):
>     name = models.CharField(max_length=100)
>
> class Product(models.Model):
>     code = models.CharField(max_length=100)
>     category = models.ForeignKey(Category)
>
> I would need to map both classes to their Actionscript counterparts.
> What I'm not sure about is what happens with the FK in Product? Is it
> possible to define something like this:
>
> class ASCategory
> {
>     public var name:String;
>
> }
>
> class ASProduct
> {
>     public var code:String;
>     public var category:ASCategory;
>
> }
>
> Notice that in ASProduct I'm expecting an ASCategory object, not the
> category id. If this isn't possible, what will actually happen? Do I
> receive the category id? Has anybody worked before with django and
> AMF? I'll appreciate any info here!

PyAMF handles ForeignKey relationships the way as Django
conceptualises them - objects attached to other objects.

You will need to use select_related to make Django pull the relations
in the same query.

It should 'just work' and if not, its a bug.

- Nick

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