-
Notifications
You must be signed in to change notification settings - Fork 165
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Removing workflows, pagerduty and statuspage as they'll become recipes/plugins in future.
- Loading branch information
Showing
32 changed files
with
59 additions
and
671 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
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 |
---|---|---|
|
@@ -121,7 +121,7 @@ | |
|
||
USE_L10N = True | ||
|
||
USE_TZ = True | ||
USE_TZ = False | ||
|
||
|
||
# Static files (CSS, JavaScript, Images) | ||
|
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
from django.contrib import admin | ||
|
||
from .core import admin | ||
from .pagerduty import admin | ||
from .slack import admin |
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 |
---|---|---|
@@ -1,3 +1,46 @@ | ||
from django.shortcuts import render | ||
from rest_framework import viewsets | ||
|
||
# Create your views here. | ||
from response.core.models.incident import Incident | ||
from response.core.models.action import Action | ||
from response.core.models.user_external import ExternalUser | ||
from response.core.serializers import ExternalUserSerializer, ActionSerializer, IncidentSerializer | ||
|
||
from datetime import datetime | ||
from calendar import monthrange | ||
|
||
|
||
class ExternalUserViewSet(viewsets.ModelViewSet): | ||
# ViewSets define the view behavior. | ||
queryset = ExternalUser.objects.all() | ||
serializer_class = ExternalUserSerializer | ||
|
||
|
||
class ActionViewSet(viewsets.ModelViewSet): | ||
# ViewSets define the view behavior. | ||
queryset = Action.objects.all() | ||
serializer_class = ActionSerializer | ||
|
||
|
||
# Will return the incidents of the current month | ||
# Can pass ?start=2019-05-28&end=2019-06-03 to change range | ||
class IncidentViewSet(viewsets.ModelViewSet): | ||
# ViewSets define the view behavior. | ||
|
||
serializer_class = IncidentSerializer | ||
pagination_class = None # Remove pagination | ||
|
||
def get_queryset(self): | ||
# Same query is used to get single items so we check if pk is passed | ||
# incident/2/ if we use the filter below we would have to have correct time range | ||
if 'pk' in self.kwargs: | ||
return Incident.objects.filter(pk=self.kwargs['pk']) | ||
|
||
today = datetime.today() | ||
first_day_of_current_month = datetime(today.year, today.month, 1) | ||
days_in_month = monthrange(today.year, today.month)[1] | ||
last_day_of_current_month = datetime(today.year, today.month, days_in_month) | ||
|
||
start = self.request.GET.get('start', first_day_of_current_month) | ||
end = self.request.GET.get('end', last_day_of_current_month) | ||
|
||
return Incident.objects.filter(start_time__gte=start, start_time__lte=end) |
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 |
---|---|---|
@@ -1,5 +1,4 @@ | ||
from django.db import models | ||
|
||
from .core.models import * | ||
from .pagerduty.models import * | ||
from .slack.models import * |
This file was deleted.
Oops, something went wrong.
Empty file.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
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
Oops, something went wrong.