Example #1
0
    def test_creation(self):
        coll1 = Collection.objects.create(name='Test Collection', owner=self.bob)
        coll2 = Collection.objects.create(name='Test Collection 2', owner=self.alice)
        self.assertEqual(1, Collection.objects(owner=self.bob).count())

        coll1.add_accounts([self.alice, self.jorph])
        coll1.add_accounts([self.alice])
        coll1.add_accounts([self.jorph])
        coll1.save()
        coll1 = Collection.objects.get(name='Test Collection')
        self.assertEqual(2, len(coll1.accounts))

        self.assertEqual(1, len(self.alice.in_collections))
        self.assertEqual(self.alice.in_collections[0].name, 'Test Collection')

        coll2.add_accounts([self.jorph])
        coll2.save()
        self.jorph.save()
        self.assertEqual(1, len(coll2.accounts))

        self.assertEqual(2, len(self.jorph.in_collections))
Example #2
0
    def test_creation(self):
        coll1 = Collection.objects.create(name='Test Collection',
                                          owner=self.bob)
        coll2 = Collection.objects.create(name='Test Collection 2',
                                          owner=self.alice)
        self.assertEqual(1, Collection.objects(owner=self.bob).count())

        coll1.add_accounts([self.alice, self.jorph])
        coll1.add_accounts([self.alice])
        coll1.add_accounts([self.jorph])
        coll1.save()
        coll1 = Collection.objects.get(name='Test Collection')
        self.assertEqual(2, len(coll1.accounts))

        self.assertEqual(1, len(self.alice.in_collections))
        self.assertEqual(self.alice.in_collections[0].name, 'Test Collection')

        coll2.add_accounts([self.jorph])
        coll2.save()
        self.jorph.save()
        self.assertEqual(1, len(coll2.accounts))

        self.assertEqual(2, len(self.jorph.in_collections))
Example #3
0
def lists(request, template_name='youraliss/lists.html'):    
    account =  get_one_or_404(Account, local_id=str(request.user.id))
    objects = Collection.objects(owner=account).order_by('-name')
    template_context = {'account': account, 'objects': objects}
    return render_to_response(template_name, RequestContext(request, template_context))
Example #4
0
def lists(request, template_name='youraliss/lists.html'):
    account =  get_one_or_404(Account, local_id=str(request.user.id))
    objects = Collection.objects(owner=account).order_by('-name')
    template_context = {'account': account, 'objects': objects}
    return render_to_response(template_name, RequestContext(request, template_context))