Opened 5 years ago

Closed 5 years ago

Last modified 4 years ago

#13529 closed (fixed)

Documentation Admin Error on Queryset

Reported by: stephane@… Owned by: nobody
Component: Documentation Version: 1.2-beta
Severity: Keywords:
Cc: Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description (last modified by kmtracey)

Change:

class MyModelAdmin(admin.ModelAdmin):
    def queryset(self, request):
        qs = super(self, MyModelAdmin).queryset(request)
        if request.user.is_superuser:
            return qs
        return qs.filter(author=request.user)

By:

class MyModelAdmin(admin.ModelAdmin):
    def queryset(self, request):
        qs = super(MyModelAdmin, self).queryset(request)
        if request.user.is_superuser:
            return qs
        return qs.filter(author=request.user)

Change History (4)

comment:1 Changed 5 years ago by kmtracey

  • Description modified (diff)
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

Fixed formatting; please use preview. Page is: http://docs.djangoproject.com/en/dev/ref/contrib/admin/#django.contrib.admin.ModelAdmin.formfield_for_foreignkey (actually under queryset, next section down, but that doesn't seem to have a permalink anchor). Difference is the order of arguments to super().

comment:2 Changed 5 years ago by russellm

  • Resolution set to fixed
  • Status changed from new to closed

(In [13242]) Fixed #13529 -- Corrected ModelAdmin example. Thanks to stephane@… for the report.

comment:3 Changed 5 years ago by russellm

(In [13243]) [1.1.X] Fixed #13529 -- Corrected ModelAdmin example. Thanks to stephane@… for the report.

Backport of r13242 from trunk.

comment:4 Changed 4 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

Note: See TracTickets for help on using tickets.
Back to Top