Opened 9 years ago

Closed 9 years ago

#26665 closed Bug (duplicate)

Model field default callable called twice in forms

Reported by: Nitesh Lohchab Owned by: Nitesh Lohchab
Component: Forms Version: 1.9
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 (last modified by Nitesh Lohchab)

callable assigned to default parameter of a field called twice when adding a model entry via admin.

behaviour to reproduce this:


def abc():
    print "this is abc"
    return "abc"


class testt(models.Model):
    text = models.CharField(max_length=12, default=abc)

Now when you try to add this model via admin you will see "this is abc" printed twice in console.

Change History (4)

comment:1 by Nitesh Lohchab, 9 years ago

Description: modified (diff)

comment:2 by Nitesh Lohchab, 9 years ago

Description: modified (diff)

comment:3 by Nitesh Lohchab, 9 years ago

Owner: changed from nobody to Nitesh Lohchab
Status: newassigned

comment:4 by Tim Graham, 9 years ago

Resolution: duplicate
Status: assignedclosed
Summary: default callable called twiceModel field default callable called twice in forms

Likely a duplicate of #11390.

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