#28871: Autocomplete select for new lines in inline model do not open
-------------------------------------+-------------------------------------
               Reporter:  Marcus     |          Owner:  nobody
  Götling                            |
                   Type:  Bug        |         Status:  new
              Component:             |        Version:  2.0
  contrib.admin                      |       Keywords:  autocomplete
               Severity:  Normal     |  select2
           Triage Stage:             |      Has patch:  0
  Unreviewed                         |
    Needs documentation:  0          |    Needs tests:  0
Patch needs improvement:  0          |  Easy pickings:  0
                  UI/UX:  1          |
-------------------------------------+-------------------------------------
 When a model has an Inline model, autocomplete select does not show for
 new rows.

 Select box is is replaced with Select2 style, but clicking it does not
 show the select list.

 **model.py**
 {{{#!python
 class Item(models.Model):
     name = models.CharField(max_length=100)

 class Category(models.Model):
     name = models.CharField(max_length=100)

     def __str__(self):
         return self.name

 class LineItem(models.Model):
     item = models.ForeignKey(
         'Item',
         on_delete=models.CASCADE
     )
     category = models.ForeignKey(
         'Category',
         on_delete=models.CASCADE
     )
 }}}

 **admin.py**
 {{{#!python
 class LineItemInline(admin.TabularInline):
     model = LineItem
     extra = 1

     autocomplete_fields = ('category',)

 @admin.register(Item)
 class ItemAdmin(admin.ModelAdmin):
     list_display = ('name',)
     search_fields = ('name',)

     inlines = [
         LineItemInline
     ]

 @admin.register(Category)
 class CategoryAdmin(admin.ModelAdmin):
     list_display = ('name',)
     search_fields = ('name',)
 }}}


 == Github repo
 With demo and instructions on how to reproduce

 https://github.com/gotling/bug-django2-autocomplete

-- 
Ticket URL: <https://code.djangoproject.com/ticket/28871>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.

-- 
You received this message because you are subscribed to the Google Groups 
"Django updates" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-updates/050.717846a7b66f518fd2f62742876876ab%40djangoproject.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to