Code

Opened 9 years ago

Closed 9 years ago

Last modified 7 years ago

#617 closed defect (invalid)

num_in_admin problem in tutorial

Reported by: bretthoerner@… Owned by: adrian
Component: contrib.admin Version:
Severity: normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

It seems that when I changed the poll admin page to include the choices with num_in_admin=3, it didn't display 3 for existing polls.

Existing polls only show 1 new row more than the number of choices I already had. In other words, if my poll has no choices, it shows 1 blank row. If I had one choice, it shows one blank row after that (2 total), if I had 2 choices, it shows 1 blank row (3 total)... after that it's moot because num_in_admin=3 is fulfilled.

Here's an image showing my code vs what I got,
http://img402.imageshack.us/img402/9155/adminq21sg.png

It should be noted that if I went to "Add New Poll", it would have 3 new empty choice slots, it just doesn't seem to work for existing polls...?

(I'm not sure if this would be 1.1 or what but I'm using svn-r844)

Attachments (0)

Change History (2)

comment:1 Changed 9 years ago by rjwittams

This is, currently, expected behaviour AFAIK.

The current plan (AFAIK) is to make this all use explicit add/delete behaviour soon after the new-admin branch lands ( and get rid of the concept of core fields, etc). Num_in_admin would go at the same time.

So maybe this is a duplicate of #13.

comment:2 Changed 9 years ago by adrian

  • Resolution set to invalid
  • Status changed from new to closed

Yes, this is expected behavior. By default, when you go to a change page, Django gives you one empty extra row for edit_inline objects. Use num_extra_on_change to change this from 1 (the default) to whatever number you want. See http://www.djangoproject.com/documentation/model_api/#admin-options for the full scoop.

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.