Re: [Django] #4656: Allow In-depth serialization by specifying depth to follow relationship

2014-11-10 Thread Django
#4656: Allow In-depth serialization by specifying depth to follow relationship
--+
 Reporter:  jay.m.martin@…|Owner:  nobody
 Type:  New feature   |   Status:  closed
Component:  Core (Serialization)  |  Version:
 Severity:  Normal|   Resolution:  wontfix
 Keywords:  feature   | Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  1
Easy pickings:  0 |UI/UX:  0
--+
Changes (by tomchristie):

 * status:  new => closed
 * resolution:   => wontfix


Comment:

 Unless theres a more fundamental addressing of the serialization API,
 aimed at making it *generally* usable and extendable for Web APIs I don't
 see any value in pushing the scope of the serializers as they now stand.
 Right now the use case for them should be for fixture loading and saving
 and nothing else. There are better tools out there for generally
 extendable serialization schemes (REST framework, tastypie, etc).

 Could we address tickets like this? Sure, but not until and unless we're
 doing that in the context of a fully fledged serializer API that's
 properly suitable for meeting the use cases of both Web APIs *and* fixture
 generation.

--
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

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


Re: [Django] #4656: Allow In-depth serialization by specifying depth to follow relationship

2011-11-10 Thread Django
#4656: Allow In-depth serialization by specifying depth to follow relationship
--+
 Reporter:  jay.m.martin@…|Owner:  nobody
 Type:  New feature   |   Status:  new
Component:  Core (Serialization)  |  Version:
 Severity:  Normal|   Resolution:
 Keywords:  feature   | Triage Stage:  Accepted
Has patch:  0 |  Needs documentation:  0
  Needs tests:  0 |  Patch needs improvement:  1
Easy pickings:  0 |UI/UX:  0
--+
Changes (by anonymous):

 * needs_better_patch:  0 => 1


Comment:

 This implementation does quite a lot queries that can be easily saved!

 Why can't you just change the implementation of the serializers to follow
 the fields retrieved using the 'select_related' method?

 Then you can also follow django's already existing conventions and allow
 the 'fields' property to accept values like: "related_model__field1" like
 in the 'filter' method?

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #4656: Allow In-depth serialization by specifying depth to follow relationship

2011-06-27 Thread Django
#4656: Allow In-depth serialization by specifying depth to follow relationship
-+-
   Reporter: |  Owner:  nobody
  jay.m.martin@… | Status:  new
   Type:  New|  Component:  Core
  feature|  (Serialization)
  Milestone: |   Severity:  Normal
Version: |   Keywords:  feature
 Resolution: |  Has patch:  0
   Triage Stage:  Accepted   |Needs tests:  0
Needs documentation:  0  |  Easy pickings:  0
Patch needs improvement:  0  |
  UI/UX:  0  |
-+-

Comment (by tomchristie):

 There is some movement on this ATM.
 I sprinted on the task at !DjangoCon.eu and made some progress, which Russ
 broadly gave a thumbs up to.

 If anyone's interested in helping out and finally making some progress on
 this it'd be great if you could get in touch.
 I've emailed the dev list with a rough proposal as it stands, and there's
 an initial implementation, see here...

 https://groups.google.com/d/topic/django-developers/H2EKZBsRlFY/discussion

 There's certainly more work to do in terms of making sure the interface is
 something we'll be happy with, that ties in nicely with the exiting Forms
 API style, and with dealing with both serialization and de-serialization,
 but I think what we have now looks about right. (Positive criticisms are
 very welcomed of course.)

 Prob. best to take any further discussion to the dev list.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #4656: Allow In-depth serialization by specifying depth to follow relationship

2011-06-27 Thread Django
#4656: Allow In-depth serialization by specifying depth to follow relationship
-+-
   Reporter: |  Owner:  nobody
  jay.m.martin@… | Status:  new
   Type:  New|  Component:  Core
  feature|  (Serialization)
  Milestone: |   Severity:  Normal
Version: |   Keywords:  feature
 Resolution: |  Has patch:  0
   Triage Stage:  Accepted   |Needs tests:  0
Needs documentation:  0  |  Easy pickings:  0
Patch needs improvement:  0  |
  UI/UX:  0  |
