Hi,
I have 1:n Relation, model A which hase foreign key ("type") to B. I'm
passing foreign key to a view via post using the ModelChoiceField.
Problem is its converted into string, so when I try to create in a
view a 'A' record
like
# data = POST dictionary
A(
address = data[ 'address' ], # okay becouse
address = charfield
gateuser = data[ 'gateuser' ], # still okay
type = ...........
And now I have type error - type should be a B-type not string.
I can try smth like this: type B.objects.get(pk=int(data['type']) -
but is it a simplier and cleaner way to convert data passed via POST
from string to objects.
Thank You
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---