[Solved] Django, how do it in template?

# Something along the lines of this. rate = Rate.objects.get(user=request.user) context = {…., “user”: request.user, “rate”: rate} return render(request, ‘template.html’, context=context) In your template: {% if rate %} <h2><a href=”https://stackoverflow.com/games/{{game.id}}/{{game.slug}}/add_rate/edit/{{rate.id}}/”>Edit rate</a></h2> {% else %} <h2><a href=”http://stackoverflow.com/games/{{game.id}}/{{game.slug}}/add_rate”>Add rate</a></h2> {% endif %} 6 solved Django, how do it in template?

[Solved] how to start the forloop.counter from a different index

I’m not comfortable with Django, so I show a couple of option in plain Python, given the collections: something1 = [1,2,3,4] something2 = [1,2,3,4,5,6,7,8,9,10] You can access objects by index (not the same as database index): i = 1 for e1 in something1: print(e1) i += 1 for i2 in range(i,len(something2)): print(something2[i2]) Or slice the … Read more