Re: [Django] #7028: Better raw_id_fields feedback in newform-admins branch

65 views
Skip to first unread message

Django

unread,
Jun 7, 2011, 4:39:37 PM6/7/11
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: new
Type: New | Component: contrib.admin
feature | Severity: Normal
Milestone: | Keywords: raw-id-fields nfa-
Version: SVN | someday design_ux
Resolution: | Has patch: 1
Triage Stage: Accepted | Needs tests: 1
Needs documentation: 0 | Easy pickings: 0
Patch needs improvement: 1 |
-------------------------------------+-------------------------------------
Changes (by davenaff):

* cc: davenaff@… (added)
* easy: => 0


--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:57>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

Django

unread,
Jun 7, 2011, 4:41:55 PM6/7/11
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: new
Type: New | Component: contrib.admin
feature | Severity: Normal
Milestone: | Keywords: raw-id-fields nfa-
Version: SVN | someday design_ux
Resolution: | Has patch: 1
Triage Stage: Accepted | Needs tests: 1
Needs documentation: 0 | Easy pickings: 1
Patch needs improvement: 1 |
-------------------------------------+-------------------------------------
Changes (by davenaff):

* easy: 0 => 1


Comment:

Hmm, just meant to add me to cc list - didn't mean to change easy
pickings. Setting easy pickings.

--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:58>

Django

unread,
Jun 7, 2011, 5:54:20 PM6/7/11
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: new
Type: New | Component: contrib.admin
feature | Severity: Normal
Milestone: | Keywords: raw-id-fields nfa-
Version: SVN | someday design_ux
Resolution: | Has patch: 1
Triage Stage: Accepted | Needs tests: 1
Needs documentation: 0 | Easy pickings: 0
Patch needs improvement: 1 |
-------------------------------------+-------------------------------------
Changes (by lukeplant):

* easy: 1 => 0


Comment:

Hmm, that message is confusing lots of people. (it was technically 'null'
before, which counts as 'false', which was correct, but then your update
forced it to be explicitly 'false' i.e. unset, which was still correct.
Until you toggled it :-)

--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:59>

Django

unread,
Aug 8, 2011, 7:47:20 AM8/8/11
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: new
Type: New | Component: contrib.admin
feature | Severity: Normal
Milestone: | Keywords: raw-id-fields nfa-
Version: SVN | someday design_ux
Resolution: | Has patch: 1
Triage Stage: Accepted | Needs tests: 1
Needs documentation: 0 | Easy pickings: 0
Patch needs improvement: 1 |
UI/UX: 1 |
-------------------------------------+-------------------------------------

Comment (by Stanislas Guerra <stan__at__slashdev.me>):

Patch against trunk added.

--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:61>

Django

unread,
Aug 8, 2011, 8:43:40 AM8/8/11
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: new
Type: New | Component: contrib.admin
feature | Severity: Normal
Milestone: | Keywords: raw-id-fields nfa-
Version: SVN | someday design_ux
Resolution: | Has patch: 1
Triage Stage: Accepted | Needs tests: 1
Needs documentation: 0 | Easy pickings: 0
Patch needs improvement: 1 |
UI/UX: 1 |
-------------------------------------+-------------------------------------

Comment (by ramiro):

Latest path is using !AdminSite's `root_path` that doesn't exit anymore
(see r16575). Also, I don't like it is reintroducing using
`'../../..'`-style paths we are trying to move away from (see r16578,
#15294)

--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:62>

Django

unread,
Aug 24, 2011, 12:07:07 PM8/24/11
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: new
Type: New | Component: contrib.admin
feature | Severity: Normal
Milestone: | Keywords: raw-id-fields nfa-
Version: SVN | someday design_ux
Resolution: | Has patch: 1
Triage Stage: Accepted | Needs tests: 1
Needs documentation: 0 | Easy pickings: 0
Patch needs improvement: 1 |
UI/UX: 1 |
-------------------------------------+-------------------------------------

Comment (by Stan <stan__at__slashdev.me>):

Replying to [comment:62 ramiro]:

> Latest path is using !AdminSite's `root_path` that doesn't exit anymore
(see r16575). Also, I don't like it is reintroducing using
`'../../..'`-style paths we are trying to move away from (see r16578,
#15294)

The latest patch is `root_path` and `../..` free.

--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:63>

Django

unread,
Sep 16, 2011, 4:12:13 AM9/16/11
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: new
Type: New | Component: contrib.admin
feature | Severity: Normal
Milestone: | Keywords: raw-id-fields nfa-
Version: SVN | someday design_ux
Resolution: | Has patch: 1
Triage Stage: Accepted | Needs tests: 1
Needs documentation: 0 | Easy pickings: 0
Patch needs improvement: 1 |
UI/UX: 1 |
-------------------------------------+-------------------------------------

Comment (by julien):

This looks really good! However, it really needs to support
`ManyToManyFields` before it can be included in core. A list builder
widget, as specified in `[1]`, could be a nice solution.

`[1]` http://wiki.jqueryui.com/w/page/12137993/ListBuilder

--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:64>

Django

unread,
Sep 29, 2011, 4:48:06 AM9/29/11
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: new
Type: New feature | Version: SVN
Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: raw-id-fields nfa- | Needs documentation: 0
someday design_ux | Patch needs improvement: 1
Has patch: 1 | UI/UX: 1
Needs tests: 1 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by julien):

See also #10293 re: ManyToMany raw_id_fields.

--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:65>

Django

unread,
Sep 30, 2011, 10:49:20 AM9/30/11
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: new
Type: New feature | Version: SVN
Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: raw-id-fields nfa- | Needs documentation: 0
someday design_ux | Patch needs improvement: 1
Has patch: 1 | UI/UX: 1
Needs tests: 1 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by carlospalol):

