Sunday, November 28, 2010

Splitting date and time from Models

Hi all,

Suppose I have this model:
class Job(models.Model):
job_id = models.AutoField(primary_key=True)
job_title = models.CharField(max_length=50, verbose_name =
"Title")
job_desc = models.CharField(max_length=500, verbose_name =
"Description")
active_datetime_fr = models.DateTimeField('time')
active_datetime_to = models.DateTimeField('time')

def editDatefr(self):
return self.active_datetime_fr.date().strftime(DATE_FORMAT)

def editDateto(self):
return self.active_datetime_to.date().strftime(DATE_FORMAT)

def editTimefr(self):
return self.active_datetime_fr.time().strftime(TIME_FORMAT)

def editTimeto(self):
return self.active_datetime_to.time().strftime(TIME_FORMAT)

how do I split active_datetime_fr wherein I need to have an input of
separate date and time
example:
Active Date From:
Date: Time:

Thanks in advance,
Cheers

--
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 django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment