Opened 8 years ago

Closed 8 years ago

#4761 closed (fixed)

AttributeError (no filter_vertical at TabularInline or StackedInline)

Reported by: anonymous Owned by: adrian
Component: Forms Version: newforms-admin
Severity: Keywords: inline admin newforms
Cc: eduardo.padoan@… Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: UI/UX:

Description

Example:

class BlogOptions(admin.ModelAdmin):
    list_display = ('title', 'number_of_entries')
    inlines = [admin.TabularInline(Entry, extra=2)]
    prepopulate_fields = {'slug': ('title', 'subtitle')}

admin.site.register(Blog, BlogOptions)

Url admin/app/blog/add/ gives:

AttributeError at /admin/blogfarm/blog/add/
'TabularInline' object has no attribute 'filter_vertical'

it points to the line 112:

 111. # For ManyToManyFields with a filter interface, use a special widget.
 112. if isinstance(db_field, models.ManyToManyField) and db_field.name in (self.filter_vertical + self.filter_horizontal):
 113.     kwargs['widget'] = widgets.FilteredSelectMultiple(db_field.verbose_name, (db_field.name in self.filter_vertical))
 114.     return db_field.formfield(**kwargs)

Got the same error working for StackedInline.

Both Blog and Entry have ManytoManyFields.

Using revision #5596 of the newforms-admin branch.

Change History (2)

comment:1 Changed 8 years ago by anonymous

  • Cc eduardo.padoan@… added
  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset

comment:2 Changed 8 years ago by russellm

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

(In [6025]) newforms-admin: Fixed #4761 -- Moved default definition of filter_horizontal and filter_vertical so that inline edits work with M2M fields.

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