On Sep 22, 9:48 am, Szymon wrote:
> On 21 Wrz, 22:47, Javier Guerra wrote:
>
> > only if you include it in the parameter list:
>
> Oh, yes. I forget about self in my example, but in function that makes
> problem there is of course self in parameter list.
I
On 21 Wrz, 22:47, Javier Guerra wrote:
> only if you include it in the parameter list:
Oh, yes. I forget about self in my example, but in function that makes
problem there is of course self in parameter list.
--~--~-~--~~~---~--~~
You received
On Mon, Sep 21, 2009 at 3:29 PM, Szymon wrote:
> Isn't "self" refers to existing object?
only if you include it in the parameter list:
class whatever:
def method (self, moreparams...):
... use 'self' instance...
--
Javier
Yes.
self.bar += c
self.save()
Isn't "self" refers to existing object?
On 21 Wrz, 16:18, phoebebright wrote:
> The code looks like it only handles the case of adding a new foo
> object but your comments refer to "old values". Are you also
> expecting this to work
The code looks like it only handles the case of adding a new foo
object but your comments refer to "old values". Are you also
expecting this to work for an update?
On Sep 21, 7:35 am, Szymon wrote:
> Hello,
>
> I have strange problem. I will give example. I have model:
>
>
Hello,
I have strange problem. I will give example. I have model:
class foo(models.Model)
bar = models.IntegerField()
and method in it
def add_bar(c):
from something.models import bar_log
b = bar_log(foo=self, cnt=c)
b.save()
self.bar += c
self.save()
... and now the problem.
6 matches
Mail list logo