Opened 15 years ago

Closed 15 years ago

Last modified 13 years ago

#13041 closed (worksforme)

Error on InlineModel Admin

Reported by: Marcos Daniel Petry Owned by: matiasb
Component: contrib.admin Version: 1.1
Severity: Keywords:
Cc: humitos@… Triage Stage: Accepted
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

There is an error in the javascript that renders the buttons of InlineAdmin Forms:

When you have more than one inline in the AdminForm, and one of them has a DateField or DateTimeField, the javascript renders the calendar widget for all of these fields everytime when the button "add item" is clicked

Sorry about my english, in this link[1] has an image that represent this bug

http://img27.imageshack.us/img27/8734/djangoerror.png

Change History (6)

comment:1 by Russell Keith-Magee, 15 years ago

Triage Stage: UnreviewedAccepted

comment:2 by matiasb, 15 years ago

Owner: changed from nobody to matiasb
Status: newassigned

comment:3 by matiasb, 15 years ago

After some debugging, I found it is a problem with the browser's cache and the javascript code.

I created a sample app as described above. When running it in a project using django trunk, I noticed no problem. Then, I installed the app in a django 1.1 site (as the version reported in the ticket is 1.1), and in the admin section the action links for date fields were showing wrong, but with a hard refresh it was solved. After that, I ran again the project under trunk version, and finally that triggered the error reported. However, with a hard refresh everything worked perfectly well.

This means it could be a problem related with cache of the admin javascript files for different django versions. I think it should be closed as invalid.

comment:4 by Manuel Kaufmann, 15 years ago

Cc: humitos@… added

I test this issue too, but I had different "". I created a sample app like this:

models.py

from django.db import models

# Create your models here.

class MyModel(models.Model):
    date = models.DateField()

class OtherModel(models.Model):
    mymodel = models.ForeignKey(MyModel)
    name = models.CharField(max_length=50)

class AnotherInlineModel(models.Model):
    mymode = models.ForeignKey(MyModel)
    date = models.DateField()
    another_date = models.DateField()
    name = models.CharField(max_length=25)

admin.py

from django.contrib import admin

from models import *

class OtherModelAdmin(admin.TabularInline):
    model = OtherModel
    #date_hierachy = 'date'

class AnotherInlineModelAdmin(admin.TabularInline):
    model = AnotherInlineModel
    #date_hierachy = 'date'

class MyModelAdmin(admin.ModelAdmin):
    inlines = [
       OtherModelAdmin,
       AnotherInlineModelAdmin,
    ]

admin.site.register(MyModel, MyModelAdmin)
admin.site.register(OtherModel, OtherModelAdmin)

I've created a virtualenv to use Django 1.1 and I can't see the button link Add another...

But, if I use Django trunk (1.2 beta 1) I can see the link and everything work correctly.

I think that this ticket isn't a bug.

comment:5 by matiasb, 15 years ago

Resolution: worksforme
Status: assignedclosed

I couldn't reproduce the bug (except for what stated in the comment above). You should provide additional information if you see the problem persists.

comment:6 by Jacob, 13 years ago

milestone: 1.2

Milestone 1.2 deleted

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