
from django.db import models

class NoteManager(models.Manager):
    def user_viewable(self, request_user, author):
        notes = self.filter(author=author)
        if request_user != author:
            # Public notes only
            notes = notes.filter(permissions=1) 
        return notes


from django.db import models

class NoteManager(models.Manager):
    def user_viewable(self, request_user, author, templates=False):
        notes = self.filter(author=author)
        if request_user != author:
            # Public notes only
            notes = notes.filter(permissions=1)
        if not templates:
            notes = notes.exclude(tags__name="system:template")
        return notes

Support hiding note and notebook template notes
Support hiding note and notebook template notes

  
  from django.db import models
  
  class NoteManager(models.Manager):
-     def user_viewable(self, request_user, author):
+     def user_viewable(self, request_user, author, templates=False):
          notes = self.filter(author=author)
          if request_user != author:
              # Public notes only
-             notes = notes.filter(permissions=1) 
+             notes = notes.filter(permissions=1)
+         if not templates:
+             notes = notes.exclude(tags__name="system:template")
          return notes
  
Support hiding note and notebook template notes
## Code Before:

from django.db import models

class NoteManager(models.Manager):
    def user_viewable(self, request_user, author):
        notes = self.filter(author=author)
        if request_user != author:
            # Public notes only
            notes = notes.filter(permissions=1) 
        return notes

## Instruction:
Support hiding note and notebook template notes
## Code After:

from django.db import models

class NoteManager(models.Manager):
    def user_viewable(self, request_user, author, templates=False):
        notes = self.filter(author=author)
        if request_user != author:
            # Public notes only
            notes = notes.filter(permissions=1)
        if not templates:
            notes = notes.exclude(tags__name="system:template")
        return notes
