Django Serialization: ManyToMany Field doesn't input into database

2022-04-12 Thread Jeffrey Ma
The code runs and all fields except the manytomany field is written into the mysql database. I am posting json to the django backend which will be written into the database. For more information: https://stackoverflow.com/questions/71849923/django-serializer-inserting-nothing-into-database-no-er

Re: Overriding Prefetched objects in Serialization

2019-12-27 Thread Integr@te System
models.CharField(max_length=30) > in_stock = models.BooleanField() > > > With this Topping model, I can use the Prefetch object: > > pizzas = Pizza.objects.all().prefetch_related( > Prefetch('toppings', queryset=Topping.objects. > filter(in_stock

Overriding Prefetched objects in Serialization

2019-12-26 Thread Cesar Bueno
w everything works as expected (even the serialization). But my problem begins when I try to do the same stock control with the Pizza object. Just like I did with Topping, I will also add the in_stock field to the Pizza Model. The new Pizza Model then is: class Pizza(models.Model): name = mode

Re: Django + Django REST Framework SQL query response handling and serialization is very, very slow - yet not a “N+1” problem

2017-06-14 Thread Miika Huusko
hing else would have worked I could have paginated or something similar, but the second is more difficult. The main problem here is the JOIN after `prefetch_related` queries. As the profiling shows something strange happens before serialization and Django is using ridiculous amount of time fo

Re: Django + Django REST Framework SQL query response handling and serialization is very, very slow - yet not a “N+1” problem

2017-06-11 Thread Melvyn Sopacua
ake the JOIN. But it makes a lot more sense now with the mobile and offline requirements, why you have setup the API the way you did. Two more thourghts for you: - Use a cacheable dataset and incremental updates to be done "when wifi or better is available". Complex, but worth

Re: Django + Django REST Framework SQL query response handling and serialization is very, very slow - yet not a “N+1” problem

2017-06-11 Thread Alceu Rodrigues de Freitas Junior
I'm guessing here that REST would not be the appropriate to handle "large" amounts of data, and probably that's why Melevyn suggested to use pagination. If your customer needs such data to be used off-line, I bet that would be better to generate a file in the appropriate format, compact it and

Re: Django + Django REST Framework SQL query response handling and serialization is very, very slow - yet not a “N+1” problem

2017-06-11 Thread Miika Huusko
ne 11, 2017 at 4:57:22 PM UTC+2, Miika Huusko wrote: > > I have a performance problem with Django + Django REST Framework. The > problem is that it takes Django very, very long time to handle SQL query > response + DRF serialization take quite some time also. It happens when > there

Re: Django + Django REST Framework SQL query response handling and serialization is very, very slow - yet not a “N+1” problem

2017-06-11 Thread Melvyn Sopacua
On Sunday 11 June 2017 13:41:55 Miika Huusko wrote: > @Melvyn Sopacue, I opt to use prefetch_related because I'm fetching > "Items" that are used as ForeignKey for "Photos" and "Events". > Select_related is meant for cases where you have OneToOne of > ForeignKey relation (single item) that you nee

Re: Django + Django REST Framework SQL query response handling and serialization is very, very slow - yet not a “N+1” problem

2017-06-11 Thread Miika Huusko
There must be some kind of extra looping or cloning going on when performing Python level JOIN for prefetched Photos or other related sets. On Sunday, June 11, 2017 at 4:57:22 PM UTC+2, Miika Huusko wrote: > > I have a performance problem with Django + Django REST Framework. The > probl

Re: Django + Django REST Framework SQL query response handling and serialization is very, very slow - yet not a “N+1” problem

2017-06-11 Thread Melvyn Sopacua
On Sunday 11 June 2017 09:15:09 Miika Huusko wrote: > Thanks for response! > > Yep, timing with "time" is not the best way to go to compare SQL query > times. The reason I added that "time" test is that in Stack Overflow > I was asked to confirm that data transfer is not factor here. I timed > SQL

Re: Django + Django REST Framework SQL query response handling and serialization is very, very slow - yet not a “N+1” problem

2017-06-11 Thread Alceu Rodrigues de Freitas Junior
uot;photos_photo"."note_id" IN (349527, 349528, 349529, *... and rest of the 40k IDs ...* ); Quite simple quries. Timing shown in django.db.backends logs is what those queries take when executed manually with psql (1252 ms + 883 ms). That results simple profiling info: Datab

Re: Django + Django REST Framework SQL query response handling and serialization is very, very slow - yet not a “N+1” problem

2017-06-11 Thread Miika Huusko
le quries. Timing shown in django.db.backends logs is what those queries take when executed manually with psql (1252 ms + 883 ms). That results simple profiling info: Database lookup | 20.4447s Serialization | 3.3821s Django request/response | 0.3419s API view

Re: Django + Django REST Framework SQL query response handling and serialization is very, very slow - yet not a “N+1” problem

2017-06-11 Thread Alceu Rodrigues de Freitas Junior
being on a Perl related blog, the concepts on the post are applicable everywhere. Em 11/06/2017 07:06, Miika Huusko escreveu: I have a performance problem with Django + Django REST Framework. The problem is that it takes Django very, very long time to handle SQL query response + DRF serialization

Re: Django + Django REST Framework SQL query response handling and serialization is very, very slow - yet not a “N+1” problem

2017-06-11 Thread Alceu Rodrigues de Freitas Junior
. you see, you want to get 10k to 50k items... that's a lot (to serialize too). Em 11/06/2017 07:06, Miika Huusko escreveu: I have a performance problem with Django + Django REST Framework. The problem is that it takes Django very, very long time to handle SQL query response + DRF serializ

Django + Django REST Framework SQL query response handling and serialization is very, very slow - yet not a “N+1” problem

2017-06-11 Thread Miika Huusko
I have a performance problem with Django + Django REST Framework. The problem is that it takes Django very, very long time to handle SQL query response + DRF serialization take quite some time also. It happens when there are ManyToMany or OneToMany relations and nested objects. Sounds like &q

Re: Authentication backend - serialization

2017-06-08 Thread Alison P
Hi! Ludovic, Melvyn, thank you for your responses. I could not make Melvyn's example work for me, but it put me on the right track. Solution: right under the "reset the one time password" comment, add the line "user.backend = 'path.to.OneTimePasswordBackend' ", and everything works as it shoul

Re: Authentication backend - serialization

2017-06-05 Thread Melvyn Sopacua
On Monday 05 June 2017 04:14:01 Alison P wrote: > If I use the default session serializer, I get the following error: > TypeError at /login/ > > is not JSON serializable I'm using this is a general solution. Feel free to strike what you don't need. The basics is that a JSONEncoder knows primiti

Re: Authentication backend - serialization

2017-06-05 Thread ludovic coues
I don't see where in your code the error happen. With standard python, you can't add a method on your class to make is JSON serializable. At least to my knowledge. You have to write your own serializer and instruct the code turning your object into JSON to use it. But there are a few easier alter

Authentication backend - serialization

2017-06-05 Thread Alison P
Hi everyone, I have written a custom authentication backend, the code is below. It allows a user to click "email me a one-time password" on the home page, which is saved on the "Person" model (which extends User through a foreign key) and then log in with that password. This backend verifies th

Custom Field Default Value Serialization

2017-03-02 Thread qilin qi
Hi All, Apologize if this question has been asked before. This is my first question into this mailing list. I am creating a custom field(MyCustomField) with a custom value class(MyValue). I do have a deconstruct() method for my *field* class. And I would like to have a default value of this fiel

Re: JSON serialization

2014-01-18 Thread Babatunde Akinyanmi
like Mario suggested. > > >> You can read the documentation on how to escape or unescape stuff in your > > >> template. > > > > > > Thank you, guys. It works. > > > Now I need to figure out why I still don't see my data in the jQWidget > > > con

Re: JSON serialization

2014-01-18 Thread François Schiettecatte
ed. > >> You can read the documentation on how to escape or unescape stuff in your > >> template. > > > > Thank you, guys. It works. > > Now I need to figure out why I still don't see my data in the jQWidget > > control (jqxGrid)... > > > &g

Re: JSON serialization

2014-01-18 Thread Babatunde Akinyanmi
;t see my data in the jQWidget > > control (jqxGrid)... > > > > Anybody familiar with this library? > > > > Thank you. > >> > >>> > >>> On 18/01/2014 4:53 pm, "Igor Korot" wrote: > >>>> > >>>> Hi, ALL

Re: JSON serialization

2014-01-18 Thread Igor Korot
Grid)... > > Anybody familiar with this library? > > Thank you. >> >>> >>> On 18/01/2014 4:53 pm, "Igor Korot" wrote: >>>> >>>> Hi, ALL, >>>> I'd like someone to help me understand this situation. >>

Re: JSON serialization

2014-01-18 Thread Babatunde Akinyanmi
Grid)... Anybody familiar with this library? Thank you. > >> >> On 18/01/2014 4:53 pm, "Igor Korot" wrote: >>> >>> Hi, ALL, >>> I'd like someone to help me understand this situation. >>> Looking at the page: >>> https:

Re: JSON serialization

2014-01-18 Thread Igor Korot
ol (jqxGrid)... Anybody familiar with this library? Thank you. > >> >> On 18/01/2014 4:53 pm, "Igor Korot" wrote: >>> >>> Hi, ALL, >>> I'd like someone to help me understand this situation. >>> Looking at the page: >>> https:/

Re: JSON serialization

2014-01-18 Thread Babatunde Akinyanmi
documentation on how to escape or unescape stuff in your template. > > On 18/01/2014 4:53 pm, "Igor Korot" wrote: >> >> Hi, ALL, >> I'd like someone to help me understand this situation. >> Looking at the page: https://docs.djangoproject.com/en/dev/top

Re: JSON serialization

2014-01-17 Thread Mario Gudelj
In your template try {{usb_data|safe}} On 18/01/2014 4:53 pm, "Igor Korot" wrote: > Hi, ALL, > I'd like someone to help me understand this situation. > Looking at the page: > https://docs.djangoproject.com/en/dev/topics/serialization/ the part > which says "Se

JSON serialization

2014-01-17 Thread Igor Korot
Hi, ALL, I'd like someone to help me understand this situation. Looking at the page: https://docs.djangoproject.com/en/dev/topics/serialization/ the part which says "Serialization formats->JSON" there is an example of how the data would be serialized. The sample uses

Re: Dumpdata and serialization issues

2012-07-04 Thread Melvyn Sopacua
On 4-7-2012 1:13, natasha.ba...@utoronto.ca wrote: > On Tuesday, July 3, 2012 5:55:32 PM UTC-4, ke1g wrote: >> >> In fact, I think dumpdata takes an app name, not a table or model name. No it doesn't. It can take a app.model name as well and is more commonly used, since the primary use case for du

Re: Dumpdata and serialization issues

2012-07-03 Thread natasha.ba...@utoronto.ca
Hm, I think the functionality to do this -- at least if I understand correctly what I read here: http://stackoverflow.com/questions/1113096/django-dump-data-for-a-single-model I'd be fine dumping the data for the entire app -- but the reason I did it this way is because when I do this, the cat

Re: Dumpdata and serialization issues

2012-07-03 Thread Bill Freeman
In fact, I think dumpdata takes an app name, not a table or model name. On Tue, Jul 3, 2012 at 5:54 PM, Bill Freeman wrote: > I think that you have to dumdata one or both of the models at the ends > of the many to many, > and the join table will come along for free. > > On Tue, Jul 3, 2012 at 3:2

Re: Dumpdata and serialization issues

2012-07-03 Thread Bill Freeman
I think that you have to dumdata one or both of the models at the ends of the many to many, and the join table will come along for free. On Tue, Jul 3, 2012 at 3:21 PM, natasha.ba...@utoronto.ca wrote: > Hi All, > > I'm trying to dump the contents of a table which is the mapping for a > many-to-m

Dumpdata and serialization issues

2012-07-03 Thread natasha.ba...@utoronto.ca
Hi All, I'm trying to dump the contents of a table which is the mapping for a many-to-many field. The table is called Part and it has a ManytoManyField called category_id. When I run python manage.py dumpdata store.part_category_id > file.json I get the error Error: Unable to serialize database

Re: De-serialization of ManyToManyField

2012-03-28 Thread sk
ML format > > then I get the following (for the two tables in question): > > > --- > > - fields: {date: 2012-03-26, name: test 1} > >   model: TempDB.test > >   pk: 1 > > - fields: {date: 2012-03-26, name: test

Re: De-serialization of ManyToManyField

2012-03-27 Thread sk
test 2] >   model: TempDB.instance >   pk: 1 > --- > > This is roughly what I would expect to see, although the documentation > does not explicitly state that a manytomany serialization will be a > multi-element list,

De-serialization of ManyToManyField

2012-03-26 Thread sk
ect to see, although the documentation does not explicitly state that a manytomany serialization will be a multi-element list, it seems to be a reasonable assumption. When I try to perform a loaddata with this output (and after manually deleting the tables from the admin interface, to be sure).

Re: serialization in Django

2012-03-07 Thread Rafael Durán Castañeda
On 03/06/2012 09:52 PM, shiji bijo wrote: ok I have removed the json.dumps() now the view is def do_GET(self, offset): data=get_object_or_404(NewAuction,pk=offset) context=serializers.serialize("json",[data]) return render_to_response("index.html",{"context":context}) an

Re: serialization in Django

2012-03-06 Thread shiji bijo
ok I have removed the json.dumps() now the view is def do_GET(self, offset): data=get_object_or_404(NewAuction,pk=offset) context=serializers.serialize("json",[data]) return render_to_response("index.html",{"context":context}) and my index.html is {% extends 'base.html' %

Re: serialization in Django

2012-03-06 Thread Daniel Roseman
On Tuesday, 6 March 2012 19:14:55 UTC, angel wrote: > > I am new to django and doing my course project. I am searching for a > solution for iterating JSON dictionary in html page. My django view > is the following: > > def do_GET(self, offset): > data=get_object_or_404(NewAuction,pk=o

Re: serialization in Django

2012-03-06 Thread shiji bijo
thanks for the reply. In our course project it is a requirement to use serialised data for CRUD and display it on the html page.But we are not allowed to use the REST frameworks.I tried using return Httpresponse(serialiseddata). But i dont know where to write the javascript code On Tue, Mar 6, 201

Re: serialization in Django

2012-03-06 Thread Ilian Iliev
If you are returning json it seems more proper to me to parse it using JavaScript. Why exactly do you return json but not a normal dict/object? -- eng. Ilian Iliev Web Software Developer Mobile: +359 88 66 08 400 Website: http://ilian.i-n-i.org On Tue, Mar 6, 2012 at 9:14 PM, angel wrote: >

serialization in Django

2012-03-06 Thread angel
I am new to django and doing my course project. I am searching for a solution for iterating JSON dictionary in html page. My django view is the following: def do_GET(self, offset): data=get_object_or_404(NewAuction,pk=offset) context=serializers.serialize("json",[data]) d

Re: Json serialization help

2011-08-16 Thread Andre Terra
Thank you a lot for this snippet! I've wondered about how to export objects to excel in a "more natural way" and this seems to be a great approach, considering all the different gotchas. Thank you for taking the time to write this.. I've been postponing this little bit of research for the longest

Re: Json serialization help

2011-08-16 Thread Nate
Thank you for the suggestion. I actually ended up extending Django's json serializer. Here is the code in case you or someone else needs to do something like this. from django.core.serializers.json import Serializer as JsonSerializer from django.utils.encoding import is_protected_type class Displ

Re: Nested serialization of model instances

2011-08-15 Thread Russell Keith-Magee
On Mon, Aug 15, 2011 at 5:58 PM, Christo Buschek wrote: > Hi list, > > I'm busy writing a custom json serializer for django. It works very > good, only now I want to serialize ForeignKey and M2M relations inside > the same serialization call and build nested json ob

Nested serialization of model instances

2011-08-15 Thread Christo Buschek
Hi list, I'm busy writing a custom json serializer for django. It works very good, only now I want to serialize ForeignKey and M2M relations inside the same serialization call and build nested json objects with all model instances that the current model instance relates to. {'field_

Re: Json serialization help

2011-08-14 Thread Landy Chapman
> The response is something like: > 'Content-Type: text/html; charset=utf-8\n\n[{"pk": 1, "model": > "MyApp.foo", "fields": {"choice_field": "db_name1"}}]' This is interesting.. But I think the serializer is working properly. the first element in the tuple is the value stored in the database, and

Json serialization help

2011-08-14 Thread Nate
Hello, I'm new to Django and having a problem with serialization. I am trying to serialize a model that has a CharField with choices, and the json serializer returns json with the choices' database values instead of display values. Is there a way to get the json serializer to use the

multi-page, non-sequential, dynamic forms with serialization/deserialization

2011-06-14 Thread Michael Wayne Goodman
difficult to maintain. We need the following features: * large, multi-page form (too many fields to fit on one page) * dynamic forms (ability to add more fields on demand) * non-sequential entry (users can jump back and forth filling it in) * serialization (the serialized output is sent to

Re: json serialization question

2011-05-27 Thread Ian Clelland
say into session data, or into database fixtures, and they are really designed to be read by the deserializers when the object needs to be reconstructed. If you are passing data from Django to a browser's JavaScript thread using JSON, then you probably want to either 1. Use an API framewo

json serialization question

2011-05-24 Thread Sells, Fred
I'm using AJAX, jquery and JSON for the first time, having used templates to render XML for Flex/Flash in all my previous Django work. My code looks like this records = models.Residents.objects.extra( where=[], params=[...]) data = serializers.serialize('json', records, ensure_ascii=False, fie

Re: Json serialization for use in JS

2011-05-20 Thread Jonas Geiregat
> > class Serializer(PythonSerializer): > def end_object(self, obj): > self.objects.append({ > "fields" : self._current > }) > self._current = None > > I've made a small mistake I was importing PythonSerializer while It should've been JsonSerializer C

Re: Json serialization for use in JS

2011-05-20 Thread Jonas Geiregat
> > Your idea of overriding the Serializer class sounds like a better idea to me. > It should be possible (and will be interesting) ,I'll think I'll look into > that tonight. Overwriting django's default serializers is possible. This is how I've done it: In the root of my django project: mkd

Re: Json serialization for use in JS

2011-05-20 Thread sebastien piquemal
age : http://pypi.python.org/pypi/any2any/0.1 You can achieve very easily the format you need. Please ask if you need help ! Cheers, Sébastien On May 19, 5:05 pm, Tom Evans wrote: > On Thu, May 19, 2011 at 1:23 PM, Jonas Geiregat wrote: > > Hello, > > I'm also finding the built i

Re: Json serialization for use in JS

2011-05-19 Thread Tom Evans
On Thu, May 19, 2011 at 1:23 PM, Jonas Geiregat wrote: > Hello, > I'm also finding the built in serialization a bit overhead. Me too! I use a simple HttpResponse subclass for generating JSON though: from django.http import HttpResponse from django.utils import simplejson class J

Re: Json serialization for use in JS

2011-05-19 Thread Jonas Geiregat
Hello, I'm also finding the built in serialization a bit overhead. It puts to much information in your JSON string that can be modified such as the PK field. I often import json ( http://docs.python.org/library/json.html ) and serialize the data myself before passing it to the render m

Json serialization for use in JS

2011-05-19 Thread redfive
I'm trying to return some JSON from one of my views. My objects are simple and I can get the built-in json serializer working, but wanted a cleaner object when I deserialize in my webpage, i.e. I don't want the pk or model entries. What is the best way to go about that? I played around a little wit

Re: How can I control JSON serialization?

2011-02-28 Thread Derek
> > sorry for the confusion. > > Sasha Bolotnovwww.gorizont-zavalen.ru > > On Sun, Feb 27, 2011 at 2:38 AM, Russell Keith-Magee < > > > > > > > > russ...@keith-magee.com> wrote: > > On Sun, Feb 27, 2011 at 5:30 AM, Alexander Bolotnov > > wro

Re: How can I control JSON serialization?

2011-02-26 Thread Alexander Bolotnov
On Sun, Feb 27, 2011 at 2:38 AM, Russell Keith-Magee < russ...@keith-magee.com> wrote: > On Sun, Feb 27, 2011 at 5:30 AM, Alexander Bolotnov > wrote: > > Is there a way to control json serialization in django? Simple code below > > will return serialized object in json: &

Re: How can I control JSON serialization?

2011-02-26 Thread Russell Keith-Magee
On Sun, Feb 27, 2011 at 5:30 AM, Alexander Bolotnov wrote: > Is there a way to control json serialization in django? Simple code below > will return serialized object in json: I've just answered this on django-developers. For the record, cross-posting topics like this isn't en

Few words about serialization roboustness and django app served via fcgi and nginx connected over unix or tcp socket

2011-02-16 Thread gro...@sq9mev.info
Hi there ;). Yesterday i noticed some strange behaviour of one of my sites - view [1] serving json serialized data (one model, no references, 130 objects) was executed about 20 secs[3] in production environment [2], and less than 1s via development server. Strange thing. What I've found - the view

Re: Complex serialization from models

2010-12-21 Thread Dan Fairs
On 21 Dec 2010, at 12:19, gregory semah wrote: > Nobody has a quick answer ? > Take a look at Django's natural key support - it allows you to control what's serialized for fk references. Cheers, Dan > On Dec 20, 4:11 pm, gregory semah wrote: >> Hi all, >> >> I'm searching a simple way to g

Re: Complex serialization from models

2010-12-21 Thread Konrad Delong
On 21 December 2010 13:19, gregory semah wrote: > Nobody has a quick answer ? > It looks like xml serialisation wasn't designed to be customisable in the way you need. If I were you, I'd look around the code and see what I could reuse from there. Konrad > On Dec 20, 4:11 pm, gregory semah wrot

Re: Complex serialization from models

2010-12-21 Thread gregory semah
Nobody has a quick answer ? On Dec 20, 4:11 pm, gregory semah wrote: > Hi all, > > I'm searching a simple way to generate xml from my models, and a > simple use of serializers can do this for me. > But my models are defined with ForeignKey and ManyToManyField... > The xml generated shows me only

Complex serialization from models

2010-12-20 Thread gregory semah
Hi all, I'm searching a simple way to generate xml from my models, and a simple use of serializers can do this for me. But my models are defined with ForeignKey and ManyToManyField... The xml generated shows me only key values of these field. Is there a simple way to catch any other field value t

for httplib2, serialization or singleton?

2010-07-29 Thread yifan
I got a django web app where there is a httplib2 object used to do HTTPS with client authentication connections to a apache server. The problem is that for every request, my httplib2 object has to do a SSL hand-shaking to apache, which is extremely slow. I tried to save the httplib2 to the django

Re: An idea for a serialization framework

2010-06-23 Thread Andy Kelley
ranslates into > "don'" > > Anyways, I think this idea has merit - even alongside a role-based > security system. > > Feedback? > > On Jun 23, 3:29 am, Andy Kelley wrote: > > > I am coming up with a framework that helps serialization of models. My > > ide

Re: An idea for a serialization framework

2010-06-23 Thread Andy Kelley
wrote: > I am coming up with a framework that helps serialization of models. My > idea is for each field to have a view permissions level: PUBLIC, > OWNER, or ADMIN. I want to have a model to dict function that takes 2 > arguments, permission_level and serialize_chain. Firstly, let

An idea for a serialization framework

2010-06-23 Thread Andy Kelley
I am coming up with a framework that helps serialization of models. My idea is for each field to have a view permissions level: PUBLIC, OWNER, or ADMIN. I want to have a model to dict function that takes 2 arguments, permission_level and serialize_chain. Firstly, let me explain how it would change

Re: Strange natural keys serialization XML format (Django SVN-12978)

2010-04-25 Thread h-k-ii
needs to be improved (which is the list you've just given). > > Addressing your list specifically: > > > 1. mention requirement to use tuple also in serialization section > > (currently this is only mentioned in deserialization) > > This is certainly worth d

Re: Strange natural keys serialization XML format (Django SVN-12978)

2010-04-16 Thread Russell Keith-Magee
e documentation. The best way to do this is to open a ticket describing the aspect that you think needs to be improved (which is the list you've just given). Addressing your list specifically: > 1. mention requirement to use tuple also in serialization section > (currently this is on

Re: Strange natural keys serialization XML format (Django SVN-12978)

2010-04-16 Thread h-k-ii
You are correct. Based on my experience with natural keys, I would propose improvements for the documentation [1] - but perhaps these are matters of personal opinion: 1. mention requirement to use tuple also in serialization section (currently this is only mentioned in deserialization) 2. rename

Re: Strange natural keys serialization XML format (Django SVN-12978)

2010-04-16 Thread Russell Keith-Magee
On Fri, Apr 16, 2010 at 5:26 PM, h-k-ii wrote: > I find dumpdata output in XML format quite strange for natural keys. > Each character in a key reference is wrapped in a . > > Is this a bug to be reported or a feature? It certainly doesn't look right; so there is a bug somewhere. However, it mig

Strange natural keys serialization XML format (Django SVN-12978)

2010-04-16 Thread h-k-ii
I find dumpdata output in XML format quite strange for natural keys. Each character in a key reference is wrapped in a . Is this a bug to be reported or a feature? * >python manage.py dumpdata --format xml --natural appname ... Doctype1 ... D o c t y

Re: Need help in serialization of objects.

2010-02-24 Thread chiranjeevi muttoju
en declare it in the SERIALIZATION_MODULES setting. > > On Feb 24, 7:00 am, chiranjeevi muttoju > wrote: > > Hi all, > > I want to convert the model object to xml data. i used the django > > serialization for that. then i'm getting the xml data as shown in bellow. >

Re: Need help in serialization of objects.

2010-02-23 Thread Oliver Beattie
nd end_serialization methods: http://code.djangoproject.com/browser/django/trunk/django/core/serializers/xml_serializer.py …and then declare it in the SERIALIZATION_MODULES setting. On Feb 24, 7:00 am, chiranjeevi muttoju wrote: > Hi all, >  I want to convert the model object to xml data. i used

Need help in serialization of objects.

2010-02-23 Thread chiranjeevi muttoju
Hi all, I want to convert the model object to xml data. i used the django serialization for that. then i'm getting the xml data as shown in bellow. But my aim to remove the "" tag or replacing that tag by other name. is there is any way to achieve that one. If anybody know

Re: serialization formats?

2009-09-23 Thread Russell Keith-Magee
On Wed, Sep 23, 2009 at 10:38 PM, Chris Withers wrote: > > Hi All, > > Where can I find docs on the actual serialisation formats used by > Django's serialisation support? > > http://docs.djangoproject.com/en/dev/topics/serialization/#id1 > > ...lists them, but do

serialization formats?

2009-09-23 Thread Chris Withers
Hi All, Where can I find docs on the actual serialisation formats used by Django's serialisation support? http://docs.djangoproject.com/en/dev/topics/serialization/#id1 ...lists them, but doesn't actually describe them :-S cheers, Chris -- Simplistix - Content Management, Batch

Re: JSON serialization of related records.

2009-09-03 Thread Amir Habibi
Thanks Mike. The issue is the inflexible handling of fk entries of a model by the django serializer or more accurately PythonSerializer. The behavior is inherited by json and xml serializers the same. I've eventually resorted to rewriting the whole serialization to make it a better fit f

Re: JSON serialization of related records.

2009-09-01 Thread Mike Ramirez
On Tuesday 01 September 2009 12:29:56 pm Amir Habibi wrote: > How can I serialize a Queryset along with the related records. For > example, in Poll and Choice case, I need each poll to have the choices > encoded in json format. > > Thanks > you'll want to look at the docs o

JSON serialization of related records.

2009-09-01 Thread Amir Habibi
How can I serialize a Queryset along with the related records. For example, in Poll and Choice case, I need each poll to have the choices encoded in json format. Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

Re: json serialization error on arrays

2009-08-26 Thread John
When I have arrays of 100,000+ the performance of lists gets unacceptable in standard c python. That's why arrays exist in python! After doing research and testing, I have decided to rebuild the project in java with embedded jython. For some bizarre reason jython performance increases with large

Re: json serialization error on arrays

2009-08-25 Thread Peter Bengtsson
what's wrong with turning it into a list? If you gzip it it won't be that big. On Aug 25, 5:16 pm, John Baker wrote: > I need to json serialize some very large objects which include large > arrays. How can I do this in django? The arrays will be very big and > heavily processed before so need to

json serialization error on arrays

2009-08-25 Thread John Baker
I need to json serialize some very large objects which include large arrays. How can I do this in django? The arrays will be very big and heavily processed before so need to use efficient array storage. Testing with arrays I get.. TypeError at /zeros/ array([ 0., 0., 0., 0., 0., 0., 0.,

Re: JSON Serialization with ImageField

2009-08-24 Thread Lewis Taylor
The reason I'm trying it is due to a requirement, the data rather than being sent using a normal post request in a multienc form has to be sent over in a json string in the post request containing the base64 encoded image. On Mon, 2009-08-24 at 18:38 +0200, Maksymus007 wrote: > On Tue, Aug 4, 200

Re: JSON Serialization with ImageField

2009-08-24 Thread Maksymus007
On Tue, Aug 4, 2009 at 10:58 PM, scuzz wrote: > > Hi, > > I'm trying to receive a file encoded in a json string and store it in > an ImageField. I was hoping to use the standard Django deserialisation > like: > > serializers.deserialize("json", "...snip..., \"myImageField\": > \"base64encodedimage

Re: JSON Serialization with ImageField

2009-08-24 Thread Lewis Taylor
Did you find a way to do this? I'm having the same problem. Lewis On Aug 4, 9:58 pm, scuzz wrote: > Hi, > > I'm trying to receive a file encoded in a json string and store it in > an ImageField. I was hoping to use the standard Django deserialisation > like: > > serializers.deserialize("json",

Converting some objects during serialization

2009-08-05 Thread Parag Shah
ust 5, 2009 4:12' One way to do this is to accept whatever String Django generates and then parse it in Javascript to display what I want to display. Another way is to get the desired format in the serialized JSON String. Is it possible to control the serialization process to change some data as i

JSON Serialization with ImageField

2009-08-04 Thread scuzz
Hi, I'm trying to receive a file encoded in a json string and store it in an ImageField. I was hoping to use the standard Django deserialisation like: serializers.deserialize("json", "...snip..., \"myImageField\": \"base64encodedimage\", ...snip...) however it tries to store the image content s

Re: XML serialization and Unicode

2009-07-29 Thread l5x
Hello, On 29 Lip, 15:56, cootetom wrote: > To add, something just popped into my head. Have you got > DEFAULT_CHARSET = 'utf-8' in your settings.py fiile It didn't help. > On Jul 29, 2:51 pm, cootetom wrote: > > > I would imagine that the deserialize function tries to encode the > > input dow

Re: XML serialization and Unicode

2009-07-29 Thread cootetom
>     self.parser.feed(buf) > >   File "/usr/lib/python2.5/xml/sax/expatreader.py", line 207, in feed > >     self._parser.Parse(data, isFinal) > > UnicodeEncodeError: 'ascii' codec can't encode character u'\u0142' in > > position 154: ordi

Re: XML serialization and Unicode

2009-07-29 Thread cootetom
t;   File "/usr/lib/python2.5/xml/sax/expatreader.py", line 207, in feed >     self._parser.Parse(data, isFinal) > UnicodeEncodeError: 'ascii' codec can't encode character u'\u0142' in > position 154: ordinal not in range(128) > > I use latest SVN v

XML serialization and Unicode

2009-07-29 Thread l5x
rse(data, isFinal) UnicodeEncodeError: 'ascii' codec can't encode character u'\u0142' in position 154: ordinal not in range(128) I use latest SVN version (1.1) revision 11367. I have # -*- coding: utf-8 -*- line at the beginning of the file, and __unicode__ method is set

Re: Json Serialization / Form Validation error

2009-04-02 Thread Bro
But before, is it possible to serialize a form in JSON ? Thanks --~--~-~--~~~---~--~~ 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

Re: Json Serialization / Form Validation error

2009-04-02 Thread Bro
But beforce, is it possible to serialise a form in JSON ? Thanks On 11 fév, 00:50, adrian wrote: > Thank you all for posting this.  You saved me probably hours of head > scratching. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the

Re: JSON Model Serialization

2009-03-30 Thread Mateusz Wawrzyniak
On Mar 24, 11:05 am, gchuyun wrote: > i tried this, but get a error similar. > > TypeError: [{'publish_time': datetime.datetime(2009, 3, 24, 16, 16, > 18), 'is_deleted': 0, 'is_confirmed' > : 0, 'title': u'1', 'content': u'111', 'id': 1L}, {'publish_time': > datetime.datetime(2009, 3, 24, 16 > ,

Re: JSON Model Serialization

2009-03-24 Thread gchuyun
>  I'm Trying to serialize a dict which have a list of Model's instance. > > The format that i need is json. Something  like that: > > >     people = Person.objects.all() > > Why don't you use Person.objects.values()? > You will get a list of dicts so there

Re: Django Serialization of BooleanField inconsistent?

2009-03-23 Thread chefsmart
. > > > However, when I do an HTTP PUT to update an instance of a model, the > > xml response has True or False for Boolean values. > > > Though I'm using django-rest-interface, the de/serialization is > > handled by Django itself. > > > I have tried walking t

  1   2   3   >