Commit 2dbf564e authored by Борис Ким's avatar Борис Ким

Исправил ошибку с ссылкой на создание нового урока

parent 635a5cd4
......@@ -15,8 +15,7 @@ class Course(models.Model):
return self.title
def get_absolute_url(self):
return reverse("course_detail", args=[str(self.id)])
return reverse("webapp:course_detail", args=[str(self.id)])
class Group(models.Model):
......
......@@ -3,14 +3,14 @@
{% block title %} Create new Class {% endblock %}
{% block content %}
<a href="{% url "courses_list" %}">Return to the main page..</a>
<a href="{% url "webapp:courses_list" %}">Return to the main page..</a>
<hr>
<h1>Create new Class</h1>
<div class='column-center'>
<form action="{% url "class_create" %}" method="POST">
<form action="{% url "webapp:class_create" %}" method="POST">
{% include "partial/create_form.html" with button_text="Create new class" %}
</form>
</div>
<hr>
<a href="{% url "courses_list" %}">Return to the main page..</a>
<a href="{% url "webapp:courses_list" %}">Return to the main page..</a>
{% endblock %}
\ No newline at end of file
......@@ -16,6 +16,9 @@
<a class="card-title" href="{% url 'webapp:course_detail' course.id %}"> <h5>{{course.title}}</h5> </a>
<p class="card-text"> {{ course.description|truncatewords:30 }} </p>
<p class="card-text"> <b>Teacher:</b> {{course.teacher}} </p>
<p class="card-text"> <b>Groups(s):</b>
{% for group in course.group.all %} {{group}} {% endfor %}
</p>
</div>
</div>
</div>
......
......@@ -10,7 +10,7 @@ from webapp.forms import ClassForm
class CreateClassView(LoginRequiredMixin, PermissionRequiredMixin, CreateView):
model = Class
fields = ['title', 'description', 'file']
template_name = 'courses/create.html'
template_name = 'classes/create.html'
permission_required = 'webapp.add_class'
def form_valid(self, form):
......@@ -22,7 +22,7 @@ class CreateClassView(LoginRequiredMixin, PermissionRequiredMixin, CreateView):
return redirect("webapp:course_detail", course_pk=course.pk)
def get_success_url(self):
return reverse("webapp:project_detail", kwargs = {'project_pk': self.object.course.pk})
return reverse("webapp:course_detail", kwargs = {'project_pk': self.object.course.pk})
class EditClassView(UpdateView):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment