Add created challenges on profile

This commit is contained in:
Starthur 2022-05-27 16:53:53 +02:00
parent 2d466454f5
commit 04318e3b0a
2 changed files with 19 additions and 5 deletions

View File

@ -75,6 +75,19 @@
</li>
{% endfor %}
</ul>
<ul class="list-group">
<ul class="list-group">
<li class="list-group-item">{% trans "Challenges created" %}</li>
{% if created %}
{% for creat in created %}
<li class="list-group-item"><a href="{% url 'ctf' cat_slug=creat.category.slug ctf_slug=creat.slug %}">{{ creat.name }}</a></li>
{% endfor %}
{% else %}
<p>{% trans "It seems that this user has not created any challenge yet..." %}</p>
{% endif %}
</ul>
</ul>
</div>
</div>

View File

@ -151,9 +151,10 @@ def profile(request, user_name):
for s in solves.reverse():
somme += s.ctf.points
solved.append([s.flag_date.timestamp() * 1000,somme])
created = CTF.objects.filter(author=user_obj)
print(created)
return render(request,'accounts/profile.html', {'user':user_obj, 'solves':solves,'solved':solved,'catsDatas': catsDatas, 'pointDatas': pointDatas,
'rank': rank, 'score' : somme, 'member' : member, 'cats':cats})
'rank': rank, 'score' : somme, 'member' : member, 'cats':cats, 'created':created})
@login_required
def delete_account(request):