Opened 16 years ago

Closed 16 years ago

#6075 closed (fixed)

max_num, etc. for inline models in newforms-admin

Reported by: Yves Serrano Owned by: Brian Rosner
Component: contrib.admin Version: newforms-admin
Severity: Keywords: nfa-blocker
Cc: densetsu.no.ero.sennin@…, brooks.travis@… Triage Stage: Accepted
Has patch: yes Needs documentation: yes
Needs tests: yes Patch needs improvement: yes
Easy pickings: no UI/UX: no

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 (2)

newforms-admin_max_num.diff (2.2 KB ) - added by Yves Serrano 16 years ago.
newforms-admin_max_num_6075_v7363.diff (2.3 KB ) - added by Jakub Wiśniowski 16 years ago.
Updated patch for django version 7363 (should work for versions from 7270)

Download all attachments as: .zip

Change History (7)

by Yves Serrano, 16 years ago

Attachment: newforms-admin_max_num.diff added

comment:1 by Karen Tracey <kmtracey@…>, 16 years ago

Keywords: nfa-blocker added
Needs documentation: set
Needs tests: set
Patch needs improvement: set
Summary: max_num for inline models in newforms-adminmax_num, etc. for inline models in newforms-admin
Triage Stage: UnreviewedAccepted

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.

comment:2 by Densetsu no Ero-sennin <densetsu.no.ero.sennin@…>, 16 years ago

Cc: densetsu.no.ero.sennin@… added

by Jakub Wiśniowski, 16 years ago

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

comment:3 by Brian Rosner, 16 years ago

Owner: changed from Yves Serrano to Brian Rosner
Status: newassigned

comment:4 by brooks.travis@…, 16 years ago

Cc: brooks.travis@… added

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.

comment:5 by Brian Rosner, 16 years ago

Resolution: fixed
Status: assignedclosed

(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.

Note: See TracTickets for help on using tickets.
Back to Top