Table Of Contents

This Page

Admin interface

admin.py

class files.admin.AttachmentAdmin(model, admin_site)

The default form used for the attachment model in the admin interface.

set_is_private(request, queryset)

Executes an SQL UPDATE on the queryset and sets all objects is_public = False

set_is_public(request, queryset)

Executes an SQL UPDATE on the queryset and sets all objects is_public = True

class files.admin.AttachmentInlines(parent_model, admin_site)

A generic stacked inline admin form which can be used to display attachments for the various models they are attached to.

To enable in the admin interface, add it to the model like this.

Syntax:

from files.admin import AttachmentInlines

class MyModel(admin.ModelAdmin):
    
    inlines = [AttachmentInlines]