* cc: carlos.palol@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:66>

Django

unread,
Oct 12, 2011, 3:46:00 AM10/12/11
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: new
Type: New feature | Version: SVN
Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: raw-id-fields nfa- | Needs documentation: 0
someday design_ux | Patch needs improvement: 1
Has patch: 1 | UI/UX: 1
Needs tests: 1 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by Stanislas <stan@…>):

* cc: stan@… (added)


Comment:

Replying to [comment:64 julien]:

> This looks really good! However, it really needs to support
`ManyToManyFields` before it can be included in core. A list builder
widget, as specified in `[1]`, could be a nice solution.
>
> `[1]` http://wiki.jqueryui.com/w/page/12137993/ListBuilder


That's nice indeed but for the sake of consistency the same interface
should also be ported to the ForeignKey's raw_id. This mean to completely
rethink this patch.

And what about the non-javascript users ?

Merging #10293 looks more reasonable and simpler to me.

But I like the idea of an auto-completion (and so my users) !

--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:67>

Django

unread,
Oct 12, 2011, 8:52:25 AM10/12/11
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: new
Type: New feature | Version: SVN
Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: raw-id-fields nfa- | Needs documentation: 0
someday design_ux | Patch needs improvement: 1
Has patch: 1 | UI/UX: 1
Needs tests: 1 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by Stanislas <stan@…>):

ManyToMany raw_id_field: Maybe we could add a "Clear" button for each
labeled object in order to javascriptly remove its Id in the input ?

--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:68>

Django

unread,
Nov 9, 2011, 7:22:14 AM11/9/11
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: new
Type: New feature | Version: SVN
Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: raw-id-fields nfa- | Needs documentation: 0
someday design_ux | Patch needs improvement: 1
Has patch: 1 | UI/UX: 1
Needs tests: 1 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by Twidi):

* cc: Twidi (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:69>

Django

unread,
Mar 9, 2013, 2:05:58 PM3/9/13
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: new
Type: New feature | Version: master

Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: raw-id-fields nfa- | Needs documentation: 0
someday design_ux | Patch needs improvement: 1
Has patch: 1 | UI/UX: 1
Needs tests: 1 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by anonymous):

This patch looks great!

What's the status of this patch? Is any work being done to include it in
core?

Thanks a lot!

--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:70>

Django

unread,
Mar 26, 2013, 12:07:14 PM3/26/13
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: new
Type: New feature | Version: master
Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: raw-id-fields nfa- | Needs documentation: 0
someday design_ux | Patch needs improvement: 1
Has patch: 1 | UI/UX: 1
Needs tests: 1 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by jacob):

#10293 was a dup.

--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:71>

Django

unread,
Apr 3, 2013, 12:52:18 PM4/3/13
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: new
Type: New feature | Version: master
Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: raw-id-fields nfa- | Needs documentation: 0
someday design_ux | Patch needs improvement: 1
Has patch: 1 | UI/UX: 1
Needs tests: 1 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by Stan@…):

Add patch against 1.4.5.

Fix a bug contrib.admin.ManyToManyRawIdWidget#label_for_value(self, value,
name) when value was empty.

--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:72>

Django

unread,
May 28, 2013, 12:09:37 PM5/28/13
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: new
Type: New feature | Version: master
Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: raw-id-fields nfa- | Needs documentation: 0
someday design_ux | Patch needs improvement: 1
Has patch: 1 | UI/UX: 1
Needs tests: 1 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by Stanislas):

