forked from mtianyan/OnlineMooc
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
499 changed files
with
71,575 additions
and
49 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -224,3 +224,4 @@ dmypy.json | |
|
||
# Pyre type checker | ||
.pyre/ | ||
./front_end/node_modules |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from rest_framework.pagination import PageNumberPagination | ||
from rest_framework.response import Response | ||
from collections import OrderedDict | ||
|
||
|
||
class CustomPageNumberPagination(PageNumberPagination): | ||
page_query_param = 'current' | ||
page_size_query_param = 'pageSize' | ||
|
||
def get_paginated_response(self, data): | ||
return Response(OrderedDict([ | ||
('total', self.page.paginator.count), | ||
('data', data), | ||
('current', self.page.number), | ||
('success', True), | ||
('pageSize', self.page.paginator.per_page) | ||
])) | ||
|
||
def get_results(self, data): | ||
"""必须和上面的一起修改,否则引起Filter与分页无法共存显示的bug""" | ||
return data['data'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from rest_framework import viewsets | ||
|
||
from courses.models import Course, Lesson, Video, CourseResource | ||
from courses.serializers import CourseSerializer, LessonSerializer, VideoSerializer, CourseResourceSerializer | ||
|
||
|
||
class CourseViewSet(viewsets.ModelViewSet): | ||
serializer_class = CourseSerializer | ||
queryset = Course.objects.all() | ||
|
||
|
||
class LessonViewSet(viewsets.ModelViewSet): | ||
serializer_class = LessonSerializer | ||
queryset = Lesson.objects.all() | ||
|
||
|
||
class VideoViewSet(viewsets.ModelViewSet): | ||
serializer_class = VideoSerializer | ||
queryset = Video.objects.all() | ||
|
||
|
||
class CourseResourceViewSet(viewsets.ModelViewSet): | ||
serializer_class = CourseResourceSerializer | ||
queryset = CourseResource.objects.all() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
from rest_framework import serializers | ||
|
||
from courses.models import Course, Lesson, Video, CourseResource | ||
|
||
|
||
class CourseSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = Course | ||
fields = "__all__" | ||
|
||
|
||
class LessonSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = Lesson | ||
fields = "__all__" | ||
|
||
|
||
class VideoSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = Video | ||
fields = "__all__" | ||
|
||
|
||
class CourseResourceSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = CourseResource | ||
fields = "__all__" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
|
||
from rest_framework import viewsets | ||
|
||
from organization.models import CityDict, CourseOrg, Teacher | ||
from organization.serializers import CityDictSerializer, CourseOrgSerializer, TeacherSerializer | ||
|
||
|
||
class CityDictViewSet(viewsets.ModelViewSet): | ||
serializer_class = CityDictSerializer | ||
queryset = CityDict.objects.all() | ||
|
||
|
||
class CourseOrgViewSet(viewsets.ModelViewSet): | ||
serializer_class = CourseOrgSerializer | ||
queryset = CourseOrg.objects.all() | ||
|
||
|
||
class TeacherViewSet(viewsets.ModelViewSet): | ||
serializer_class = TeacherSerializer | ||
queryset = Teacher.objects.all() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
|
||
from rest_framework import serializers | ||
|
||
from organization.models import CityDict, CourseOrg, Teacher | ||
|
||
|
||
class CityDictSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = CityDict | ||
fields = "__all__" | ||
|
||
|
||
class CourseOrgSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = CourseOrg | ||
fields = "__all__" | ||
|
||
|
||
class TeacherSerializer(serializers.ModelSerializer): | ||
class Meta: | ||
model = Teacher | ||
fields = "__all__" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,4 +37,5 @@ | |
# 我收藏的课程 | ||
path('my_message/', MyMessageView.as_view(), name="my_message"), | ||
|
||
|
||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# TODO copy static | ||
import os | ||
import shutil | ||
import glob | ||
|
||
for one in glob.glob('./templates/admin/*'): | ||
if one != './templates/admin/index.html': | ||
if os.path.isdir(one): | ||
for file_one in glob.glob(f'{one}/*'): | ||
print(file_one) | ||
to_file_one = file_one.replace('/templates/admin', '/static') | ||
print(to_file_one) | ||
shutil.move(file_one, to_file_one) | ||
else: | ||
print(one) | ||
to_one = one.replace('/templates/admin', '/static') | ||
print(to_one) | ||
shutil.move(one, to_one) | ||
# |
Oops, something went wrong.