-+-
Changes (by guettli):

 * cc: hv@… (added)
 * ui_ux:   => 0


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #4656: Allow In-depth serialization by specifying depth to follow relationship

2011-04-25 Thread Django
#4656: Allow In-depth serialization by specifying depth to follow relationship
-+-
   Reporter: |  Owner:  nobody
  jay.m.martin@… | Status:  new
   Type:  New|  Component:  Core
  feature|  (Serialization)
  Milestone: |   Severity:  Normal
Version: |   Keywords:  feature
 Resolution: |  Has patch:  0
   Triage Stage:  Accepted   |Needs tests:  0
Needs documentation:  0  |  Easy pickings:  0
Patch needs improvement:  0  |
-+-
Changes (by kmike):

 * cc: kmike84@… (added)
 * easy:   => 0


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #4656: Allow In-depth serialization by specifying depth to follow relationship

2011-03-25 Thread Django
#4656: Allow In-depth serialization by specifying depth to follow relationship
--+---
   Reporter:  jay.m.martin@…  |Owner:  nobody
 Status:  new |Milestone:
  Component:  Serialization   |  Version:
 Resolution:  | Keywords:  feature
   Triage Stage:  Accepted|Has patch:  0
Needs documentation:  0   |  Needs tests:  0
Patch needs improvement:  0   |
--+---

Comment (by TylerBrock):

 I would love for this to be in the next Django release.

 Bump!

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #4656: Allow In-depth serialization by specifying depth to follow relationship

2011-03-21 Thread Django
#4656: Allow In-depth serialization by specifying depth to follow relationship
--+---
   Reporter:  jay.m.martin@…  |Owner:  nobody
 Status:  new |Milestone:
  Component:  Serialization   |  Version:
 Resolution:  | Keywords:  feature
   Triage Stage:  Accepted|Has patch:  0
Needs documentation:  0   |  Needs tests:  0
Patch needs improvement:  0   |
--+---
Changes (by tomchristie):

 * cc: tomchristie (added)


-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #4656: Allow In-depth serialization by specifying depth to follow relationship

2010-12-10 Thread Django
#4656: Allow In-depth serialization by specifying depth to follow relationship
-+--
  Reporter:  jay.m.mar...@gmail.com  | Owner:  nobody 
Status:  new | Milestone: 
 Component:  Serialization   |   Version: 
Resolution:  |  Keywords:  feature
 Stage:  Accepted| Has_patch:  0  
Needs_docs:  0   |   Needs_tests:  0  
Needs_better_patch:  0   |  
-+--
Changes (by t0ster):

 * cc: tost...@gmail.com (added)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #4656: Allow In-depth serialization by specifying depth to follow relationship

2010-10-01 Thread Django
#4656: Allow In-depth serialization by specifying depth to follow relationship
-+--
  Reporter:  jay.m.mar...@gmail.com  | Owner:  nobody 
Status:  new | Milestone: 
 Component:  Serialization   |   Version: 
Resolution:  |  Keywords:  feature
 Stage:  Accepted| Has_patch:  0  
Needs_docs:  0   |   Needs_tests:  0  
Needs_better_patch:  0   |  
-+--
Changes (by anonymous):

 * cc: dja...@leithall.com (added)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #4656: Allow In-depth serialization by specifying depth to follow relationship

2010-02-13 Thread Django
#4656: Allow In-depth serialization by specifying depth to follow relationship
-+--
  Reporter:  jay.m.mar...@gmail.com  | Owner:  nobody 
Status:  new | Milestone: 
 Component:  Serialization   |   Version: 
Resolution:  |  Keywords:  feature
 Stage:  Design decision needed  | Has_patch:  0  
