Code

Opened 4 years ago

Closed 4 years ago

#13720 closed (duplicate)

response_change does not consider _popup=1 when saving

Reported by: donatook 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: UI/UX:

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.

Attachments (0)

Change History (4)

comment:1 Changed 4 years ago by joni

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

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 Changed 4 years ago by donatook

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 Changed 4 years ago by joni

  • Triage Stage changed from Unreviewed to Design decision needed

comment:4 Changed 4 years ago by rasca

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

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

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.