Django

Code

Ticket #6075 (closed: fixed)

Opened 1 year ago

Last modified 6 months ago

max_num, etc. for inline models in newforms-admin

Reported by: yserrano Assigned to: brosner
Milestone: Component: django.contrib.admin
Version: newforms-admin Keywords: nfa-blocker
Cc: densetsu.no.ero.sennin@gmail.com, brooks.travis@gmail.com Triage Stage: Accepted
Has patch: 1 Needs documentation: 1
Needs tests: 1 Patch needs improvement: 1

Description

The max_num feature is missing in the newforms-admin branch. When you add max_num to your Child_Inline max_num doesn't do anything.

from django.contrib import admin 
class Child_Inline(admin.TabularInline): 
    model = Child 
    extra = 3 
    max_num = 5

I looked at the code in django/contrib/admin/options.py and it seems that there is no max_num feature there.

I added a patch with the missing functionality. I'm not sure if it's the best way to do it, especially the line with apply in it.

Attachments

newforms-admin_max_num.diff (2.2 kB) - added by yserrano on 12/01/07 06:46:44.
newforms-admin_max_num_6075_v7363.diff (2.3 kB) - added by ext on 03/25/08 15:49:50.
Updated patch for django version 7363 (should work for versions from 7270)

Change History

12/01/07 06:46:44 changed by yserrano

  • attachment newforms-admin_max_num.diff added.

12/08/07 06:08:52 changed by Karen Tracey <kmtracey@gmail.com>

  • needs_better_patch set to 1.
  • needs_tests set to 1.
  • summary changed from max_num for inline models in newforms-admin to max_num, etc. for inline models in newforms-admin.
  • keywords set to nfa-blocker.
  • needs_docs set to 1.
  • stage changed from Unreviewed to Accepted.

It doesn't look like any of the (max_num_in_admin, min_num_in_admin, num_extra_on_change, num_in_admin) described in the old admin doc (here: http://www.djangoproject.com/documentation/model-api/#many-to-one-relationships) have been implemented in newforms-admin. Rather than adding them one at a time it would make more sense to have one ticket cover them all. Marking this blocking on merge since it's a loss of capability from old admin. When implemented doc will be needed to describe any changes in the names of these things, and tests would be good too.

02/14/08 17:06:04 changed by Densetsu no Ero-sennin <densetsu.no.ero.sennin@gmail.com>

  • cc set to densetsu.no.ero.sennin@gmail.com.

03/25/08 15:49:50 changed by ext

  • attachment newforms-admin_max_num_6075_v7363.diff added.

Updated patch for django version 7363 (should work for versions from 7270)

05/13/08 09:32:50 changed by brosner

  • owner changed from yserrano to brosner.
  • status changed from new to assigned.

05/15/08 11:16:27 changed by brooks.travis@gmail.com

  • cc changed from densetsu.no.ero.sennin@gmail.com to densetsu.no.ero.sennin@gmail.com, brooks.travis@gmail.com.

Seems like whatever is done to add this feature to the admin should probably be abstracted to the InlineFieldset? portion of newforms, rather than living in contrib.admin, as it would be just as useful there.

06/10/08 22:58:01 changed by brosner

  • status changed from assigned to closed.
  • resolution set to fixed.

(In [7613]) newforms-admin: Fixed #6075 -- Implemented max_num on formsets and model formsets. Added a hook on InlineModelAdmin? to customize in the admin interface.


Add/Change #6075 (max_num, etc. for inline models in newforms-admin)




Change Properties
Action