Needs_docs:  0   |   Needs_tests:  0  
Needs_better_patch:  0   |  
-+--
Comment (by orokusaki):

 @russellm I was thinking of only one side of the solution and figuring
 that it would be within the model's meta that you would describe the
 format, etc. I understand upon further thinking that the model's meta is
 orthogonal to the output and different scenarios might need different
 options (which my idea doesn't allow). on "light-hearted": dually noted.
 Thanks.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #4656: Allow In-depth serialization by specifying depth to follow relationship

2010-02-11 Thread Django
#4656: Allow In-depth serialization by specifying depth to follow relationship
-+--
  Reporter:  jay.m.mar...@gmail.com  | Owner:  nobody 
Status:  new | Milestone: 
 Component:  Serialization   |   Version: 
Resolution:  |  Keywords:  feature
 Stage:  Design decision needed  | Has_patch:  0  
Needs_docs:  0   |   Needs_tests:  0  
Needs_better_patch:  0   |  
-+--
Comment (by russellm):

 @orokusaki My opening comment was a light-hearted (hence the smiley)
 attempt to draw attention to the fact that your proposal is very LISPy,
 but not very Pythonic. Yes, tuples and lists are Python data structures -
 that doesn't mean that nesting them N deep is a good idea. Off the top of
 my head, the only place we use nested 2-tuples is in the choices list on
 forms (to provide optgroups) and in specifying arguments to template
 loaders - and in both of those cases, the nesting is limited to depth 2. I
 can't think of any examples of arbitrarily nested tuples in Django.

 The reason I mentioned the excludes/fields issue is that I'm not
 especially inclined to start applying piecemeal fixes to serialization
 when there is a much bigger problem lurking - that of customization. Any
 good solution for customizable serialization will necessitate the ability
 to have fine grained control over recursion, the fields that are to be
 included, and the format in which they will be displayed. What you've
 proposed will fix one small part of a larger problem, and may do so in a
 way that constrains our ability to implement a truly generic solution.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #4656: Allow In-depth serialization by specifying depth to follow relationship

2010-02-11 Thread Django
#4656: Allow In-depth serialization by specifying depth to follow relationship
-+--
  Reporter:  jay.m.mar...@gmail.com  | Owner:  nobody 
Status:  new | Milestone: 
 Component:  Serialization   |   Version: 
Resolution:  |  Keywords:  feature
 Stage:  Design decision needed  | Has_patch:  0  
Needs_docs:  0   |   Needs_tests:  0  
Needs_better_patch:  0   |  
-+--
Comment (by orokusaki):

 @russellm Why start with a diss on my code (that's called a tuple and
 2-tuples, both very common in Django and Python). Read the title of this
 ticket, and read my full example. It's about specifying recursion depth.
 Not about excludes= or feilds=. That just happened to be added on half way
 through. My version is not for specifying fields to be exported. Its to
 represent which relationships (how deep) should be exported. Sure a class,
 or a model Meta: may be the way to describe which format / fields get
 exported, but my version merely says: "Export football team, and it's
 related players, and their related records, and so on (the "related" being
 models not fields).

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #4656: Allow In-depth serialization by specifying depth to follow relationship

2010-02-10 Thread Django
#4656: Allow In-depth serialization by specifying depth to follow relationship
-+--
  Reporter:  jay.m.mar...@gmail.com  | Owner:  nobody 
Status:  new | Milestone: 
 Component:  Serialization   |   Version: 
Resolution:  |  Keywords:  feature
 Stage:  Design decision needed  | Has_patch:  0  
Needs_docs:  0   |   Needs_tests:  0  
Needs_better_patch:  0   |  
-+--
Changes (by russellm):

  * version:  SVN =>

Comment:

 @orokusaki: That's some might fine LISP you've written :-)

 Seriously - there's more to this problem than just specifying a tree of
 attributes to dump (although that is certainly part of the problem). The
 rendering format is also an issue. For example, should a foreign key be
 represented as:
 {{{
 {
"pk": 1,
"model": "app.foo",
"fields": {
   "name": "first",
   "child": {
  "pk": 1,
  "model": "app.bar",
  "fields": {
 "attrib": 3
  }
   }
}
 }
 }}}
 or
 {{{
 {
"pk": 1,
"model": "app.foo",
"fields": {
   "name": "first",
   "child": {
  "pk": 1,
  "attrib": 3
   }
}
 }
 }}}
 or
 {{{
 {
"pk": 1,
"name": "first",
"child": {
   "pk": 1,
   "attrib": 3
}
 }
 }}}
 or something else entirely? Different users will have different needs. And
 I haven't even started looking into the XML-related problems (what tag
 name do I use? Do I use an attribute or CDATA to represent content?)

 This isn't something we're going to be able to cram into the arguments of
 a single function. in order to give full customizability, we're going to
 need to provide a class-based mechanism for describing serialization.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.




Re: [Django] #4656: Allow In-depth serialization by specifying depth to follow relationship

