Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Ability to change dismissRelatedLookupPopup on my own callback function
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Alex Kamedov  
View profile  
 More options Jun 13 2011, 12:16 am
From: Alex Kamedov <kame...@gmail.com>
Date: Mon, 13 Jun 2011 10:16:11 +0600
Local: Mon, Jun 13 2011 12:16 am
Subject: Ability to change dismissRelatedLookupPopup on my own callback function

Hi all!

I make integration with warehouse system and want to reuse existing
functionality in django.contrib.admin to manage links between this system
and catalog on site.
I can't get access to warehouse system database, I have only export file. I
write some views to represent its items in django admin. And now I need
something like related field in django admin forms, but has some filters
applied to changelist and has some other user interface.

I think, the best solution for this case is put some links with
showRelatedObjectLookupPopup javascript function on admin changelist, but
after user choose the object, my own javascript function must
be called instead of dismissRelatedLookupPopup javascript function.

Execution of dismissRelatedLookupPopup is hard coded in python code now. The
easiest way to implement use case described higher is adding new GET
argument "_callback" to changelist view.

What are you think about this? If this solution was accepted I can write
patch and tests for it.

Cheers!
--
Alex Kamedov
skype: kamedov    www: kamedov.ru


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Harris Lapiroff  
View profile  
 More options Jun 13 2011, 10:23 am
From: Harris Lapiroff <harrislapir...@gmail.com>
Date: Mon, 13 Jun 2011 07:23:51 -0700 (PDT)
Local: Mon, Jun 13 2011 10:23 am
Subject: Re: Ability to change dismissRelatedLookupPopup on my own callback function
I think this is a great idea! I would certainly benefit from it.

It might be worth considering if there are any methods for passing a
callback function that are better than GET parameters—though I can't
think of any off the top of my head.

H.

On Jun 13, 12:16 am, Alex Kamedov <kame...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex Kamedov  
View profile  
 More options Jun 13 2011, 11:57 pm
From: Alex Kamedov <kame...@gmail.com>
Date: Tue, 14 Jun 2011 09:57:05 +0600
Local: Mon, Jun 13 2011 11:57 pm
Subject: Re: Ability to change dismissRelatedLookupPopup on my own callback function

> It might be worth considering if there are any methods for passing a
> callback function that are better than GET parameters—though I can't
> think of any off the top of my head.

I can't provide better solution too.

I look at the django.contrib.admin source. This can be applied only if 'pop'
argument exists in GET parameters for changelist and  '_popup' argument
exists in GET parameters for adding new item. The changes will be affect to
methods are listed below:

   - django.contrib.admin.options.ModelAdmin.response_add
   - django.contrib.admin.templatetags.admin_list.items_for_result
   - django.contrib.admin.views.main.ChangeList.__init__

Cheers!
--
Alex Kamedov
skype: kamedov    www: kamedov.ru


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gregor Müllegger  
View profile  
 More options Jun 14 2011, 6:29 am
From: Gregor Müllegger <gre...@muellegger.de>
Date: Tue, 14 Jun 2011 12:29:12 +0200
Local: Tues, Jun 14 2011 6:29 am
Subject: Re: Ability to change dismissRelatedLookupPopup on my own callback function
Hi I needed to do the same in my own projects, however I just
decorated the functions which I wanted to modify. Like:

original_dismissRelatedLookupPopup = window.dismissRelatedLookupPopup;
window.dismissRelatedLookupPopup = function () {
    // put your own code here ...
    original_dismissRelatedLookupPopup.apply(this, arguments);

};

Maybe this helps until a way is introduced in django to modify this behaviour.

--
Servus,
Gregor Müllegger

On Jun 13, 2011 4:23 PM, "Harris Lapiroff" <harrislapir...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex Kamedov  
View profile  
 More options Jun 14 2011, 7:18 am
From: Alex Kamedov <kame...@gmail.com>
Date: Tue, 14 Jun 2011 17:18:53 +0600
Local: Tues, Jun 14 2011 7:18 am
Subject: Re: Ability to change dismissRelatedLookupPopup on my own callback function

Thank you for sharing good solution, Gregor!
Your solution works great if you has one related lookup. If you need work
with some related fields you must write more javascript code whitch looks
like mankey patching.

On Tue, Jun 14, 2011 at 4:29 PM, Gregor Müllegger <gre...@muellegger.de>wrote:

--
Alex Kamedov
skype: kamedov    www: kamedov.ru

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex Kamedov  
View profile  
 More options Jun 14 2011, 9:43 pm
From: Alex Kamedov <kame...@gmail.com>
Date: Wed, 15 Jun 2011 07:43:15 +0600
Local: Tues, Jun 14 2011 9:43 pm
Subject: Re: Ability to change dismissRelatedLookupPopup on my own callback function

I create ticket and upload patch.
https://code.djangoproject.com/ticket/16260

--
Alex Kamedov
skype: kamedov    www: kamedov.ru

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »