On Wednesday, July 29, 2015 at 8:05:10 AM UTC+3, Aron Podrigal wrote:
>
> I would like to propose making Fields.default to rely on the database 
> generated defaults where possible. This could be implemented by having 
> some  constants like fields.CURRENT_TIMESTAMP, etc.  The tricky part here 
> is to detect database backend specific capabilities and have a python 
> equivalent fallback.
>
> Any thoughts?
>

A couple of questions about this:
  - What should happen when you instantiate a new model with DB default, 
and show that model to the user in a form. Is the field shown to the user, 
and if so, what value should it have?
  - How to implement actual fetching of the values after save() - 
PostgreSQL supports RETURNING, but this is not the case for all databases.
  - When is the default applied? On first save of the model, or on model 
init time?
  - Do we want to allow extending this to defaults that are applied on 
every save (automatic database backed modified timestamps for example)?

 - Anssi

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to django-developers+unsubscr...@googlegroups.com.
To post to this group, send email to django-developers@googlegroups.com.
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/f1a7cc68-de1a-49f8-bdf8-ebfaade59955%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to