GNOME Bugzilla – Bug 612025
Notebook templates should not appear in sidebar note list
Last modified: 2011-01-18 03:23:16 UTC
There should be a good way to view/edit notebook template notes, but they should not show up in the list of recent notes (just like with Tomboy's menu).
If someone wants a quick and dirty way of hiding all these notebook templates clobbering the list, I've pushed a patch at http://github.com/bgarret/snowy.git . I'd be happy to work on something more elaborate, but it would be quite useless for now as snowy can't edit notes (yet ;-) ).
Just reading the code, this looks good, except that I think the new field should be "is_template", not "is_notebook_template", since there is also a general template note that is not notebook-specific. I'll need to apply the commits to test out the behavior, though.
So since I'm not familiar with South, to use this patch I had to update my database like so: sqlite3 snowy.db alter table notes_note add column "is_notebook_template" bool NOT NULL DEFAULT False Checking in the admin tool, all notes were indeed set with is_notebook_template=False, but when trying to view my notes, none were displayed. I haven't had a chance to dig in and figure out why yet. As for the other commit that shows which notebook a note belongs to, I'll keep discussion of that in bug #613881.
The notes not being displayed happens to me as well and I can't figure out why. A workaround is to save all notes using the django console, everything shows up fine afterwards: benoit@benoit-laptop:~/code/checkouts/snowy.eclipse/snowy$ ./manage.py shell Python 2.6.5 (r265:79063, Apr 3 2010, 01:57:29) [GCC 4.4.3] on linux2 Type "help", "copyright", "credits" or "license" for more information. (InteractiveConsole) >>> from snowy.notes.models import Note >>> for note in Note.objects.all(): ... note.save() I looked into using south to do the migration, but it didn't look trivial as (at least) the autoslug library doesn't support it out of the box.
Created attachment 177084 [details] [review] Don't display Note / Notebook Template notes I didn't have any internet on the flight home and remembered this was a bug. Instead of an additional database column, I opted to use Q objects and a slightly more complex query.
Review of attachment 177084 [details] [review]: ::: notes/managers.py @@ +26,3 @@ + if not templates: + Q = models.Q + query = ~Q(title__endswith="Notebook Template") & ~Q(title__exact="New Note Template") This check is incorrect. The proper check is to look for the system:template tag.
Created attachment 178577 [details] [review] Version 2 for hiding note templates Version 2: - exclude notes including the NoteTag system:template in the Note.user_viewable manager - make this the default functionality
Review of attachment 178577 [details] [review]: Cool.