hw3
- Введены типы данных в models.py, сайт переписан под django модели
- DB переведена на PostgreSQL
- Переписан docker compose файл, настроены network и volume
- Добавлена команда генерации рандомных данных в db
hw4
- Добавлены формы login, signup, logout, profile
- Добавлены вопросы и ответы и их модели и формы
hw5
- Добавлена загрузка и отображение аватарок
- Добавлены лайки и дизайки, отметка правильного ответа
This commit is contained in:
redtea committed 2026-05-10 22:56:49 +03:00
1 parent 33379408ba
commit 466555ce05
26 files changed
+1722 -178

No files matched your search

+160 -36
View File
@@ -4,63 +4,187 @@
{% block content %}
<article class="card">
<div>
<div class="avatar-box">avatar</div>
<div class="vote-box">
<span>5</span>
<span class="vote-arrows">^<span>'</span></span>
<div class="avatar-box">
{% if question.user.profile.avatar %}
<img src="{{ question.user.profile.avatar.url }}" width="80">
{% else %}
avatar
{% endif %}
</div>
<div class="vote-box">
<span id="question-rating-{{ question.id }}">
{{ question.rating }}
</span>
{% if request.user.is_authenticated %}
{% if not question_reaction %}
<button
class="question-like"
data-id="{{ question.id }}"
>
+
</button>
<button
class="question-dislike"
data-id="{{ question.id }}"
>
-
</button>
{% else %}
<span>voted</span>
{% endif %}
{% endif %}
</div>
</div>
<div>
<div class="question-title">How to build a moon park ?</div>
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat. Ut wisi enim ad minim veniam, quis nostrud exerci tation ullamcorper suscipit lobortis nisl ut aliquip ex ea commodo consequat.</p>
<div class="question-title">
{{ question.title }}
</div>
<p>{{ question.body }}</p>
<div class="meta">
<span>Tags:</span>
<a class="tag" href="#">black-jack</a>
<a class="tag" href="#">bender</a>
{% for tag in question.tags.all %}
<a
class="tag"
href="/?tag={{ tag }}"
>
{{ tag }}
</a>
{% endfor %}
</div>
</div>
</article>
<article class="answer-card">
{% for answer in answers %}
<article
class="answer-card"
id="answer-{{ answer.id }}"
>
<div>
<div class="avatar-box">avatar</div>
<div class="avatar-box">
{% if answer.user.profile.avatar %}
<img src="{{ answer.user.profile.avatar.url }}" width="80">
{% else %}
avatar
{% endif %}
</div>
<div class="vote-box">
<span>5</span>
<span class="vote-arrows">^<span>'</span></span>
<span id="answer-rating-{{ answer.id }}">
{{ answer.rating }}
</span>
{% if request.user.is_authenticated %}
{% if answer.id not in answer_reactions %}
<button
class="answer-like"
data-id="{{ answer.id }}"
>
+
</button>
<button
class="answer-dislike"
data-id="{{ answer.id }}"
>
-
</button>
{% else %}
<span>voted</span>
{% endif %}
{% endif %}
</div>
</div>
<div>
<p>First of all I would like to thank you for the invitation to participate in such a ... Russia is the huge territory which in many respects needs to be render habitable.</p>
<p>{{ answer.body }}</p>
<div class="answer-controls">
<input type="checkbox" checked>
<span>Correct!</span>
{% if question.correct_answer_id == answer.id %}
<span class="correct-label">
✔ Correct
</span>
{% endif %}
</div>
{% if request.user == question.user %}
<button
class="correct-answer-btn"
data-question="{{ question.id }}"
data-answer="{{ answer.id }}"
>
Correct
</button>
{% endif %}
</div>
</article>
<article class="answer-card">
<div>
<div class="avatar-box">avatar</div>
<div class="vote-box">
<span>3</span>
<span class="vote-arrows">^<span>'</span></span>
</div>
</div>
<div>
<p>First of all I would like to thank you for the invitation to participate in such a ... Russia is the huge territory which in many respects needs to be render habitable.</p>
<div class="answer-controls">
<input type="checkbox">
<span>Correct!</span>
</div>
</div>
</article>
{% endfor %}
<form method="post">
{% csrf_token %}
{{ form.body }}
{{ form.body.errors }}
<button type="submit">
Answer
</button>
<form class="form">
<label for="answer">Enter your answer here..</label>
<textarea id="answer"></textarea>
<button class="button" type="button">Answer</button>
</form>
{% endblock %}