Fixed `Clear' button malfunction in admin raw_id fields.

Github branch : https://github.com/Starou/django/tree/ticket_7028_1_4

--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:73>

Django

unread,
Jun 8, 2013, 7:50:09 PM6/8/13
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: new
Type: Uncategorized | Version: master

Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage:
Keywords: raw-id-fields nfa- | Unreviewed
someday design_ux | Needs documentation: 1
Has patch: 1 | Patch needs improvement: 1
Needs tests: 1 | UI/UX: 1
Easy pickings: 1 |
-------------------------------------+-------------------------------------
Changes (by ogpcludi <sample@…>):

* needs_docs: 0 => 1
* type: New feature => Uncategorized


* easy: 0 => 1

* stage: Accepted => Unreviewed


Comment:

1

--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:74>

Django

unread,
Jun 8, 2013, 7:50:09 PM6/8/13
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: closed
Type: Uncategorized | Version: master
Component: contrib.admin | Resolution: fixed

Severity: Normal | Triage Stage:
Keywords: raw-id-fields nfa- | Unreviewed
someday design_ux | Needs documentation: 1
Has patch: 1 | Patch needs improvement: 1
Needs tests: 1 | UI/UX: 1
Easy pickings: 1 |
-------------------------------------+-------------------------------------
Changes (by ogpcludi <sample@…>):

* status: new => closed


* type: New feature => Uncategorized

* resolution: => fixed


Comment:

1

--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:75>

Django

unread,
Jun 8, 2013, 7:58:52 PM6/8/13
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: closed
Type: Uncategorized | Version: master
Component: contrib.admin | Resolution: fixed
Severity: Normal | Triage Stage:
Keywords: raw-id-fields nfa- | Unreviewed
someday design_ux | Needs documentation: 1
Has patch: 1 | Patch needs improvement: 1
Needs tests: 1 | UI/UX: 1
Easy pickings: 1 |
-------------------------------------+-------------------------------------

Comment (by ogpcludi <sample@…>):

1

--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:76>

Django

unread,
Jun 8, 2013, 7:58:52 PM6/8/13
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: closed
Type: Uncategorized | Version: master
Component: contrib.admin | Resolution: fixed
Severity: Normal | Triage Stage:
Keywords: raw-id-fields nfa- | Unreviewed
someday design_ux | Needs documentation: 1
Has patch: 1 | Patch needs improvement: 1
Needs tests: 1 | UI/UX: 1
Easy pickings: 1 |
-------------------------------------+-------------------------------------

Comment (by ogpcludi <sample@…>):

1

--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:77>

Django

unread,
Aug 6, 2013, 2:15:46 AM8/6/13
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: new
Type: New feature | Version: master
Component: contrib.admin | Resolution:

Severity: Normal | Triage Stage: Accepted
Keywords: raw-id-fields nfa- | Needs documentation: 0
someday design_ux | Patch needs improvement: 1
Has patch: 1 | UI/UX: 1
Needs tests: 1 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by julien):

I've worked on a reasonably straightforward implementation (1) for this
inspired from DrMeers' "cooked_ids" (2). I've also written a number of
selenium tests. It has the advantage of preserving raw_id_fields if you
still want them (for whatever reason), while allowing you to use the more
user-friendly version (here called "token_fields").

The main piece that's still missing from this implementation is the
ability to work with non-integer primary keys.

Any feedback?

(1) https://bitbucket.org/drmeers/django-
generic/src/bd20113dce83a5ba6db30a96f0493b93e3aeea17/generic/admin/mixins/cooking.py
(2)
https://github.com/jphalip/django/compare/django:04489c7dbf8f69de84ca272a0a1710e7b6067e9d...ticket-7028
-token-fields

--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:74>

Django

unread,
Sep 5, 2013, 6:32:25 AM9/5/13
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: new
Type: New feature | Version: master
Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: raw-id-fields nfa- | Needs documentation: 0
someday design_ux | Patch needs improvement: 1
Has patch: 1 | UI/UX: 1
Needs tests: 1 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by stanislas.guerra@…):

@Julien : I have backported your patch to 1.5.x and tested it. The concern
I have is about the lack of the hyperlink to *admin_change* (but maybe it
is safer to not provide it rather provide it badly (i.e. permission
check)) and the clean button for the ForeignKey.

Anyway, looks good to me !

--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:75>

Django

unread,
Sep 5, 2013, 6:39:16 AM9/5/13
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: new
Type: New feature | Version: master
Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: raw-id-fields nfa- | Needs documentation: 0
someday design_ux | Patch needs improvement: 1
Has patch: 1 | UI/UX: 1
Needs tests: 1 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by stanislas.guerra@…):

For those interested :

https://github.com/Starou/django/compare/django:stable/1.5.x...ticket_7028_1_5_jphalip?expand=1

--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:76>

Django

unread,
Sep 18, 2013, 5:15:25 AM9/18/13
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: new
Type: New feature | Version: master
Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: raw-id-fields nfa- | Needs documentation: 0
someday design_ux | Patch needs improvement: 1
Has patch: 1 | UI/UX: 1
Needs tests: 1 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by stanislas.guerra@…):

Replying to [comment:75 stanislas.guerra@…]:
> [...] and the clean button for the ForeignKey.
>

My mistake, the clean button is there.


> Anyway, looks good to me !

--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:77>

Django

unread,
Sep 18, 2013, 11:09:29 AM9/18/13
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: new
Type: New feature | Version: master
Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: raw-id-fields nfa- | Needs documentation: 0
someday design_ux | Patch needs improvement: 1
Has patch: 1 | UI/UX: 1
Needs tests: 1 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------

Comment (by stanislas.guerra@…):

But this does not works with inlines. Using {{{token_fields}}} into an
{{{InlineModelAdmin}}} gives 404 in ajax call to render the FK unicode().

For example, I have added in the test the following models:


{{{
class TicketDealer(models.Model):
name = models.CharField(blank=False, max_length=20)
website = models.URLField(blank=True)

def __unicode__(self):
return self.name

class TokenFieldTicketDealerEvent(models.Model):
"""
A model that has token fields in the admin inline.
"""
dealer = models.ForeignKey(TicketDealer)
event = models.ForeignKey(TokenFieldEvent)

}}}

And the admin:

{{{
class TokenFieldTicketDealerEventAdminInline(admin.StackedInline):
model = models.TokenFieldTicketDealerEvent
token_fields = ('dealer',)

class TokenFieldEventAdmin(admin.ModelAdmin):
token_fields = ['main_band', 'supporting_bands']
inlines = (TokenFieldTicketDealerEventAdminInline,)
}}}

With the TestCase:

{{{
@override_settings(PASSWORD_HASHERS=('django.contrib.auth.hashers.SHA1PasswordHasher',))
class
AdminInlineTokenWidgetSeleniumFirefoxTests(AdminSeleniumWebDriverTestCase):
available_apps = ['admin_widgets'] +
AdminSeleniumWebDriverTestCase.available_apps
fixtures = ['admin-widgets-users.xml']
urls = "admin_widgets.urls"
webdriver_class = 'selenium.webdriver.firefox.webdriver.WebDriver'

def setUp(self):
band = models.Band.objects.create(id=42, name='Bogey Blues')
event = models.TokenFieldEvent.objects.create(id=11,
main_band=band)
dealer1 = models.TicketDealer.objects.create(id=12, name="Cheap
Horse", website="www.ch.com")
dealer2 = models.TicketDealer.objects.create(id=21, name="Decent
Buy", website="www.db.com")
models.TokenFieldTicketDealerEvent.objects.create(event=event,
dealer=dealer1)
super(AdminInlineTokenWidgetSeleniumFirefoxTests, self).setUp()

def test_foreignkey(self):
self.admin_login(username='super', password='secret',
login_url='/')
self.selenium.get(
'%s%s' % (self.live_server_url,
'/admin_widgets/tokenfieldevent/11/'))
main_window = self.selenium.current_window_handle
}}}

It fires ''http://localhost:8081/admin_widgets/tokenfieldevent/objects-by-
ids/tokenfieldticketdealerevent_set-0-dealer/12/'' -> 404

I though it was just a bug in retrieving the field name into
RelatedObjectLookups.js#updateTokenField() and had it patched like that:

{{{
diff --git
a/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js
b/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js
index 5d8a19c..b333cfd 100644
--- a/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js
+++ b/django/contrib/admin/static/admin/js/admin/RelatedObjectLookups.js
@@ -108,7 +108,7 @@ var updateTokenField = function(field) {
var $field = $(field);
$field.hide();
var container = $field.closest('div');
- var field_name = $field.attr('name');
+ var field_name = getTokenFieldName(field);
var pks = encodeURI($field.val());
if (pks) {
var objects_url = '../objects-by-ids/' + field_name + '/' + pks +
'/'; // FIXME: hard-coded url
@@ -128,6 +128,18 @@ var updateTokenField = function(field) {
}
};

+var getTokenFieldName = function(field) {
+ // inline fields are prefixed.
+ var $ = django.jQuery;
+ var $field = $(field);
+ var rx_prefix = new RegExp("\\\w+-\\\d{1,2}-\(\\\w+\)");
+ var field_name = $field.attr('name');
+ if (field_name.match(rx_prefix)) {
+ field_name = field_name.match(rx_prefix)[1];
+ }
+ return field_name;
+}
+
var removeToken = function(removeLink, field) {
var $ = django.jQuery;
var li = $(removeLink).parent();
}}}

Now It fires an Ajax call to
''http://localhost:8081/admin_widgets/tokenfieldevent/objects-by-
ids/dealer/12/'' -> 404, ''dealer'' not in
''TokenFieldEventAdmin.token_fields''.
This is because in RelatedOjectLookup.js (l.158) the ajax call is on
''../objects-by-ids/et/caetera/'' which is in the "path" of the parent
ModelAdmin.
In fact, there is not any url to call at this point because
{{{InlineModelAdmin}}} can't register any url.

Any idea on the direction to take ? allow InlineModelAdmin to register url
? Where (under its ModelAdmin or not) ?

Thanks.

--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:78>

Django

unread,
May 22, 2014, 9:51:27 AM5/22/14
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: new
Type: New feature | Version: master
Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: raw-id-fields nfa- | Needs documentation: 0
someday design_ux | Patch needs improvement: 1
Has patch: 1 | UI/UX: 1
Needs tests: 1 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by depaolim):

* cc: depaolim@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:79>

Django

unread,
Oct 4, 2014, 10:17:29 PM10/4/14
to django-...@googlegroups.com
#7028: Better raw_id_fields feedback in newform-admins branch
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: new
Type: New feature | Version: master
Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: raw-id-fields nfa- | Needs documentation: 0
someday design_ux raw_id_fields | Patch needs improvement: 1

Has patch: 1 | UI/UX: 1
Needs tests: 1 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------
Changes (by collinanderson):

* keywords: raw-id-fields nfa-someday design_ux => raw-id-fields nfa-
someday design_ux raw_id_fields


--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:80>

Django

unread,
Oct 4, 2014, 10:19:02 PM10/4/14
to django-...@googlegroups.com
#7028: Better admin raw_id_fields feedback

-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> | Status: new
Type: New feature | Version: master
Component: contrib.admin | Resolution:
Severity: Normal | Triage Stage: Accepted
Keywords: raw-id-fields nfa- | Needs documentation: 0
someday design_ux raw_id_fields | Patch needs improvement: 1
Has patch: 1 | UI/UX: 1
Needs tests: 1 |
Easy pickings: 0 |
-------------------------------------+-------------------------------------

--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:81>

Django

unread,
Jan 26, 2015, 12:37:58 PM1/26/15
to django-...@googlegroups.com
#7028: Better admin raw_id_fields feedback
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> |
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: raw-id-fields nfa- | Triage Stage: Accepted
someday design_ux raw_id_fields |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by collinanderson):

* cc: cmawebsite@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:82>

Django

unread,
Jan 27, 2016, 6:31:19 PM1/27/16
to django-...@googlegroups.com
#7028: Better admin raw_id_fields feedback
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> |
Type: New feature | Status: new
Component: contrib.admin | Version: master
Severity: Normal | Resolution:
Keywords: raw-id-fields nfa- | Triage Stage: Accepted
someday design_ux raw_id_fields |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by hobarrera):

* cc: hugo@… (added)


--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:83>

Django

unread,
Sep 22, 2016, 8:13:04 PM9/22/16
to django-...@googlegroups.com
#7028: Better admin raw_id_fields feedback
-------------------------------------+-------------------------------------
Reporter: Marcob | Owner: nobody
<marcoberi@…> |
Type: New feature | Status: closed
Component: contrib.admin | Version: master
Severity: Normal | Resolution: wontfix

Keywords: raw-id-fields nfa- | Triage Stage: Accepted
someday design_ux raw_id_fields |
Has patch: 1 | Needs documentation: 0
Needs tests: 1 | Patch needs improvement: 1
Easy pickings: 0 | UI/UX: 1
-------------------------------------+-------------------------------------
Changes (by Tim Graham):

* status: new => closed

* resolution: => wontfix


Comment:

I think it doesn't make sense to add this enhancement while also adding a
new autocomplete widget (#14370). After the autocomplete widget is added,
we might deprecate `raw_id_fields` in some later release.

--
Ticket URL: <https://code.djangoproject.com/ticket/7028#comment:84>

Reply all
Reply to author
Forward
0 new messages