Exemplo n.º 1
0
 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'])
Exemplo n.º 2
0
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', {})
Exemplo n.º 3
0
 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"])