2010-02-10 Thread Django
#4656: Allow In-depth serialization by specifying depth to follow relationship
-+--
  Reporter:  jay.m.mar...@gmail.com  | Owner:  nobody 
Status:  new | Milestone: 
 Component:  Serialization   |   Version:  SVN
Resolution:  |  Keywords:  feature
 Stage:  Design decision needed  | Has_patch:  0  
Needs_docs:  0   |   Needs_tests:  0  
Needs_better_patch:  0   |  
-+--
Changes (by orokusaki):

  * stage:  Accepted => Design decision needed

Comment:

 '''How about this?'''


 {{{
 # If the model was FootballTeam, this could be an example:
 recursive=(
 'coach',
 ('game',
 ('player',
 'record', 'newsevent', ('fight',
'lawsuit',
'policeraid'
 )
 )
 ),
 ('teamsoffshorebank',
 'taxfraudcase',
 'illegitimatechild'
 ),
 'peprally'
 )
 }}}

 '''This is very flexible'''. After all, who just wants a to say levels=3
 and then hope they didn't forget a secure billing model somewhere down the
 line.

 The code logic is not that difficult. Basically if it's a tuple, then the
 first element of the tuple is directly related to the previous level. (A
 player has a record, news event, and a fight. A fight has a lawsuit and a
 police raid, and so on. I know my models are ridiculous but I think the
 syntax is pretty pragmatic.)

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #4656: Allow In-depth serialization by specifying depth to follow relationship

2010-02-10 Thread Django
#4656: Allow In-depth serialization by specifying depth to follow relationship
-+--
  Reporter:  jay.m.mar...@gmail.com  | Owner:  nobody 
Status:  new | Milestone: 
 Component:  Serialization   |   Version:  SVN
Resolution:  |  Keywords:  feature
 Stage:  Accepted| Has_patch:  0  
Needs_docs:  0   |   Needs_tests:  0  
Needs_better_patch:  0   |  
-+--
Comment (by orokusaki):

 @Matthew Flanagan I would prefer to use either. I mean, it would be nice
 if it operated like model forms in that if you say excludes=('myfield',),
 then it does all but that one, and if you say includes=('myfield',), it
 only does that one. I especially think includes is very important because
 it's more explicit. If you have a big model and an actively changed API,
 and you only have excludes, then what happens when somebody adds a new
 "secure" field to the model? It suddenly shows up in the output.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-upda...@googlegroups.com.
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en.



Re: [Django] #4656: Allow In-depth serialization by specifying depth to follow relationship

2009-03-19 Thread Django
#4656: Allow In-depth serialization by specifying depth to follow relationship
-+--
  Reporter:  jay.m.mar...@gmail.com  | Owner:  nobody 
Status:  new | Milestone: 
 Component:  Serialization   |   Version:  SVN
Resolution:  |  Keywords:  feature
 Stage:  Accepted| Has_patch:  0  
Needs_docs:  0   |   Needs_tests:  0  
Needs_better_patch:  0   |  
-+--
Comment (by vitalyperessada):

 Another possible angle is to add QuerySet.deep_values() as per following
 posting. The code works on single object but it could be easily extended
 to work with iterator.
 http://groups.google.com/group/django-
 developers/browse_thread/thread/933cdb7b49880471

 I stumbled on this during json serialization attempt, but having something
 like deep_values() could have more future uses since it will allow
 converting django.models object tree into primitive nested data structure.

 If django gods agree :-) I could open a separate ticket and finalize code.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #4656: Allow In-depth serialization by specifying depth to follow relationship

2009-02-27 Thread Django
#4656: Allow In-depth serialization by specifying depth to follow relationship
-+--
  Reporter:  jay.m.mar...@gmail.com  | Owner:  nobody 
Status:  new | Milestone: 
 Component:  Serialization   |   Version:  SVN
Resolution:  |  Keywords:  feature
 Stage:  Accepted| Has_patch:  0  
