#9368: Clean up code for getting columns for select query
---------------------------------------------------+------------------------
          Reporter:  adunar                        |         Owner:  mtredinnick
            Status:  assigned                      |     Milestone:  post-1.0   
         Component:  Database layer (models, ORM)  |       Version:             
        Resolution:                                |      Keywords:             
             Stage:  Accepted                      |     Has_patch:  1          
        Needs_docs:  0                             |   Needs_tests:  0          
Needs_better_patch:  0                             |  
---------------------------------------------------+------------------------
Changes (by mtredinnick):

  * status:  new => assigned
  * needs_better_patch:  => 0
  * needs_tests:  => 0
  * owner:  nobody => mtredinnick
  * needs_docs:  => 0
  * stage:  Unreviewed => Accepted

Comment:

 Looks like a good set of changes, thanks. A few points.
  1. You can't use decorators in Django core code (must be Python 2.3
 compatible).
  2. The extra classmethod you added to `models.base.Model` can't actually
 be used. I've already made that mistake once. The problem is that entirely
 avoids `__init__` and there is lots of code that extends `__init__` to do
 other stuff on initialisation. The `QuerySet` code should be a good
 citizen and use the public interface for constructing a model instance.
 Zipping a parallel list of field names and values into a dictionary isn't
 hard when it's required. It's tempting to try and shortcut `__init__`, but
 it's backwards compatible and, even when it wasn't, it turned out to be
 very inconvenient for other code when something tried to come in via the
 back door. So we'll stick to initialising a model with a list of values
 when we have all the fields and use the keyword argument approach when
 necessary (it's pretty easy to tell the two cases apart).
  3. As a stylistic issue, all the methods inside `Query` have the same
 level of visibility. It's a non-public class, so we don't need to worry
 about adding leading underscores to new methods.

 Most of these I'll probably just fix when I commit this (I want to think
 about parts of the changes a bit more, so it'll be a few days before I
 commit it). So no need to write an updated patch; these are more notes for
 next time and so you understand why some of the changes won't go in as is.

-- 
Ticket URL: <http://code.djangoproject.com/ticket/9368#comment:1>
Django <http://code.djangoproject.com/>
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-updates?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to