This ticket #11574 <https://code.djangoproject.com/ticket/11574> is open 
from many years ago. I'm interested to contribute with this new feature 
but, if this ticket has a lot of time opened, and is very possible that 
there are some reservations and consideration about this feature. Before 
use time to build a solution, i think that will be useful discuss about 
this topic with the community.
Similar to `InlineModelAdmin`, I consider that this feature won't be useful 
for all models, is really useful for models with few fields. But, adding 
new records directly in the `changelist` would be util like the feature 
`InlineModelAdmin`, for little models. For a big model won't be impossible, 
but the admin form will be more usable. 
I have an idea to complete this task and is the following:

   1. Add a new attribute to the class `ModelAdmin`, to specify how many 
   blank rows will be shown by default when the `changelist` is rendered. The 
   new attribute would be named `list_editable_extra`, as was proposed in the 
   ticket description. This attribute will be used basically to set as `extra` 
   value in ModelAdmin.get_changelist_formset 
   
<https://github.com/django/django/blob/master/django/contrib/admin/options.py#L689>
   . 
   2. As was described in the ticket; "Adapt the `result_list` template tag 
   in `admin_list.py` to show the extra forms. This can be done by calling 
   `items_for_result` with an empty model for each empty form". I tested 
   that suggestion and works good. 
   3. Avoid to render the `checkbox` "action-select" for the blank rows in 
   the `changelist` action column, in order to avoid problems with 
   changelist's actions.
   4. Add functionality similar to `InlineModelAdmin`, in order to add or 
   to delete blank rows.
   5. Add tests for the solution, including `Selenium` tests.
   6. Add documentation about the new feature.

I evaluated 2 possibilities to reach that, both possibilities with 
different impact in the Django's code.

   - Render in the blank row as editable fields, only the `list_editable` 
   fields. With this solution we need to modify less code's lines to render 
   the blank rows. Is necessary to be clear in the documentation that this 
   feature only will be able if the `list_editable` has been set, and could be 
   edited only the fields added to `list_editable` tuple.
   - Render in the blank row as editable fields, all `list_display` fields. 
   With this solution we need to make more adjusts in order to render the 
   blank rows successfully. Is necessary to be clear in the documentation that 
   this feature only will be able if the `list_display` has been set, and 
   could be edited this time only the fields added to `list_display` tuple. 
   
I know that there are some obstacles that I will go finding in the way to 
reach this goal, but it's a simple resume of my idea. I'm open to better 
ideas.

-- 
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 https://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/b55c8464-89a7-4931-9fc1-bb05208cc1f6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to