def test_all(self): python = Language.objects.create( name='python', learn_url='http://www.diveintopython.net/toc/index.html') ruby = Language.objects.create( name='ruby', learn_url="http://tryruby.org/levels/1/challenges/0") assert_equal(Language.all(), [u'python', u'ruby'])
def home(request): """ View for the home page """ if Repo.objects.exists(): languages = Language.all() random_language = random.choice(languages) return HttpResponseRedirect(reverse('get_repo', args=(random_language,))) else: return render(request, 'base/home.html', {})
def test_all(self): python = Language.objects.create(name="python", learn_url="http://www.diveintopython.net/toc/index.html") ruby = Language.objects.create(name="ruby", learn_url="http://tryruby.org/levels/1/challenges/0") assert_equal(Language.all(), [u"python", u"ruby"])