Ok...context helps! :)
Try reading this...
http://docs.djangoproject.com/en/dev/topics/serialization/#deserialization-of-natural-keys
I think that'll help get you where you need to go.
n
On Mon, Sep 13, 2010 at 2:19 PM, ashy wrote:
> Hi Nick,
>
> I am trying to serialize the object and send i
Hi Nick,
I am trying to serialize the object and send it to the calling ajax
request
users = Userdata.objects.all()
HttpResponse(serializers.serialize('json', users),
mimetype='application/json')
in the javascript code, I do not get the user object to call
u.username.
I guess it wont work that
Ashy,
The question what do you want to do with the data is important. When you do
Userdata.objects.all() you will get back all the data from both tables. How
you access it is different.
u = Userdata.objects.all()[0]
u.user.name is going to return the name from the User model.
u being the UserDa
Yes, I know that.
What is the object oriented way of getting the data from both the
tables based on the foreign key?
thanks for any 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-us...@googlegr
On Sep 13, 12:26 pm, ashy wrote:
> Ok,
>
> but I want to retrieve rows from both the tables based on the foreign
> key.
> User.objects.all()
> or
> Userdata.objects.all()
> will give me data from either table. How can retrieve data from both
> the tables using the foreign key?
>
> thanks
> ashy
Ok,
but I want to retrieve rows from both the tables based on the foreign
key.
User.objects.all()
or
Userdata.objects.all()
will give me data from either table. How can retrieve data from both
the tables using the foreign key?
thanks
ashy
--
You received this message because you are subscrib
On Sep 13, 12:18 pm, ashy wrote:
> Hi All,
>
> I have the following model class
>
> from django.db import models
> from django.contrib.auth.models import User
>
> # Create your models here.
> class Userdata(models.Model):
> user = models.ForeignKey(User)
> location = models.CharField(max_lengt
Hi All,
I have the following model class
from django.db import models
from django.contrib.auth.models import User
# Create your models here.
class Userdata(models.Model):
user = models.ForeignKey(User)
location = models.CharField(max_length=200)
I want to join them on user foreign key. How
8 matches
Mail list logo