Opened 8 years ago

Closed 8 years ago

#28013 closed Bug (needsinfo)

admin/inlines.js has different functionality from admin/inlines.min.js

Reported by: Joseph Solomon Owned by: nobody
Component: contrib.admin Version: 1.10
Severity: Normal Keywords:
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

If you have an inline field in the Django admin that has a name property that only has a getter and no setter, admin/inlines.js will throw an exception and stop adding the new inline (on add clicks). When using admin/inlines.min.js, it does not throw an error and successfully adds the additional row.

I have run into this issue with using django-trix elements.
An example project is here: https://github.com/istrategylabs/trix_test.

This has been tested with Django 1.10.6 and 1.11rc1.

Change History (3)

comment:1 by kapil garg, 8 years ago

I was unable to reproduce the bug. I used the following code. I tried both 'inlines.js' and 'inlines.min.js'

class Parent(models.Model):
    name = models.CharField(max_length=100, default='Father')

class Child(models.Model):
    parent = models.ForeignKey(Parent, on_delete=models.CASCADE)
    name = models.CharField(max_length=100, default='Child')

class ChildAdmin(admin.TabularInline):
	model = Child

@admin.register(Parent)
class ParentAdmin(admin.ModelAdmin):
	inlines = (ChildAdmin,)
	list_display = ('id', 'name')
	fields = ('name',)

Is there any other thing need to do to reproduce the error ?

comment:2 by Tim Graham, 8 years ago

Joseph, ideally the sample project wouldn't involve any third-party JavaScript to rule out some issue there.

If there's some behavior difference in the minified JavaScript, then it might be a bug for the closure compiler that Django uses to generate that code.

comment:3 by Tim Graham, 8 years ago

Resolution: needsinfo
Status: newclosed
Note: See TracTickets for help on using tickets.
Back to Top