#27446: Addition of `readonly` option to ModelField to allow database generated
fields
-------------------------------------+-------------------------------------
     Reporter:  Ben Cole             |                    Owner:  Ben Cole
         Type:  New feature          |                   Status:  assigned
    Component:  Database layer       |                  Version:  master
  (models, ORM)                      |
     Severity:  Normal               |               Resolution:
     Keywords:                       |             Triage Stage:
                                     |  Unreviewed
    Has patch:  0                    |      Needs documentation:  0
  Needs tests:  0                    |  Patch needs improvement:  0
Easy pickings:  0                    |                    UI/UX:  0
-------------------------------------+-------------------------------------
Changes (by Ben Cole):

 * status:  new => assigned
 * owner:  nobody => Ben Cole


Old description:



New description:

 There exist multiple use cases where a database will generate values for a
 field/column. Most RDBMSes expect that these columns be excluded from from
 `INSERT` and `UPDATE` statements. However they still need to be included
 in `SELECT` statements.

 The proposal therefore is to add a `readonly` option to the base `Field`
 class that when `True` would strip these fields from being compiled to SQL
 during `INSERT`s and `UPDATE`s. This allows for a very simple change that
 covers all possible write queries that Django may perform (including
 bulk_*).

 There exists a proof of concept https://github.com/novafloss/django-
 readonly-field

--

--
Ticket URL: <https://code.djangoproject.com/ticket/27446#comment:1>
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/065.8c1e8a608e0e46fcdc250953903ff9f8%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to