Re: Returning JSON object

2015-07-06 Thread ADEWALE ADISA
Thanks a lot, the link solve my issue and add to my knowledge
On Jul 6, 2015 10:29 AM, "Cal Leeming"  wrote:

> Also, you need to try and use Google more to answer your own questions :)
>
> I googled for "django your object is not serializable" and that page I
> linked was the first result.
>
> Cal
>
> On Mon, Jul 6, 2015 at 10:28 AM, Cal Leeming  wrote:
> > You need this;
> > https://docs.djangoproject.com/en/1.8/topics/serialization/
> >
> > Cal
> >
> > On Mon, Jul 6, 2015 at 10:25 AM, ADEWALE ADISA 
> wrote:
> >> Hi guys,
> >> I have a model called Page:
> >>
> >> class Page(models.Model):
> >> category = models.ForeignKey(Category)
> >> title = models.CharField(max_length=128)
> >> url = models.URLField()
> >> views = models.IntegerField(default=0)
> >>
> >> I want to return all the Page record in my database at once to ajax
> request.
> >> This record is up to 1000 rows. In my view, I try to convert this to
> Json:
> >> page = Page.objects.all()
> >> data=json.dumps(page)
> >> But I got error: your object is not serializable
> >>
> >> So pls, my question is how can I return multiple records of database
> rows to
> >> ajax request at once so that at JavaScript side, I should be able to
> access
> >> each field of my record. ?
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Django users" group.
> >> To unsubscribe from this group and stop receiving emails from it, send
> an
> >> email to django-users+unsubscr...@googlegroups.com.
> >> To post to this group, send email to django-users@googlegroups.com.
> >> Visit this group at http://groups.google.com/group/django-users.
> >> To view this discussion on the web visit
> >>
> https://groups.google.com/d/msgid/django-users/CAMGzuy8WLxD1MJ2ERWBn4Uc4anX0US_X%2BzHveXMqb2g2Dy3fmw%40mail.gmail.com
> .
> >> For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHKQagGWJKEd8PiGjiNjyLHgQFaNTbh-mVCEUx8L6y%3D3G%2BpdSg%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMGzuy_9Fu7DGErNyastinxXpeAL2iCLc8Rx%2BDmwq8ij5nxmog%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Returning JSON object

2015-07-06 Thread ADEWALE ADISA
Thanks for urgent feedback, I will check the link out now.
On Jul 6, 2015 10:28 AM, "Cal Leeming"  wrote:

> You need this;
> https://docs.djangoproject.com/en/1.8/topics/serialization/
>
> Cal
>
> On Mon, Jul 6, 2015 at 10:25 AM, ADEWALE ADISA 
> wrote:
> > Hi guys,
> > I have a model called Page:
> >
> > class Page(models.Model):
> > category = models.ForeignKey(Category)
> > title = models.CharField(max_length=128)
> > url = models.URLField()
> > views = models.IntegerField(default=0)
> >
> > I want to return all the Page record in my database at once to ajax
> request.
> > This record is up to 1000 rows. In my view, I try to convert this to
> Json:
> > page = Page.objects.all()
> > data=json.dumps(page)
> > But I got error: your object is not serializable
> >
> > So pls, my question is how can I return multiple records of database
> rows to
> > ajax request at once so that at JavaScript side, I should be able to
> access
> > each field of my record. ?
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Django users" group.
> > To unsubscribe from this group and stop receiving emails from it, send an
> > email to django-users+unsubscr...@googlegroups.com.
> > To post to this group, send email to django-users@googlegroups.com.
> > Visit this group at http://groups.google.com/group/django-users.
> > To view this discussion on the web visit
> >
> https://groups.google.com/d/msgid/django-users/CAMGzuy8WLxD1MJ2ERWBn4Uc4anX0US_X%2BzHveXMqb2g2Dy3fmw%40mail.gmail.com
> .
> > For more options, visit https://groups.google.com/d/optout.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAHKQagHx8WpH8hZ7ONDk29FdNvpXZRBeBFKt-CGnBJEoNVHYbg%40mail.gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMGzuy8-x-Pk5bObvicMwpECiYO79r-5b%2B0JG%2B9Vu37PRk0eHw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Returning JSON object

