Opened 14 years ago

Closed 13 years ago

#13720 closed (duplicate)

response_change does not consider _popup=1 when saving

Reported by: Donato Grieco Owned by: nobody
Component: contrib.admin Version: 1.2
Severity: Keywords: popup response_add response_change dismiss dismissAddAnotherPopup
Cc: Triage Stage: Design decision needed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

Using Admin interface, after adding a foreign key in popup (with the green plus next to the selectbox), the window is closed and the new value is inserted into the selectbox: this is done by calling "opener.dismissAddAnotherPopup" in the response page (see "admin/options/response_add") when "_popup=1" is in the url.

This does not work when 'changing' a foreign key in popup, because "admin/options/response_change" ignores the "_popup" parameter when saving.

I propose to clone "response_add" behaviour in "response_change" so that a "opener.dismissChangePopup" is called when changing a foreing key in popup.

Change History (4)

comment:1 by Joni, 13 years ago

I can't reproduce your problem, or maybe didn't understand it. When clicking on the green plus button next to the selectbox you are always creating a new record, not modifying.

I'm testing the following code (app name is ticket13720):

models.py

from django.db import models

class Animal(models.Model):
	name = models.CharField(max_length=255)
	type = models.ForeignKey('Type')
	
	def __unicode__(self):
		return self.name
	
class Type(models.Model):
	name = models.CharField(max_length=255)
	likes_to_eat = models.ForeignKey('Food')
	
	def __unicode__(self):
		return self.name
	
class Food(models.Model):
	name = models.CharField(max_length=255)
	
	def __unicode__(self):
		return self.name

admin.py

from django.contrib import admin

from ticket13720.models import Animal, Type, Food

admin.site.register(Animal)
admin.site.register(Type)
admin.site.register(Food)

comment:2 by Donato Grieco, 13 years ago

Thank you for your reply and excuse me for my rough english!
I forgot to say that I'm trying to use the features of admin interface in my own project. In my interface it is possible to open a foreign key in popup in order to change its fields. I noticed that this is not possible with current admin features, but just a few changes in "response_add" would make it.
So, this is not a lack in admin behaviour, but these changes would increase admin usability as an API.

comment:3 by Joni, 13 years ago

Triage Stage: UnreviewedDesign decision needed

comment:4 by rasca, 13 years ago

Resolution: duplicate
Status: newclosed

Based on donatook last comment closed as a duplicate of #13165

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