#24749: contribute_to_class(virtual_field=True) is ignored
----------------------------------------------+--------------------
     Reporter:  hampsterx                     |      Owner:  nobody
         Type:  Bug                           |     Status:  new
    Component:  Database layer (models, ORM)  |    Version:  1.8
     Severity:  Normal                        |   Keywords:
 Triage Stage:  Unreviewed                    |  Has patch:  0
Easy pickings:  1                             |      UI/UX:  0
----------------------------------------------+--------------------
 /django/db/models/fields/__init__.py

 {{{
 def contribute_to_class(self, cls, name, virtual_only=False):
   self.set_attributes_from_name(name)
   self.model = cls
   if virtual_only:
       cls._meta.add_field(self, virtual=True)

   self.attname, self.column = self.get_attname_column()
   self.concrete = self.column is not None


 def get_attname_column(self):
     attname = self.get_attname()
     column = self.db_column or attname
     return attname, column
 }}}

 /django/db/models/options.py

 {{{
 def concrete_fields(self):

   return make_immutable_fields_list("concrete_fields", (f for f in
 self.fields if f.concrete)

 }}}

 concrete_fields() is checking for concrete property but

  column = self.db_column or attname

 will ensure it's never false :(

--
Ticket URL: <https://code.djangoproject.com/ticket/24749>
Django <https://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 unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/052.9dac90a31498acebf37b5c0336a49d00%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to