Code

Opened 4 years ago

Closed 4 years ago

Last modified 3 years ago

#13041 closed (worksforme)

Error on InlineModel Admin

Reported by: mdpetry 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: UI/UX:

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

Attachments (0)

Change History (6)

comment:1 Changed 4 years ago by russellm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Triage Stage changed from Unreviewed to Accepted

comment:2 Changed 4 years ago by matiasb

  • Owner changed from nobody to matiasb
  • Status changed from new to assigned

comment:3 Changed 4 years ago by matiasb

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 Changed 4 years ago by humitos

  • 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 Changed 4 years ago by matiasb

  • Resolution set to worksforme
  • Status changed from assigned to closed

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 Changed 3 years ago by jacob

  • milestone 1.2 deleted

Milestone 1.2 deleted

Add Comment

Modify Ticket

Change Properties
<Author field>
Action
as closed
as The resolution will be set. Next status will be 'closed'
The resolution will be deleted. Next status will be 'new'
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.