diff gpp/gcalendar/models.py @ 456:5be072292e2d

Working on #220. Can't test locally, so committing in increments.
author Brian Neal <bgneal@gmail.com>
date Fri, 01 Jul 2011 00:43:44 +0000
parents d77e0dc772ad
children 9a4bffdf37c3
line wrap: on
line diff
--- a/gpp/gcalendar/models.py	Thu Jun 30 02:40:48 2011 +0000
+++ b/gpp/gcalendar/models.py	Fri Jul 01 00:43:44 2011 +0000
@@ -1,5 +1,6 @@
 """
 Models for the gcalendar application.
+
 """
 from django.db import models
 from django.db.models import Q
@@ -18,8 +19,8 @@
         """Returns a queryset of events that have been approved to update
         the Google calendar."""
         return super(PendingEventManager, self).get_query_set().filter(
-                Q(status=Event.NEW_APRV) | \
-                Q(status=Event.EDIT_APRV) | \
+                Q(status=Event.NEW_APRV) |
+                Q(status=Event.EDIT_APRV) |
                 Q(status=Event.DEL_APRV)
             )
 
@@ -98,9 +99,23 @@
 
             forums.tools.create_topic(
                 forum_slug=GIG_FORUM_SLUG,
-                user=self.user, 
+                user=self.user,
                 topic_name=topic_name,
                 post_body=post_body)
 
             self.create_forum_thread = False
             self.save()
+
+
+class AccessToken(models.Model):
+    """
+    This model represents serialized OAuth access tokens for reading and
+    updating the Google Calendar.
+
+    """
+    auth_date = models.DateTimeField()
+    token = models.TextField()
+
+    def __unicode__(self):
+        return u'Access token created on ' + unicode(self.auth_date)
+