[snowy] Reconfigure model to work better with syncing, tweak view correspondingly



commit 397558f3dc1da47a3d4b1c071ad2c9d2c8e31dbe
Author: Brad Taylor <brad getcoded net>
Date:   Wed May 13 16:55:25 2009 -0400

    Reconfigure model to work better with syncing, tweak view correspondingly
---
 notes/models.py |   13 ++++++++++++-
 notes/views.py  |    2 +-
 2 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/notes/models.py b/notes/models.py
index 1b8f3e4..c178606 100644
--- a/notes/models.py
+++ b/notes/models.py
@@ -23,13 +23,24 @@ class Note(models.Model):
         (0, 'Private'), (1, 'Public'), 
     )
 
+    guid = models.CharField(max_length=36)
     created = models.DateTimeField(auto_now_add=True)
     modified = models.DateTimeField(auto_now=True)
     author = models.ForeignKey(User)
     title = models.CharField(max_length=128)
-    body = models.TextField(blank=True)
+    content = models.TextField(blank=True)
+    content_version = models.CharField(max_length=10)
+    tags = models.ManyToManyField('NoteTag', null=True, blank=True)
     permissions = models.IntegerField(choices=NOTE_PERMISSIONS,
                                       default=0)
 
     def __unicode__(self):
         return self.title
+
+class NoteTag(models.Model):
+    user = models.ForeignKey(User)
+    name = models.CharField(max_length=256)
+    is_notebook = models.BooleanField()
+
+    def __unicode__(self):
+        return self.name
diff --git a/notes/views.py b/notes/views.py
index 4d4f241..dc74eb4 100644
--- a/notes/views.py
+++ b/notes/views.py
@@ -36,7 +36,7 @@ def note_detail(request, note_id,
     
         # libxml2 doesn't munge encodings, so forcibly encode to UTF-8
         # http://mail.gnome.org/archives/xml/2004-February/msg00363.html
-        doc = libxml2.parseDoc(note.body.encode('UTF-8'))
+        doc = libxml2.parseDoc(note.content.encode('UTF-8'))
         result = style.applyStylesheet(doc, None)
     
         # libxml2 doesn't munge encodings, so forcibly decode from UTF-8



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]