def response_change(self, request, obj):
IS_POPUP_VAR = '<STR_LIT>'<EOL>TO_FIELD_VAR = '<STR_LIT>'<EOL>if IS_POPUP_VAR in request.POST:<EOL><INDENT>to_field = request.POST.get(TO_FIELD_VAR)<EOL>attr = str(to_field) if to_field else obj._meta.pk.attname<EOL>value = request.resolver_match.args[<NUM_LIT:0>]<EOL>new_value = obj.serializable_value(attr)<EOL>popup_response_data = json.dumps({<EOL>'<STR_LIT:action>': '<STR_LIT>',<EOL>'<STR_LIT:value>': six.text_type(value),<EOL>'<STR_LIT>': six.text_type(obj),<EOL>'<STR_LIT>': six.text_type(new_value),<EOL>'<STR_LIT>': obj.defaultCapacity,<EOL>'<STR_LIT>': json.dumps([{'<STR_LIT:id>': x.id, '<STR_LIT:name>': x.name, '<STR_LIT>': x.defaultCapacity} for x in obj.room_set.all()]),<EOL>})<EOL>return SimpleTemplateResponse('<STR_LIT>', {<EOL>'<STR_LIT>': popup_response_data,<EOL>})<EOL><DEDENT>return super(LocationAdmin,self).response_change(request, obj)<EOL>
This just modifies the normal ModelAdmin process in order to
pass capacity and room options for the modified Location along with
the location's name and ID.