For implement this logic I need access to class object when default method
is called (I mean method specifying as value for default argument for
field).
But at method call I don't get any arguments. In case when I need
implement this field for single model - I can use model name as his
objects argument for this logic. But for many models I thinks it's will be
bad. Abstract model also not a choice, because it doesn't have a objects
manager.
So I remember about prepopulated fields in BaseModelAdmin (this all need
inly for admin site), and I use formfield_for_dbfield for implementing
this logic.
Now I want to ask about add new feature to add compute_defaults dict to
BaseModelAdmin. Key used as field name selector and value as computing
function (information about model and current field we can get from
db_field variable). I can create PL with this feature by myself, but
should I do it? Is it need to somebody else? And what you all thinking
about this idea?
--
Ticket URL: <https://code.djangoproject.com/ticket/29445>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* status: new => closed
* resolution: => wontfix
Comment:
The solution sounds rather specialized to me. I think the logic could be
implemented in a custom form. You might try asking for help using the
resources linked from TicketClosingReasons/UseSupportChannels.
--
Ticket URL: <https://code.djangoproject.com/ticket/29445#comment:1>