Needs_docs:  0   |   Needs_tests:  0  
Needs_better_patch:  0   |  
-+--
Comment (by ericholscher):

 @Matthew: Good points.

 I don't know if all serializers are meant to always be deserializable, or
 if that is just something that has happened in the past and should happen.
 I see now how that functionality can be useful (as you are using them, as
 a return from a view to populate data). Most of my experience with
 serializers have been with load/dump data, I sometimes forget they are
 really useful for serializing data in other situations.

 It should be noted that these issues are seperate from the actual reason
 that this ticket is open, so opening another ticket with each of your
 proposed additions is probably advisable. The exclude stuff is a pretty
 simple and logical change, so that having that in its own ticket would be
 nice. I can see the extras functionality having more discussion, so
 splitting that off as well is probably good.

 The relations functionality seems to be a way to implement this ticket, so
 that stuff is probably good to stay here :) Providing a patch on this
 ticket providing that functionality against Django (along with the
 relative depth as stated in the title) would probably be a good start to
 getting something in a format that can be committed. I like the idea of
 including this stuff, but I'm not sold on the API, but now I understand
 better how it's useful :)

 Cheers.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #4656: Allow In-depth serialization by specifying depth to follow relationship

2009-02-16 Thread Django
#4656: Allow In-depth serialization by specifying depth to follow relationship
-+--
  Reporter:  jay.m.mar...@gmail.com  | Owner:  nobody  
Status:  new | Milestone:  post-1.0
 Component:  Serialization   |   Version:  SVN 
Resolution:  |  Keywords:  feature 
 Stage:  Accepted| Has_patch:  0   
Needs_docs:  0   |   Needs_tests:  0   
Needs_better_patch:  0   |  
-+--
Changes (by datavortex):

 * cc: datavor...@datavortex.net (added)

Comment:

 I am also using the extras functionality to serialize non-field properties
 of models, and I do think this feature is generally useful enough to be
 included in Django.  In my case, my application uses two datastores for
 its information, and the django models are supplemented with information
 from the second datastore.  Sometimes I want to serialize these properties
 and sometimes I don't.  The ability to use the extras argument solves my
 problem.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #4656: Allow In-depth serialization by specifying depth to follow relationship

2009-02-14 Thread Django
#4656: Allow In-depth serialization by specifying depth to follow relationship
-+--
  Reporter:  jay.m.mar...@gmail.com  | Owner:  nobody  
Status:  new | Milestone:  post-1.0
 Component:  Serialization   |   Version:  SVN 
Resolution:  |  Keywords:  feature 
 Stage:  Accepted| Has_patch:  0   
Needs_docs:  0   |   Needs_tests:  0   
Needs_better_patch:  0   |  
-+--
Comment (by Matthew Flanagan ):

 I should also add that the extras functionality is not intended to be
 deserialized.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #4656: Allow In-depth serialization by specifying depth to follow relationship

2009-02-13 Thread Django
#4656: Allow In-depth serialization by specifying depth to follow relationship
-+--
  Reporter:  jay.m.mar...@gmail.com  | Owner:  nobody  
Status:  new | Milestone:  post-1.0
 Component:  Serialization   |   Version:  SVN 
Resolution:  |  Keywords:  feature 
 Stage:  Accepted| Has_patch:  0   
