コード例 #1
0
ファイル: test_tag.py プロジェクト: marcelnicolay/dojo-quatix
 def test_can_create_simple_tag(self):
     
     tag = Tag()
     tag.name = 'shouldBeName'
     tag.slug = 'shouldBeSlug'
     tag.save()
     
     tag_find = Tag.objects.get(name=tag.name)
     self.assertEquals(tag_find.name, tag.name)
     self.assertEquals(tag_find.slug, tag.slug)
     self.assertEquals(tag_find.id, tag.id)
     
     tag.delete()
コード例 #2
0
def delete_orphaned_tags():
    '''
    Cleans up tags that no longer have any page associations.
    '''
    orphaned_tags = Tag.delete().where(
        ~Tag.id << (TagAssociation.select(TagAssociation.tag)))

    orphaned_tags.execute()

    return orphaned_tags
コード例 #3
0
ファイル: cms.py プロジェクト: syegulalp/mercury
def delete_orphaned_tags(blog):
    '''
    Cleans up tags that no longer have any page associations.

    :param blog:
        A blog object used as the context for this cleanup.
    '''
    orphaned_tags = Tag.delete().where(
        Tag.blog == blog,
        ~ Tag.id << (TagAssociation.select(TagAssociation.tag)))

    orphaned_tags.execute()

    return orphaned_tags
コード例 #4
0
ファイル: cms.py プロジェクト: ra2003/mercury
def delete_orphaned_tags(blog):
    '''
    Cleans up tags that no longer have any page associations.

    :param blog:
        A blog object used as the context for this cleanup.
    '''
    orphaned_tags = Tag.delete().where(
        Tag.blog == blog, ~Tag.id <<
        (TagAssociation.select(TagAssociation.tag)))

    orphaned_tags.execute()

    return orphaned_tags