Commit 0496838e authored by Tim Graham's avatar Tim Graham
Browse files

[1.8.x] Fixed #26387 -- Restored the functionality of the admin's raw_id_fields in list_editable.

Backport of acfaec3d from master
parent 540b487c
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -638,9 +638,9 @@ class ModelAdmin(BaseModelAdmin):
        extra = '' if settings.DEBUG else '.min'
        js = [
            'core.js',
            'admin/RelatedObjectLookups.js',
            'jquery%s.js' % extra,
            'jquery.init.js'
            'jquery.init.js',
            'admin/RelatedObjectLookups.js',
        ]
        if self.actions is not None:
            js.append('actions%s.js' % extra)
+9 −0
Original line number Diff line number Diff line
@@ -128,3 +128,12 @@ function dismissDeleteRelatedObjectPopup(win, objId) {
// Kept for backward compatibility
showAddAnotherPopup = showRelatedObjectPopup;
dismissAddAnotherPopup = dismissAddRelatedObjectPopup;

django.jQuery(function($){
    $(document).ready(function() {
        $('.related-lookup').click(function(e) {
            e.preventDefault();
            showRelatedObjectLookupPopup(this);
        });
    });
});
+0 −4
Original line number Diff line number Diff line
@@ -75,10 +75,6 @@
                    e.preventDefault();
                    showAddAnotherPopup(this);
                });
                $('.related-lookup').click(function(e) {
                    e.preventDefault();
                    showRelatedObjectLookupPopup(this);
                });
            {% if adminform and add %}
                $('form#{{ opts.model_name }}_form :input:visible:enabled:first').focus()
            {% endif %}
+3 −0
Original line number Diff line number Diff line
@@ -15,3 +15,6 @@ Bugfixes

* Fixed data loss on SQLite where ``DurationField`` values with fractional
  seconds could be saved as ``None`` (:ticket:`26324`).

* Restored the functionality of the admin's ``raw_id_fields`` in
  ``list_editable`` (:ticket:`26387`).
+19 −10
Original line number Diff line number Diff line
@@ -33,16 +33,17 @@ from .models import (
    GenRelReference, Grommet, ImplicitlyGeneratedPK, Ingredient,
    InlineReference, InlineReferer, Inquisition, Language, Link,
    MainPrepopulated, ModelWithStringPrimaryKey, NotReferenced, OldSubscriber,
    OtherStory, Paper, Parent, ParentWithDependentChildren, Person, Persona,
    Picture, Pizza, Plot, PlotDetails, PlotProxy, PluggableSearchPerson,
    Podcast, Post, PrePopulatedPost, PrePopulatedPostLargeSlug,
    PrePopulatedSubPost, Promo, Question, Recipe, Recommendation, Recommender,
    ReferencedByGenRel, ReferencedByInline, ReferencedByParent,
    RelatedPrepopulated, Report, Reservation, Restaurant,
    RowLevelChangePermissionModel, Section, ShortMessage, Simple, Sketch,
    State, Story, StumpJoke, Subscriber, SuperVillain, Telegram, Thing,
    Topping, UnchangeableObject, UndeletableObject, UnorderedObject,
    UserMessenger, Villain, Vodcast, Whatsit, Widget, Worker, WorkHour,
    OtherStory, Paper, Parent, ParentWithDependentChildren, ParentWithUUIDPK,
    Person, Persona, Picture, Pizza, Plot, PlotDetails, PlotProxy,
    PluggableSearchPerson, Podcast, Post, PrePopulatedPost,
    PrePopulatedPostLargeSlug, PrePopulatedSubPost, Promo, Question, Recipe,
    Recommendation, Recommender, ReferencedByGenRel, ReferencedByInline,
    ReferencedByParent, RelatedPrepopulated, RelatedWithUUIDPKModel, Report,
    Reservation, Restaurant, RowLevelChangePermissionModel, Section,
    ShortMessage, Simple, Sketch, State, Story, StumpJoke, Subscriber,
    SuperVillain, Telegram, Thing, Topping, UnchangeableObject,
    UndeletableObject, UnorderedObject, UserMessenger, Villain, Vodcast,
    Whatsit, Widget, Worker, WorkHour,
)


@@ -989,5 +990,13 @@ site.register(Group, GroupAdmin)
site2 = admin.AdminSite(name="namespaced_admin")
site2.register(User, UserAdmin)
site2.register(Group, GroupAdmin)
site2.register(ParentWithUUIDPK)
site2.register(
    RelatedWithUUIDPKModel,
    list_display=['pk', 'parent'],
    list_editable=['parent'],
    raw_id_fields=['parent'],
)

site7 = admin.AdminSite(name="admin7")
site7.register(Article, ArticleAdmin2)
Loading