summaryrefslogtreecommitdiff
path: root/stapp/video/models.py
diff options
context:
space:
mode:
authorParth Buch2012-06-21 18:27:21 +0530
committerParth Buch2012-06-21 18:27:21 +0530
commit3f342f3ac36cfbf1cb68ccb767a76aba327a8326 (patch)
tree2caef218628bcde6728d591f19491a6b8d36e933 /stapp/video/models.py
parentbb1c3bda3a6baad8d8eb9edd2cadf49674972b58 (diff)
downloadstproject-3f342f3ac36cfbf1cb68ccb767a76aba327a8326.tar.gz
stproject-3f342f3ac36cfbf1cb68ccb767a76aba327a8326.tar.bz2
stproject-3f342f3ac36cfbf1cb68ccb767a76aba327a8326.zip
Added created and modified date, passing modules to the home page view
Diffstat (limited to 'stapp/video/models.py')
-rw-r--r--stapp/video/models.py10
1 files changed, 9 insertions, 1 deletions
diff --git a/stapp/video/models.py b/stapp/video/models.py
index aa675b1..56cb5fe 100644
--- a/stapp/video/models.py
+++ b/stapp/video/models.py
@@ -1,5 +1,6 @@
from django.db import models
from django.contrib.auth.models import User
+import datetime
class Video(models.Model):
"""Videos to be uploaded.."""
@@ -14,7 +15,14 @@ class Video(models.Model):
class Module(models.Model):
name = models.CharField(max_length=128)
description = models.TextField()
- vidio_list = models.ManyToManyField(Video)
+ video_list = models.ManyToManyField(Video)
+ created = models.DateTimeField(auto_now_add=True)
+ modified = models.DateTimeField()
+
+ def save(self, *args, **kwargs):
+ ''' On save, update timestamps '''
+ self.modified = datetime.datetime.today()
+ super(Module, self).save(*args, **kwargs)
def __unicode__(self):
return self.name