def test_01_prefilled_attributes(self): self.create_entry() # This should return silently objects = prefill_entry_list(Entry.objects.none(), 'rawcontent_set', 'categories') objects = prefill_entry_list(Entry.objects.published(), 'rawcontent_set', 'categories') self.assertEqual(len(objects[0]._prefill_categories), 0) self.assertEqual(len(objects[0]._prefill_rawcontent_set), 1) self.assertEqual(unicode(objects[0]), 'Something') objects = Entry.objects.published() self.assertEqual(len(objects[0].prefilled_categories), 0) self.assertEqual(len(objects[0].prefilled_rawcontent_set), 1) objects = prefill_entry_list(Entry.objects.published(), 'rawcontent_set', 'categories', region='another') self.assertEqual(len(objects[0]._prefill_categories), 0) self.assertEqual(len(objects[0]._prefill_rawcontent_set), 0) self.login() self.assertEqual(self.client.get('/admin/blog/entry/').status_code, 200) self.assertEqual(self.client.get('/admin/blog/entry/1/').status_code, 200)
def test_01_prefilled_attributes(self): self.create_entry() # This should return silently objects = prefill_entry_list(Entry.objects.none(), "rawcontent_set", "categories") objects = prefill_entry_list(Entry.objects.published(), "rawcontent_set", "categories") self.assertEqual(len(objects[0]._prefill_categories), 0) self.assertEqual(len(objects[0]._prefill_rawcontent_set), 1) self.assertEqual(unicode(objects[0]), "Something") objects = Entry.objects.published() self.assertEqual(len(objects[0].prefilled_categories), 0) self.assertEqual(len(objects[0].prefilled_rawcontent_set), 1) objects = prefill_entry_list(Entry.objects.published(), "rawcontent_set", "categories", region="another") self.assertEqual(len(objects[0]._prefill_categories), 0) self.assertEqual(len(objects[0]._prefill_rawcontent_set), 0) self.login() assert self.client.get("/admin/blog/entry/").status_code == 200 assert self.client.get("/admin/blog/entry/1/").status_code == 200
def test_01_prefilled_attributes(self): self.create_entry() # This should return silently objects = prefill_entry_list(Entry.objects.none(), 'rawcontent_set', 'categories') objects = prefill_entry_list(Entry.objects.published(), 'rawcontent_set', 'categories') self.assertEqual(len(objects[0]._prefill_categories), 0) self.assertEqual(len(objects[0]._prefill_rawcontent_set), 1) self.assertEqual(unicode(objects[0]), 'Something') objects = Entry.objects.published() self.assertEqual(len(objects[0].prefilled_categories), 0) self.assertEqual(len(objects[0].prefilled_rawcontent_set), 1) objects = prefill_entry_list(Entry.objects.published(), 'rawcontent_set', 'categories', region='another') self.assertEqual(len(objects[0]._prefill_categories), 0) self.assertEqual(len(objects[0]._prefill_rawcontent_set), 0) self.login() self.assertEqual( self.client.get('/admin/blog/entry/').status_code, 200) self.assertEqual( self.client.get('/admin/blog/entry/1/').status_code, 200)
def feincms_prefill_entry_list(queryset, attrs, region=None): """ {% feincms_prefill_entry_list queryset "authors,richtextcontent_set" [region] %} """ queryset = utils.prefill_entry_list(queryset, region=region, *(attrs.split(','))) return u''