mirror of
https://github.com/jlengrand/bugsink.git
synced 2026-03-10 08:01:17 +00:00
Canonical API 'skeleton': urls & views
this gives me something to look at and work with, despite being wildly incomplete See #146
This commit is contained in:
9
projects/api_views.py
Normal file
9
projects/api_views.py
Normal file
@@ -0,0 +1,9 @@
|
||||
from rest_framework import viewsets
|
||||
|
||||
from .models import Project
|
||||
from .serializers import ProjectSerializer
|
||||
|
||||
|
||||
class ProjectViewSet(viewsets.ModelViewSet):
|
||||
queryset = Project.objects.all().order_by('id')
|
||||
serializer_class = ProjectSerializer
|
||||
24
projects/serializers.py
Normal file
24
projects/serializers.py
Normal file
@@ -0,0 +1,24 @@
|
||||
from rest_framework import serializers
|
||||
|
||||
from .models import Project
|
||||
|
||||
|
||||
class ProjectSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = Project
|
||||
fields = [
|
||||
"id",
|
||||
"team",
|
||||
"name",
|
||||
"slug",
|
||||
"is_deleted",
|
||||
"sentry_key", # or just: "dsn"
|
||||
# users = models.ManyToManyField(settings.AUTH_USER_MODEL, blank=True, through="ProjectMembership")
|
||||
"digested_event_count",
|
||||
"stored_event_count",
|
||||
"alert_on_new_issue",
|
||||
"alert_on_regression",
|
||||
"alert_on_unmute",
|
||||
"visibility",
|
||||
"retention_max_event_count",
|
||||
]
|
||||
Reference in New Issue
Block a user