Hello.

I am very new to Django and I'm having some problems in overriding the
save method for a simple class. In particular, the following code
(models.py) used against a Mysql database doesn't change the value of
the two date fields when i save the page in admin, while it correctly
changes the value of description. I think I'm doing something
completely wrong, right?

Thanks a lot,
Antonio

import datetime
from django.db import models

class Object(models.Model):
    description = models.CharField(max_length=255)
    insert_date = models.DateTimeField(editable=False)
    update_date = models.DateTimeField(editable=False)

    def save(self):
        if not self.id:
            self.insert_date = datetime.date.today()
        self.update_time = datetime.date.today()
        super(Object, self).save()




--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to