* easy: => 0
Comment:
Hi - I'm just about to start hacking something like this together... any
idea when it might make it into trunk? If there is anything useful I can
do...
--
Ticket URL: <https://code.djangoproject.com/ticket/13165#comment:32>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
Comment (by julien):
Replying to [comment:32 anonymous]:
> Hi - I'm just about to start hacking something like this together... any
idea when it might make it into trunk? If there is anything useful I can
do...
We're approaching the alpha/beta release stages so the earlier one starts
to work on this and the closer one gets to a fully functional and fully
tested code, the higher the chance it has to be included in core. Any
contribution is appreciated ;-)
--
Ticket URL: <https://code.djangoproject.com/ticket/13165#comment:33>
* owner: DrMeers => stefanw
* needs_better_patch: 1 => 0
* status: reopened => new
Comment:
I ported the latest patch to trunk including the following additional
changes:
- CSS names now contain - (dashes) instead of _ (underscores)
- link generation in admin.util.get_changelink_html includes escaping
The related-field-changelink CSS class needs some styling (like vertical-
align: middle or something).
--
Ticket URL: <https://code.djangoproject.com/ticket/13165#comment:34>
* status: new => assigned
* cc: stefanw (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/13165#comment:35>
* needs_better_patch: 0 => 1
Comment:
jezdez commented in irc and disliked the OPs approach of retrieving the
object and wanted the change link to change when a different fk object is
selected.
There is a pull request with some open questions:
https://github.com/django/django/pull/57
--
Ticket URL: <https://code.djangoproject.com/ticket/13165#comment:37>
Comment (by stefanw):
I posted to the django-ux list about this ticket:
https://groups.google.com/forum/#!topic/django-ux/dzkQogwfx4I
--
Ticket URL: <https://code.djangoproject.com/ticket/13165#comment:38>
Comment (by anonymous):
Here's a little something I implemented for a project. It adds the edit /
delete link and enable / disable them when nothing is selected. Plus
saving an object after deleting (via popup) updates the repr of the object
in the select box.
* [http://dl.dropbox.com/u/2759157/empty.png]
* [http://dl.dropbox.com/u/2759157/selected.png]
* [http://www.youtube.com/watch?v=H4xqku-BPBU] A short demo
The code can be found on django snippet at
[http://djangosnippets.org/snippets/2562/]. I think we should consider
adding the delete link also.
--
Ticket URL: <https://code.djangoproject.com/ticket/13165#comment:39>
* cc: dev@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/13165#comment:40>
Comment (by charettes):
Comment comment:39 was me. I packaged a simple app providing admin mixins
to add a the edition and deletion links described above. You can find the
project on [https://github.com/charettes/django-admin-enhancer github] and
on [http://pypi.python.org/pypi/django-admin-enhancer/0.1.0 pypi].
--
Ticket URL: <https://code.djangoproject.com/ticket/13165#comment:41>
* cc: hv@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/13165#comment:42>
* cc: ua_django_bugzilla@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/13165#comment:43>
* owner: stefanw => charettes
Comment:
@stefanw hope you don't mind I assign this ticket to myself but I'm
working on adapting the django-admin-enhancer code to merge it into
Django. You can follow the WIP
[https://github.com/charettes/django/compare/ticket-13165-edit-and-delete-
links here].
--
Ticket URL: <https://code.djangoproject.com/ticket/13165#comment:44>
* cc: danielsamuels (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/13165#comment:45>
Comment (by charettes):
I've been working on this lately and
[https://github.com/charettes/django/compare/ticket-13165-edit-and-delete-
links almost everything is working correctly].
The last missing part concerns foreign keys with `to_field` since there's
no way to retrieve the related object based on the selected `to_field`
value.
We've got two options here:
1. Provides views redirecting to the related object change and delete
views based on the provided `to_field` value;
2. Attach a `data-pk` attribute on all options (in the case of `Select`
widget) or to the raw id input to retrieve.
The second option doesn't seems viable since it's requires a lot of
special casing when dealing with different types of widgets.
The first one should be doable by allowing `ModelAdmin.get_object` to
receive a third parameter specifying which field to retrieve it's model
from.
--
Ticket URL: <https://code.djangoproject.com/ticket/13165#comment:46>
Comment (by charettes):
I opened a [https://github.com/django/django/pull/2104 Pull Request] with
a working implementation of 1.
I'd appreciated feedback on the possible `from_field` attack vector those
changes introduce. One solution would be to restrict allowed `from_field`
values based on current admin site registered models pointing to the
actual model being looked up.
--
Ticket URL: <https://code.djangoproject.com/ticket/13165#comment:47>
Comment (by charettes):
I added the `from_field` [https://github.com/django/django/pull/2104/files
#diff-3c42de3e53aba87b32c494f995a728dfR613 restriction].
--
Ticket URL: <https://code.djangoproject.com/ticket/13165#comment:48>
* cc: cmawebsite@… (added)
--
Ticket URL: <https://code.djangoproject.com/ticket/13165#comment:49>
Comment (by charettes):
Created a PR with the changes. It's only missing documentation and a way
to deal with the two broken public APIs.
--
Ticket URL: <https://code.djangoproject.com/ticket/13165#comment:50>
* needs_better_patch: 1 => 0
Comment:
Added what was missing to ship with 1.8. Review would be greatly
appreciated.
--
Ticket URL: <https://code.djangoproject.com/ticket/13165#comment:51>
* keywords: admin foreign key edit link => admin foreign key edit link
1.8-alpha
--
Ticket URL: <https://code.djangoproject.com/ticket/13165#comment:52>
* status: assigned => closed
* resolution: => fixed
Comment:
In [changeset:"07988744b347302925bc6cc66511e34224db55ab"]:
{{{
#!CommitTicketReference repository=""
revision="07988744b347302925bc6cc66511e34224db55ab"
Fixed #13165 -- Added edit and delete links to admin foreign key widgets.
Thanks to Collin Anderson for the review and suggestions and Tim for the
final review.
}}}
--
Ticket URL: <https://code.djangoproject.com/ticket/13165#comment:53>