Needs_docs:  0   |   Needs_tests:  0   
Needs_better_patch:  0   |  
-+--
Comment (by Matthew Flanagan ):

 Eric,

 Thanks for taking the time to look at it. I'll rework it as a patch on
 Django's own serializers but I wrote it as a standalone module that can be
 added to a project using the SERIALIZATION_MODULES setting so I didn't
 have to maintain it as a patch against Django trunk in my own projects.

 The extras functionality is a DRY thing for me e.g. putting things like
 get_absolute_url into JSON or other simple non-field properties/methods
 that I don't want to repeat the logic for in my templates. I'm using extjs
 grids for presenting data in an enterprise app and all the grid rows are
 populated with AJAX calls to a REST API using this serializer.

 The relations approach is based off how Rails does it. I'm not
 reimplementing the queryset api nor performng any filtering but specifying
 arguments to pass to subsequent calls to serialize() on each related or
 sub-related object. See handle_fk_field() in
 http://wadofstuff.googlecode.com/svn/trunk/python/django/serializers/python.py
 for gory details.

 For example

 {{{
 
relations={'permissions':{'relations':{'content_type':{'excludes':('app_label',)}
 }}}
 }}}

 Sort of breaks down to pseudocode to:
 {{{
Serialize each permissions relation
 Serialize each content_type relation excluding the app_label field
 }}}

 I find exclusion very handy and quite succinct. Which would you prefer to
 write to exclude a User's password from being serialized:

 {{{
 serializers.serialize('json', User.objects.all(), excludes=('password',))
 }}}

 or

 {{{
 serializers.serialize('json', User.objects.all(), fields=('username',
 'first_name', 'last_name', 'email', 'is_staff', 'is_active',
 'is_superuser', 'last_login', 'date_joined', 'groups', 'user_permissions')
 }}}

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #4656: Allow In-depth serialization by specifying depth to follow relationship

2009-02-13 Thread Django
#4656: Allow In-depth serialization by specifying depth to follow relationship
-+--
  Reporter:  jay.m.mar...@gmail.com  | Owner:  nobody  
Status:  new | Milestone:  post-1.0
 Component:  Serialization   |   Version:  SVN 
Resolution:  |  Keywords:  feature 
 Stage:  Accepted| Has_patch:  0   
Needs_docs:  0   |   Needs_tests:  0   
Needs_better_patch:  0   |  
-+--
Comment (by ericholscher):

 Matthew,

 This is some interesting work. I like a lot of the concepts (and following
 relations on serialization is something that I have had to hack myself).
 First off, can you attach a patch on django that shows what you are
 changing instead of posting files. This makes it a lot easier to see what
 you are proposing.

 I think that the excludes functionality is something that is really
 useful. We have the fields option that allows you to be inclusive of
 fields, I think that an "everything but this one" is a useful shortcut.
 Given, it is still possible just by including everything else. I think
 that this is a good idea.

 The extras functionality is interesting, but I don't see a lot of the
 value in it. If you're including the output of functions based on the
 data, why not just include the data? I understand that in your writeup it
 is a trivial example, but I think serializing the output of functions is
 not wise. Functions change a lot more often than model fields, and it
 isn't guarenteed that you can really "deserialize" a function. I'm curious
 how you're implementing this (or if it's even possible). I think it is an
 interesting idea perhaps to provide some kind of documentation inside of
 the fixture, and might have other uses.

 In your implementation of relations you are taking another "include these"
 approach. In the above ticket it talks about having something along those
 lines, but having you be able to specify a depth, and it follows all
 relationsips. That said, the API that you've implemented for the relations
 stuff is a bit cumbersome.

 {{{
 
relations={'permissions':{'relations':{'content_type':{'excludes':('app_label',)
 }}}

 just screams out of a better way of being represented. It seems like
 you're trying to almost reimplement the queryset api. I think that a lot
 of this filtering functionality can come from the queryset that you are
 passing in to be serialized.

 I think that having serializers just dump out all of the relations a model
 points to might lead to some problems, and if included in Django it will
 probably be optional, and off by default. I know the snippet
 http://www.djangosnippets.org/snippets/918/ has implemented ForeignKey and
 ManytoMany relationships, along with adding a "slicing" syntax to
 serializers. The slicing part is for another ticket, but that code might
 be a good reference for trying to have fixtures span relationships.

 So in summary, I think having serializers spanning relationships is a big
 win. The exclusion syntax on the serializer seems like it should be
 included for completeness and because it is useful. The other two bits of
 functionality certainly seem useful, but are probably a bit too specific
 to go into Django. They work nicely as a third party app.

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---



Re: [Django] #4656: Allow In-depth serialization by specifying depth to follow relationship

2009-02-13 Thread Django
#4656: Allow In-depth serialization by specifying depth to follow relationship
-+--
  Reporter:  jay.m.mar...@gmail.com  | Owner:  nobody  
Status:  new | Milestone:  post-1.0
 Component:  Serialization   |   Version:  SVN 
Resolution:  |  Keywords:  feature 
 Stage:  Accepted| Has_patch:  0   
Needs_docs:  0   |   Needs_tests:  0   
Needs_better_patch:  0   |  
-+--
Changes (by Matthew Flanagan ):

 * cc: mattimust...@gmail.com (added)

Comment:

 Added some documentation and examples on how to use the classes here
 http://code.google.com/p/wadofstuff/wiki/DjangoFullSerializers

-- 
Ticket URL: 
Django 
The Web framework for perfectionists with deadlines.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To post to this group, send email to django-updates@googlegroups.com
To unsubscribe from this group, send email to 
django-updates+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~--~~~~--~~--~--~---