Add caching for user basic info

This commit is contained in:
cuom1999 2023-10-10 19:37:36 -05:00
parent 7f854c40dd
commit ed287b6ff3
15 changed files with 110 additions and 33 deletions

View file

@ -1 +1 @@
<span class="{{ profile.css_class }}"><a href="{{ url('user_page', user.username) }}">{{ user.username }}</a></span>
<span class="{{ profile.css_class }}"><a href="{{ url('user_page', profile.username) }}">{{ profile.username }}</a></span>

View file

@ -54,9 +54,9 @@
</div>
</div>
</div>
{% if user.user.first_name %}
{% if user.first_name %}
<p style="font-size:1.4em; text-align: center;">
{{user.user.first_name}}{% if user.user.last_name %} ({{user.user.last_name}}){% endif %}
{{user.first_name}}{% if user.last_name %} ({{user.last_name}}){% endif %}
</p>
{% endif %}
{% if perms.judge.change_profile %}
@ -70,9 +70,7 @@
{% endif%}
{% if user.about %}
<h4>{{ _('About') }}</h4>
{% cache 86400 'user_about' user.id MATH_ENGINE %}
{{ user.about|markdown(lazy_load=True)|reference|str|safe }}
{% endcache %}
{{ user.about|markdown(lazy_load=True)|reference|str|safe }}
{% else %}
<i>
{% if user.user == request.user %}

View file

@ -10,7 +10,7 @@
{% block user_footer %}
<span style="margin-left: 0.5em">{% if user.rating %}{{ rating_number(user) }}{% endif %}</span>
<div class="gray" style="font-weight: 600; margin-top: 0.2em">{{ user.user.first_name if user.user.first_name else ''}}</div>
<div class="gray" style="font-weight: 600; margin-top: 0.2em">{{ user.first_name or ''}}</div>
{% endblock %}
{% block after_point_head %}
@ -39,11 +39,11 @@
<td class="user-problem-count">{{ user.problem_count }}</td>
<td>
<div class="about-td">
{% if user.about %}
{% cache 86400 'user_about' user.id MATH_ENGINE %}
{% cache 86400 'user_about' user.id MATH_ENGINE %}
{% if user.about %}
{{ user.about|markdown(lazy_load=True)|reference|str|safe }}
{% endcache %}
{% endif %}
{% endif %}
{% endcache %}
</div>
</td>
{% endblock %}