Skip to content

Commit

Permalink
add links
Browse files Browse the repository at this point in the history
  • Loading branch information
KonstantinRaikhert committed Sep 17, 2024
1 parent 8a5eb1d commit fa164d8
Show file tree
Hide file tree
Showing 5 changed files with 47 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/schooling/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,16 @@ class LessonForm(forms.ModelForm):
class Meta:
model = Lesson
fields = (
'name', 'subject', 'teacher_id', 'student_id',
'datetime_start', 'duration', 'is_passed', 'test_lesson',
'name',
'subject',
'teacher_id',
'student_id',
'video_meeting_url',
'homework_url',
'datetime_start',
'duration',
'is_passed',
'test_lesson',
)

def clean(self):
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Generated by Django 5.0.4 on 2024-09-17 15:32

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('schooling', '0003_add_subject'),
]

operations = [
migrations.AddField(
model_name='lesson',
name='homework_url',
field=models.URLField(help_text='Там, где размещено домашнее задание', null=True, verbose_name='Ссылка на домашнее задание'),
),
migrations.AddField(
model_name='lesson',
name='video_meeting_url',
field=models.URLField(help_text='Там, где будет проходить встреча', null=True, verbose_name='Ссылка на проведение урока'),
),
]
10 changes: 10 additions & 0 deletions src/schooling/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,16 @@ class Lesson(models.Model):
default=45,
)
is_passed = models.BooleanField('Занятие прошло', default=False)
video_meeting_url = models.URLField(
'Ссылка на проведение урока',
help_text='Там, где будет проходить встреча',
null=True,
)
homework_url = models.URLField(
'Ссылка на домашнее задание',
help_text='Там, где размещено домашнее задание',
null=True,
)
is_passed_teacher = models.BooleanField(
'Занятие подтверждено учителем', default=False,
)
Expand Down
2 changes: 2 additions & 0 deletions src/schooling/signals_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,8 @@ async def get_message_text(instance):
f'Тема: {instance.name}.\n'
f'Преподаватель: {instance.teacher_id}\n'
f'Ученик: {instance.student_id}\n'
f'Ссылка на встречу: {instance.video_meeting_url}\n'
f'Домашнее задание: {instance.homework_url}\n'
)
test_msg = f'{instance._meta.get_field('test_lesson').verbose_name}'
if instance.test_lesson:
Expand Down
2 changes: 2 additions & 0 deletions src/templates/schedule_details_card.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ <h2 class="card-header">
<p class="card-text"><strong>Преподаватель:</strong> {{ user_full_name }}</p>
{% endif %}
<p class="card-text"><strong>Время и дата:</strong><br>{{ lesson.datetime_start|date:"d.m.Y H:i" }} - {{ lesson.datetime_end|date:"d.m.Y H:i" }}</p>
<p class="card-text"><strong>Ссылка на встречу:</strong> <a href="{{ lesson.video_meeting_url }}">тут</a></p>
<p class="card-text"><strong>Ссылка на домашнее задание:</strong> <a href="{{ lesson.homework_url }}">тут</a></p>
<a class="btn main-button" style="width: 40%;" href="{% url 'schedule:change_datetime_lesson' user_tg_id lesson.id %}" role="button">
Перенести
</a>
Expand Down

0 comments on commit fa164d8

Please sign in to comment.