2015-07-06 Thread Cal Leeming
Also, you need to try and use Google more to answer your own questions :)

I googled for "django your object is not serializable" and that page I
linked was the first result.

Cal

On Mon, Jul 6, 2015 at 10:28 AM, Cal Leeming  wrote:
> You need this;
> https://docs.djangoproject.com/en/1.8/topics/serialization/
>
> Cal
>
> On Mon, Jul 6, 2015 at 10:25 AM, ADEWALE ADISA  wrote:
>> Hi guys,
>> I have a model called Page:
>>
>> class Page(models.Model):
>> category = models.ForeignKey(Category)
>> title = models.CharField(max_length=128)
>> url = models.URLField()
>> views = models.IntegerField(default=0)
>>
>> I want to return all the Page record in my database at once to ajax request.
>> This record is up to 1000 rows. In my view, I try to convert this to Json:
>> page = Page.objects.all()
>> data=json.dumps(page)
>> But I got error: your object is not serializable
>>
>> So pls, my question is how can I return multiple records of database rows to
>> ajax request at once so that at JavaScript side, I should be able to access
>> each field of my record. ?
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Django users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an
>> email to django-users+unsubscr...@googlegroups.com.
>> To post to this group, send email to django-users@googlegroups.com.
>> Visit this group at http://groups.google.com/group/django-users.
>> To view this discussion on the web visit
>> https://groups.google.com/d/msgid/django-users/CAMGzuy8WLxD1MJ2ERWBn4Uc4anX0US_X%2BzHveXMqb2g2Dy3fmw%40mail.gmail.com.
>> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHKQagGWJKEd8PiGjiNjyLHgQFaNTbh-mVCEUx8L6y%3D3G%2BpdSg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Returning JSON object

2015-07-06 Thread Cal Leeming
You need this;
https://docs.djangoproject.com/en/1.8/topics/serialization/

Cal

On Mon, Jul 6, 2015 at 10:25 AM, ADEWALE ADISA  wrote:
> Hi guys,
> I have a model called Page:
>
> class Page(models.Model):
> category = models.ForeignKey(Category)
> title = models.CharField(max_length=128)
> url = models.URLField()
> views = models.IntegerField(default=0)
>
> I want to return all the Page record in my database at once to ajax request.
> This record is up to 1000 rows. In my view, I try to convert this to Json:
> page = Page.objects.all()
> data=json.dumps(page)
> But I got error: your object is not serializable
>
> So pls, my question is how can I return multiple records of database rows to
> ajax request at once so that at JavaScript side, I should be able to access
> each field of my record. ?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Django users" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to django-users+unsubscr...@googlegroups.com.
> To post to this group, send email to django-users@googlegroups.com.
> Visit this group at http://groups.google.com/group/django-users.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/django-users/CAMGzuy8WLxD1MJ2ERWBn4Uc4anX0US_X%2BzHveXMqb2g2Dy3fmw%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAHKQagHx8WpH8hZ7ONDk29FdNvpXZRBeBFKt-CGnBJEoNVHYbg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Returning JSON object

2015-07-06 Thread ADEWALE ADISA
Hi guys,
I have a model called Page:

class Page(models.Model):
category = models.ForeignKey(Category)
title = models.CharField(max_length=128)
url = models.URLField()
views = models.IntegerField(default=0)

I want to return all the Page record in my database at once to ajax
request. This record is up to 1000 rows. In my view, I try to convert this
to Json:
page = Page.objects.all()
data=json.dumps(page)
But I got error: your object is not serializable

So pls, my question is how can I return multiple records of database rows
to ajax request at once so that at JavaScript side, I should be able to
access each field of my record. ?

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-users/CAMGzuy8WLxD1MJ2ERWBn4Uc4anX0US_X%2BzHveXMqb2g2Dy3fmw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.