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

Обновил фикстуры

parent fdfd8013
[
{
"model": "auth.group",
"pk": 1,
"fields": {
"name": "Teacher",
"permissions": [
[
"add_group",
"auth",
"group"
],
[
"add_class",
"webapp",
"class"
],
[
"change_class",
"webapp",
"class"
],
[
"delete_class",
"webapp",
"class"
],
[
"view_class",
"webapp",
"class"
],
[
"add_course",
"webapp",
"course"
],
[
"change_course",
"webapp",
"course"
],
[
"delete_course",
"webapp",
"course"
],
[
"view_course",
"webapp",
"course"
]
]
}
},
{
"model": "auth.group",
"pk": 2,
"fields": {
"name": "Student",
"permissions": [
[
"view_class",
"webapp",
"class"
],
[
"view_course",
"webapp",
"course"
]
]
}
},
{
"model": "auth.user",
"pk": 1,
"fields": {
"password": "pbkdf2_sha256$260000$T166efXNru50GTR3wAKGyc$nPwtIZM98+RLlERzgutwoYxImW7g+wqiBzPlihlYqYU=",
"last_login": "2021-11-04T12:14:38.554Z",
"is_superuser": true,
"username": "admin",
"first_name": "",
"last_name": "",
"email": "admin@admin.com",
"is_staff": true,
"is_active": true,
"date_joined": "2021-11-01T11:57:04.226Z",
"groups": [],
"user_permissions": []
}
},
{
"model": "auth.user",
"pk": 5,
"fields": {
"password": "pbkdf2_sha256$260000$VXHxjWIWEx7C1Fihusa2ny$YW7tr+/k2FMRL7DHzRba0qhh0IWCVl/sM5qyLlP3FBo=",
"last_login": "2021-11-04T08:24:38Z",
"is_superuser": false,
"username": "Boris_kim",
"first_name": "",
"last_name": "",
"email": "",
"is_staff": false,
"is_active": true,
"date_joined": "2021-11-04T07:22:42Z",
"groups": [
[
"Student"
]
],
"user_permissions": []
}
},
{
"model": "auth.user",
"pk": 6,
"fields": {
"password": "pbkdf2_sha256$260000$Gk4L0Nsaru54FFpz6hIZfw$OgG0UxHDmslpJOKjzNpNWHwO5nJVtvvXadGxgiA49Dw=",
"last_login": "2021-11-04T11:58:55.367Z",
"is_superuser": false,
"username": "Yernur_Anvarov",
"first_name": "",
"last_name": "",
"email": "",
"is_staff": false,
"is_active": true,
"date_joined": "2021-11-04T11:18:37Z",
"groups": [
[
"Student"
]
],
"user_permissions": []
}
},
{
"model": "auth.user",
"pk": 7,
"fields": {
"password": "pbkdf2_sha256$260000$ehM22Gh3WgR2kwetkdLJdn$eShTl41M46efwXxWPT1bt641/Yg44DtHG3D+0hMd0Rw=",
"last_login": "2021-11-04T11:51:40.085Z",
"is_superuser": false,
"username": "Dauren_Kapanov",
"first_name": "",
"last_name": "",
"email": "",
"is_staff": false,
"is_active": true,
"date_joined": "2021-11-04T11:19:35Z",
"groups": [
[
"Student"
]
],
"user_permissions": []
}
},
{
"model": "auth.user",
"pk": 8,
"fields": {
"password": "pbkdf2_sha256$260000$I3zYrXx6jaWJk0u132P0su$45vI6uWBIiKh2Gc/0bStzWupJvKLi7txeqczLrvcUog=",
"last_login": "2021-11-04T11:19:55Z",
"is_superuser": false,
"username": "Bokeykhan_Tlegen",
"first_name": "",
"last_name": "",
"email": "",
"is_staff": false,
"is_active": true,
"date_joined": "2021-11-04T11:19:55Z",
"groups": [
[
"Student"
]
],
"user_permissions": []
}
},
{
"model": "auth.user",
"pk": 9,
"fields": {
"password": "pbkdf2_sha256$260000$WAM2mQ0PNm8TGDpCLtaslS$AcAadM4XKZcNaYpA2o6S7WN87sS/fTjV5Xh9KWmpYww=",
"last_login": "2021-11-04T11:20:19Z",
"is_superuser": false,
"username": "Aidana_Tursunali",
"first_name": "",
"last_name": "",
"email": "",
"is_staff": false,
"is_active": true,
"date_joined": "2021-11-04T11:20:19Z",
"groups": [
[
"Student"
]
],
"user_permissions": []
}
},
{
"model": "auth.user",
"pk": 10,
"fields": {
"password": "pbkdf2_sha256$260000$H7V658OAvxy33yynAnhHg2$W4RS/hZoIArVajgrD351B+6KzL18eQmn/y4vEhrH9BA=",
"last_login": "2021-11-04T11:20:40Z",
"is_superuser": false,
"username": "Gaukhar_Ibragimova",
"first_name": "",
"last_name": "",
"email": "",
"is_staff": false,
"is_active": true,
"date_joined": "2021-11-04T11:20:40Z",
"groups": [
[
"Student"
]
],
"user_permissions": []
}
},
{
"model": "auth.user",
"pk": 11,
"fields": {
"password": "pbkdf2_sha256$260000$cPC9eNkXsypgxz3taeruJM$oQmOHZ6j6BY2G0bSDiatehHzzKEuvE9hBIY/PSdY8M4=",
"last_login": "2021-11-04T12:14:09.722Z",
"is_superuser": false,
"username": "Almas_Gaparov",
"first_name": "",
"last_name": "",
"email": "",
"is_staff": false,
"is_active": true,
"date_joined": "2021-11-04T11:21:42Z",
"groups": [
[
"Student"
]
],
"user_permissions": []
}
},
{
"model": "auth.user",
"pk": 12,
"fields": {
"password": "pbkdf2_sha256$260000$ooK9hDnm6Dtnlx2oRWSShv$uMg0hWgZUowboTXre+jodkMuobMVmeUH6mqrRatnftc=",
"last_login": "2021-11-04T11:27:22Z",
"is_superuser": false,
"username": "Alexey_Anpilogov",
"first_name": "",
"last_name": "",
"email": "",
"is_staff": false,
"is_active": true,
"date_joined": "2021-11-04T11:27:22Z",
"groups": [
[
"Teacher"
]
],
"user_permissions": []
}
},
{
"model": "auth.user",
"pk": 13,
"fields": {
"password": "pbkdf2_sha256$260000$mXdhD47UC0jmoZ6KtVfKN7$/apkHi1e3+bf657rtHrYWKJlnLEqzkT5JzLRSL+dw1Y=",
"last_login": "2021-11-04T12:14:53.998Z",
"is_superuser": false,
"username": "Anna_Logvinova",
"first_name": "",
"last_name": "",
"email": "",
"is_staff": false,
"is_active": true,
"date_joined": "2021-11-04T11:27:38Z",
"groups": [
[
"Teacher"
]
],
"user_permissions": []
}
},
{
"model": "auth.user",
"pk": 14,
"fields": {
"password": "pbkdf2_sha256$260000$IDy5FVZsKjbxVc1tNMFaHF$d7u526T4ou/GJDQzTeL8qlbreSSxAw6/MF65t9pjgGM=",
"last_login": "2021-11-04T11:28:47Z",
"is_superuser": false,
"username": "Artem_Khvan",
"first_name": "",
"last_name": "",
"email": "",
"is_staff": false,
"is_active": true,
"date_joined": "2021-11-04T11:28:47Z",
"groups": [
[
"Teacher"
]
],
"user_permissions": []
}
},
{
"model": "auth.user",
"pk": 15,
"fields": {
"password": "pbkdf2_sha256$260000$1n1OhmSGFTUUC26oPkizGI$S094x108PeLqd4FxMsPuCeGkrgbpvgbGa6pjcF1+gc8=",
"last_login": "2021-11-04T11:29:09Z",
"is_superuser": false,
"username": "Kaisar_Nursultan",
"first_name": "",
"last_name": "",
"email": "",
"is_staff": false,
"is_active": true,
"date_joined": "2021-11-04T11:29:09Z",
"groups": [
[
"Teacher"
]
],
"user_permissions": []
}
},
{
"model": "auth.user",
"pk": 16,
"fields": {
"password": "pbkdf2_sha256$260000$DpqDILWRgBnQKVoLPHWr4g$m0ZJV7nLElblETHy8cjYE0xnXOnRPlh+y2UbNJxTUBE=",
"last_login": "2021-11-04T12:16:27.016Z",
"is_superuser": false,
"username": "Alibek_Zhetpisov",
"first_name": "",
"last_name": "",
"email": "",
"is_staff": false,
"is_active": true,
"date_joined": "2021-11-04T11:30:31Z",
"groups": [
[
"Teacher"
]
],
"user_permissions": []
}
}
]
[{"model": "webapp.specialization", "pk": 1, "fields": {"spec_name": "System of Information Security(SIS)"}}, {"model": "auth.user", "pk": 1, "fields": {"password": "pbkdf2_sha256$260000$T166efXNru50GTR3wAKGyc$nPwtIZM98+RLlERzgutwoYxImW7g+wqiBzPlihlYqYU=", "last_login": "2021-11-01T11:57:28.922Z", "is_superuser": true, "username": "admin", "first_name": "", "last_name": "", "email": "admin@admin.com", "is_staff": true, "is_active": true, "date_joined": "2021-11-01T11:57:04.226Z", "groups": [], "user_permissions": []}}, {"model": "webapp.course", "pk": 1, "fields": {"title": "Integrated System Design", "description": "bla-bla-bla-bla-bla-bla-bla-bla-bla-bla-bla-bla-bla", "teacher": ["admin"], "start_date": "2021-11-01", "group": [1]}}, {"model": "webapp.course", "pk": 2, "fields": {"title": "Cybersecurity Attacks", "description": "bla-bla-bla-bla-bla-bla-bla-bla-bla-bla", "teacher": ["admin"], "start_date": "2021-11-01", "group": [1]}}, {"model": "webapp.course", "pk": 3, "fields": {"title": "Cisco 2", "description": "bla-bla-bla-bla-bla-bla-bla-bla-bla", "teacher": ["admin"], "start_date": "2021-11-01", "group": [1]}}, {"model": "webapp.course", "pk": 4, "fields": {"title": "Cisco 3", "description": "bla-bla-bla-bla-bla-bla-bla-bla-bla-bla", "teacher": ["admin"], "start_date": "2021-11-01", "group": [1]}}, {"model": "webapp.group", "pk": 1, "fields": {"group_name": "SIS-1801", "specialization": 1, "students": [["admin"]]}}]
\ No newline at end of file
[
{
"model": "webapp.course",
"pk": 10,
"fields": {
"title": "Integrated System Design",
"description": "ISD designs best of breed systems for warehouses, manufacturing, distribution, retail and wholesale applications and organizations which optimize space and labor utilization and provide a fast Return On Investment (ROI). From piece picking and packing systems to build lines and buffer work in process systems, Integrated Systems Design provides consulting and design services to meet organizations current and future business plans and processes. ISD design's are based on our customer's actual need and not on a technology or factory production schedule.",
"teacher": [
"admin"
],
"start_date": "2021-10-28",
"group": [
1
]
}
},
{
"model": "webapp.course",
"pk": 11,
"fields": {
"title": "Economics System",
"description": "An economic system is a means by which societies or governments organize and distribute available resources, services, and goods across a geographic region or country. Economic systems regulate the factors of production, including land, capital, labor, and physical resources. An economic system encompasses many institutions, agencies, entities, decision-making processes, and patterns of consumption that comprise the economic structure of a given community.",
"teacher": [
"Alexey_Anpilogov"
],
"start_date": "2021-10-01",
"group": [
4
]
}
},
{
"model": "webapp.course",
"pk": 12,
"fields": {
"title": "Cisco 3",
"description": "Thanks to new technologies, networks are becoming more intelligent, programmable and software-driven. Networking Academy courses support this evolution and expose learners to new concepts and hands-on experiences. Best of all, courses are tied to CCNA certifications—among the most in-demand in the industry, according to IDC. Get started by choosing a course today.",
"teacher": [
"Anna_Logvinova"
],
"start_date": "2021-11-09",
"group": [
2
]
}
},
{
"model": "webapp.course",
"pk": 13,
"fields": {
"title": "Software development",
"description": "Software development is the process of conceiving, specifying, designing, programming, documenting, testing, and bug fixing involved in creating and maintaining applications, frameworks, or other software components. ... Software can be developed for a variety of purposes.",
"teacher": [
"Alibek_Zhetpisov"
],
"start_date": "2021-10-01",
"group": [
3
]
}
},
{
"model": "webapp.group",
"pk": 1,
"fields": {
"group_name": "SIS-1801",
"specialization": 1,
"students": [
[
"Dauren_Kapanov"
],
[
"Aidana_Tursunali"
]
]
}
},
{
"model": "webapp.group",
"pk": 2,
"fields": {
"group_name": "SIS-1802",
"specialization": 1,
"students": [
[
"Boris_kim"
],
[
"Bokeykhan_Tlegen"
],
[
"Almas_Gaparov"
]
]
}
},
{
"model": "webapp.group",
"pk": 3,
"fields": {
"group_name": "CS-2001",
"specialization": 5,
"students": [
[
"Yernur_Anvarov"
],
[
"Gaukhar_Ibragimova"
]
]
}
},
{
"model": "webapp.group",
"pk": 4,
"fields": {
"group_name": "MAA-2018",
"specialization": 3,
"students": [
[
"Bokeykhan_Tlegen"
],
[
"Aidana_Tursunali"
],
[
"Almas_Gaparov"
]
]
}
},
{
"model": "webapp.class",
"pk": 3,
"fields": {
"title": "Introduction",
"description": "ISD represents some of the best known material handling and machinery manufacturers in the world to provide turn key integrated systems utilizing: conveyor, robots, automated storage and retrieval systems (ASRS), controls, software, pick to light, A frames, horizontal carousels, vertical lift modules (VLMs), vertical carousels, shelving, flow rack, pallet rack, fork lifts and much more.",
"file": "uploads/frxreport.pdf",
"created_at": "2021-11-04T12:09:04.220Z",
"updated_at": "2021-11-04T12:09:04.220Z",
"course": [
10
]
}
},
{
"model": "webapp.specialization",
"pk": 1,
"fields": {
"spec_name": "System of Information Security(SIS)"
}
},
{
"model": "webapp.specialization",
"pk": 2,
"fields": {
"spec_name": "Information System(IS)"
}
},
{
"model": "webapp.specialization",
"pk": 3,
"fields": {
"spec_name": "Management and adminstration(MAA)"
}
},
{
"model": "webapp.specialization",
"pk": 4,
"fields": {
"spec_name": "Communications and communication systems(CACS))"
}
},
{
"model": "webapp.specialization",
"pk": 5,
"fields": {
"spec_name": "Computer Science(CS)"
}
},
{
"model": "webapp.specialization",
"pk": 6,
"fields": {
"spec_name": "Network and system administration(NASA)"
}
},
{
"model": "webapp.specialization",
"pk": 7,
"fields": {
"spec_name": "IT Finance"
}
}
]
{% extends "base.html" %}
{% block title %}Delete {{ class.title }}{% endblock %}
{% block content %}
<div class="card text-center" style="height: 250px;">
<div class="card-header">
<h4 style="color: red;"> Warning! </h4>
</div>
<div class="card-body">
<h5 class="card-title"> Are you sure you want to delete class - "{{ course.title}}"? </h5>
<p class="card-text">You can no longer restore anything</p>
<div class='d-flex justify-content-center'>
<a class='btn btn-primary p-2' href="{% url "webapp:course_detail" course.pk %}" style="width: 90px;">Cancel</a>
<form action='' method="post">
{% csrf_token %}
<button class="btn btn-danger p-2" style="width: 90px;">Yes</button>
</form>
</div>
</div>
</div>
{% endblock %}
......@@ -25,7 +25,7 @@
</div>
{% endfor %}
</div>
<div class="d-flex pagination justify-content-center">
<div class="d-flex pagination justify-content-center" style="margin: 100xp auto;">
{% if is_paginated %}
{% include "partial/pagination.html" %}
{% endif %}
......
......@@ -24,14 +24,14 @@
</div>
</div>
{% for class in course.courses.all %}
<div class="card border-dark mb-3" style="max-width: 100%; height: 260px; margin: 15px auto;">
<div class="card border-dark mb-3" style="max-width: 100%; height: 300px; margin: 15px auto;">
<div class="card-header">
<h6 style="color: #3A63A7;"> Week #{{forloop.counter}} </h6>
</div>
<div class="card-body text-dark">
<h5 class="card-title">Topic: {{ class.title }} </h5>
<p class="card-text"> Description: {{ class.description }} </p>
<a href="{{ class.file.url }}"> See the lecture </a>
<a href="{{ class.file.url }}"> See the lecture >> </a>
<hr>
<p> <b>Created at:</b> {{ class.created_at }} - <b>by:</b> {{ course.teacher }}</p>
</div>
......
......@@ -10,5 +10,6 @@ urlpatterns = [
path('course/new/', webapp_views.CourseCreateView.as_view(), name='course_create'),
path('course/<int:pk>/edit/', webapp_views.CourseEditView.as_view(), name='course_edit'),
path('course/<int:course_pk>/class/new', webapp_views.CreateClassView.as_view(), name='class_create')
path('course/<int:course_pk>/class/new', webapp_views.CreateClassView.as_view(), name='class_create'),
path('course/<int:course_pk>/class/delete', webapp_views.DeleteClassView.as_view(), name='class_delete')
]
\ No newline at end of file
......@@ -4,7 +4,6 @@ from django.views.generic import CreateView, DeleteView, UpdateView
from django.contrib.auth.mixins import LoginRequiredMixin, PermissionRequiredMixin
from webapp.models import Class, Course
from webapp.forms import ClassForm
class CreateClassView(LoginRequiredMixin, PermissionRequiredMixin, CreateView):
......@@ -30,4 +29,4 @@ class EditClassView(UpdateView):
class DeleteClassView(DeleteView):
pass
\ No newline at end of file
pass
from django.conf import settings
from django.shortcuts import redirect
from django.urls.base import reverse_lazy
from django.views.generic import ListView, CreateView, DetailView, DeleteView
from django.views.generic import UpdateView
......@@ -12,7 +11,7 @@ from webapp.forms import CourseForm
class CourseCreateView(LoginRequiredMixin, PermissionRequiredMixin, CreateView):
template_name = 'courses/create.html'
form_class = CourseForm
model = Course
model = Course
pk_url_kwarg = 'course_pk'
permission_required = 'webapp.add_course'
......@@ -29,11 +28,17 @@ class CoursesListView(ListView):
class CourseDetailView(LoginRequiredMixin, PermissionRequiredMixin, DetailView):
model = Course
model = Course
template_name = 'courses/detail.html'
pk_url_kwarg = 'course_pk'
permission_required = 'webapp.view_course'
def has_permission(self):
course = self.get_object()
group_students = course.group.values_list('students', flat=True)
print(group_students)
return super().has_permission() and self.get_object().teacher == self.request.user or self.request.user.pk in group_students
class CourseDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteView):
model = Course
......@@ -41,6 +46,12 @@ class CourseDeleteView(LoginRequiredMixin, PermissionRequiredMixin, DeleteView):
success_url = reverse_lazy('webapp:courses_list')
permission_required = 'webapp.delete_course'
def has_permission(self):
course = self.get_object()
group_students = course.group.values_list('students', flat=True)
print(group_students)
return super().has_permission() and self.get_object().teacher == self.request.user or self.request.user.pk in group_students
class CourseEditView(LoginRequiredMixin, PermissionRequiredMixin, UpdateView):
model = Course
......@@ -48,3 +59,8 @@ class CourseEditView(LoginRequiredMixin, PermissionRequiredMixin, UpdateView):
template_name = 'courses/edit.html'
permission_required = 'webapp.change_course'
def has_permission(self):
course = self.get_object()
group_students = course.group.values_list('students', flat=True)
print(group_students)
return super().has_permission() and self.get_object().teacher == self.request.user or self.request.user.pk in group_students
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