I now sort of do what you proposed. I override the init. But for the
attributes that I want to keep track of I create create a property.
Then it's a matter of counting how often it has been accessed. Now I
just need inherit from both Model and DateTimeFieldHelper :)
--
I now sort of do what you proposed. I override the init. But for the
attributes that I want to keep track of I create create a property.
Then it's a matter of counting how often it has been accessed. Now I
just need inherit from both Model and DateTimeFieldHelper :)
--
On Thu, 2007-03-15 at 08:37 +1100, Malcolm Tredinnick wrote:
> On Wed, 2007-03-14 at 20:26 +, Norjee wrote:
> > Imagine the following model:
> >
> > class Article(models.Model):
> > title = models.IntegerField()
> >
> > Then when you do case 1):
> > art = Article.objects.get(pk=1)
> > ar
Thanks, I was hoping I was overlooking some Django internals, but
apparently not ;) I'll just stick to using two queries.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group,
Assuming you've got a 'mydate' attribute:
mydate = models.DateField(null=True)
You can conditionally assign it if null:
import datetime
art = Article.objects.get(pk=1)
if not art.mydate:
art.mydate = datetime.date.today()
art.save()
--
Jeff Bauer
Rubicon, Inc.
--~--~-
On Wed, 2007-03-14 at 20:26 +, Norjee wrote:
> Imagine the following model:
>
> class Article(models.Model):
> title = models.IntegerField()
>
> Then when you do case 1):
> art = Article.objects.get(pk=1)
> art.title = "New title"
> art.save()
>
> or case 2):
> art = Article.objects.get
6 matches
Mail list logo