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 "this is abc"
printed twice.
--
Ticket URL: <https://code.djangoproject.com/ticket/26665>
Django <https://code.djangoproject.com/>
The Web framework for perfectionists with deadlines.
* needs_better_patch: => 0
* needs_tests: => 0
* needs_docs: => 0
Old description:
> 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 "this is abc"
> printed twice.
New description:
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 "this is abc"
printed twice.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/26665#comment:1>
Old description:
> 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 "this is abc"
> printed twice.
New description:
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.
--
--
Ticket URL: <https://code.djangoproject.com/ticket/26665#comment:2>
* owner: nobody => dnit
* status: new => assigned
--
Ticket URL: <https://code.djangoproject.com/ticket/26665#comment:3>
* status: assigned => closed
* resolution: => duplicate
Comment:
Likely a duplicate of #11390.
--
Ticket URL: <https://code.djangoproject.com/ticket/26665#comment:4>