Opened 13 years ago
Closed 13 years ago
#18420 closed Uncategorized (fixed)
JavaScript crashes in django admin for translation inlines in some circumstances
Reported by: | Owned by: | nobody | |
---|---|---|---|
Component: | contrib.admin | Version: | 1.4 |
Severity: | Normal | Keywords: | javascript |
Cc: | Triage Stage: | Unreviewed | |
Has patch: | no | Needs documentation: | no |
Needs tests: | no | Patch needs improvement: | no |
Easy pickings: | no | UI/UX: | no |
Description
This issue is close to #10651.
I use here FeinCMS but I'm sure it's Django bug not Feincms bug.
Models of my app integrated as Aplication Content look like:
class Plant(models.Model, TranslatedObjectMixin): class Meta: verbose_name = _('Performance') class PlantTranslation(Translation(Plant)): title = models.CharField(max_length=255, verbose_name=_('Performance Title')) slug = models.SlugField() description = models.TextField(max_length=2000) class Meta: verbose_name = _('Peformance Translation') def __unicode__(self): return '%s' % (self.title,)
admin.py
class PlantAdmin(admin.ModelAdmin): inlines = [admin_translationinline(PlantTranslation)]
As you can see in django admin I only have inline forms for each translation because translated object itself doesn't have any fields.
JavaScript crashes at django/contrib/admin/templates/admin/change_form.html on line 70.
It renders this line as:
<script type="text/javascript">document.getElementById("").focus();</script>
so I get an JS error. It would be nice that JS check first if there's existing field which it can focus on.
Attachments (2)
Change History (4)
by , 13 years ago
Attachment: | django_admin_first_field_focus.diff added |
---|
comment:1 by , 13 years ago
comment:2 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
That patch looks like it'll throw a TemplateSyntaxError on the if statement, as the test terminates on 'and' rather than 'and add'