Commit bb943c01 authored by Fernando Ribeiro's avatar Fernando Ribeiro
Browse files

Merge branch 'develop' into 'master'

develop into master

See merge request !14
parents 921defcb 8b937351
......@@ -143,3 +143,4 @@ class ClassroomAdmin(admin.ModelAdmin):
'forum',
'group',
)
inlines = (EventInline,)
......@@ -88,5 +88,7 @@ class Event(models.Model):
Classroom,
verbose_name=_('Classroom'),
on_delete=models.CASCADE,
null=True
related_name='events',
blank=True,
null=True,
)
......@@ -4,14 +4,22 @@ from rest_framework.permissions import IsAuthenticated
from django.db.models import Q
from courses.models import Course
from .models import Classroom
from .models import Classroom, Event
from .serializers import (
BasicClassroomSerializer,
ClassroomSerializer,
EventSerializer,
)
from .permissions import IsClassroomAssistantOrCoordinatorOrReadOnly
class EventViewSet(viewsets.ReadOnlyModelViewSet):
queryset = Event.objects.all()
serializer_class = EventSerializer
permission_classes = [IsAuthenticated]
class BasicClassroomViewSet(viewsets.ReadOnlyModelViewSet):
queryset = Classroom.objects.all()
......@@ -34,6 +42,7 @@ class BasicClassroomViewSet(viewsets.ReadOnlyModelViewSet):
'coordinators',
'courses',
'access_groups',
'events',
)
return queryset
......
# Generated by Django 2.2.14 on 2020-07-27 19:53
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('courses', '0011_course_forum'),
]
operations = [
migrations.AlterField(
model_name='event',
name='classroom',
field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='events', to='courses.Classroom', verbose_name='Classroom'),
),
]
......@@ -28,6 +28,7 @@ from courses.reports.views import (
from courses.classroom.views import (
BasicClassroomViewSet,
ClassroomViewSet,
EventViewSet,
)
......@@ -62,6 +63,7 @@ router.register(r'professor_message_read', ProfessorMessageReadViewSet, base_nam
# Classroom
router.register(r'classrooms', BasicClassroomViewSet, base_name='classrooms')
router.register(r'classroom', ClassroomViewSet, base_name='classroom')
router.register(r'event', EventViewSet, base_name='event')
app_name = 'courses'
urlpatterns = [
......
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