Benedict Verheyen schreef:
<snip>
> ====================== ChangeManipulator ======================
> class TeamverslagChangeManipulator(Teamverslag.ChangeManipulator,
> CustomManipulator):
> default = {}
> done = False
>
> def __init__(self,object_id):
> # Construct the fields and set the values in default
> Teamverslag.ChangeManipulator.__init__(self,object_id)
>
> # Assign values of the original object as default
> self.default = self.original_object.__dict__
>
> # Convert creatie date
> date = self.default["creatie_datum"]
>
> if ( date != None and date != '' ):
> date = "%02d/%02d/%04d" % ( date.day, date.month, date.year )
>
> # date is stored in yyyy-mm-dd format so will convert it
> to dd/mm/yyyy
> self.default["creatie_datum"]=date
>
> # Convert verander date
> from types import *
> date = self.default["verander_datum"]
> print "date type ", type(date)
> if ( date != None and date != '' ):
> date = "%02d/%02d/%04d" % ( date.day, date.month, date.year )
>
> # date is stored in yyyy-mm-dd format so will convert it
> to dd/mm/yyyy
> self.default["verander_datum"]=date
>
> ======================== ChangeManipulator =======================
<snip>
Weird thing is that if i comment the first date conversion and leave the
second one to convert the date to dd/mm/yyyy, then it works !
How weird is that!
So it works with one date, but not with 2 dates ?!
Maybe there's an explanation in the model?
class Teamverslag(models.Model):
class Admin:
pass
creatie_datum = models.DateField(auto_now_add=True,blank=False)
verander_datum = models.DateField(auto_now=True, blank=False)
afdeling = models.ForeignKey(Afdeling, blank=False)
patient = models.ForeignKey(Patient, null=False)
opmerking = models.CharField(maxlength=200, blank=False)
def __str__(self):
s = "%s - %s " % (self.verander_datum, str(self.patient_id) )
return s
I saw that there is a filter for templates (|date:"d/m/Y/") but i can't
use it on forms.
Any idea on what is going on?
Thanks
Benedict
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---