You could already achieve that by making MyPostgresqlFunction a subclass of models.Func, I don't think it's worth supporting alternate syntaxes.
Cheers, Loïc > On Jul 29, 2015, at 23:05, Podrigal, Aron <ar...@guaranteedplus.com> wrote: > > What about db_default allows either a constent eg. > db_default=contrib.postgres.functions. or a string > "MyCustomPostgresFunction()" and optionaly allowing arguments to be passed to > the db function optionally also allowing F() expressions by giving a tuple > db_default=('MyPostgresqlFunction()', F('column1'), 'NOW()'). > > On Wed, Jul 29, 2015 at 11:58 AM, Podrigal, Aron <ar...@guaranteedplus.com> > wrote: > OK, that makes implementation a lot easier. As the model validation can be > done with Model.check() based on the backend given at that time either when > running the server or makmigrations. > > On Wed, Jul 29, 2015 at 11:50 AM, Michael Manfre <mman...@gmail.com> wrote: > > > On Wed, Jul 29, 2015 at 11:42 AM, Podrigal, Aron <ar...@guaranteedplus.com> > wrote: > Hi Loic, > > Agree with having a db_default kwarg. > > I am not using multiple databases so no experiance with db routers. So how > would should we handle routing between different databases when the > db_default value is not compatible with that backend? for example > Model.save(using='mysql_db') should we than use the Field.default to generate > the default value (which is not how it works today, that the default is > computed at instance creation). I would prefer in such a case to rely on the > database to handle the situation by omitting that field from the columns > list, so mysql for example would set a non nullable varchar column to an > empty string, where with other databases it would cause an IntegrityError > exception. and that db_default and default kwargs cannot be used togethor. > > > If db_default is defined for a field, then it should always be used. If the > db_default is invalid for the configured backend, then it will and should > break. We shouldn't automatically change db_default to a regular default or > do any other magic. > > -- > 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/CAGdCwBsHa%2BGXJSB6fay%3DbM%2B-3qV0y5oSuDNd4m05QM1PPdfKrw%40mail.gmail.com. > > For more options, visit https://groups.google.com/d/optout. > > > > -- > Aron Podrigal > - > '1000001', '1110010', '1101111', '1101110' '1010000', '1101111', '1100100', > '1110010', '1101001', '1100111', '1100001', '1101100' > > P: '2b', '31', '33', '34', '37', '34', '35', '38', '36', '30', '39', '39' > > > > > -- > Aron Podrigal > - > '1000001', '1110010', '1101111', '1101110' '1010000', '1101111', '1100100', > '1110010', '1101001', '1100111', '1100001', '1101100' > > P: '2b', '31', '33', '34', '37', '34', '35', '38', '36', '30', '39', '39' > > > -- > 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/CANJp-yjOW72mXpKHiq-MCWkSHxSC%3DnBA_42VFuBVJyKFHMXxpg%40mail.gmail.com. > For more options, visit https://groups.google.com/d/optout. -- 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/6708A498-F62B-4651-B52D-B40FD1E47DED%40gmail.com. For more options, visit https://groups.google.com/d/optout.