#2500 closed defect (fixed)
[patch] admin popup window stays open after adding and saving an item that has a primary_key=True field
| Reported by: | Owned by: | Adrian Holovaty | |
|---|---|---|---|
| Component: | contrib.admin | Version: | dev |
| Severity: | normal | Keywords: | |
| Cc: | gary.wilson@… | Triage Stage: | Unreviewed |
| Has patch: | yes | Needs documentation: | no |
| Needs tests: | no | Patch needs improvement: | no |
| Easy pickings: | no | UI/UX: | no |
Description
I have the models:
class Semester(models.Model): name = models.CharField(maxlength=20, primary_key=True) class Course(models.Model): number = models.CharField('course number', maxlength=6) title = models.CharField('course title', maxlength=100) semester = models.ForeignKey(Semester) year = models.PositiveIntegerField()
Steps to reproduce:
- In the admin, click Courses.
- Click add course.
- Click plus next to Semester dropdown.
- Fill in semester name.
- Click save.
What happens:
- The add semester popup window goes blank.
- The add semester popup window does not close itself and must be closed manually.
- The new semester entry does get created in the database.
- The semester dropdown in the add course form does not get populated with the newly created semester like it should.
Attachments (1)
Change History (5)
by , 19 years ago
| Attachment: | pk-popup-close.diff added |
|---|
comment:1 by , 19 years ago
| Summary: | admin popup window stays open after adding and saving an item that has a primary_key=True field → [patch] admin popup window stays open after adding and saving an item that has a primary_key=True field |
|---|
Change summary to indicate patch.
comment:2 by , 19 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
comment:3 by , 19 years ago
FYI, in the solution I came up with, I ended up just relying on the fact that the repr() of the primary-key value would be safely quoted -- so it works for integer and string values alike.
comment:4 by , 19 years ago
Note:
See TracTickets
for help on using tickets.
String primary key values must be quoted or JavaScript assumes it's a variable.