-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improved versioning and dummy implementation for PluginViewSet
Replaced URLPathVersioning by Namespace versioning. It fixed a couple of problems with documentation (api/docs).
- Loading branch information
Nikita Manovich
committed
Feb 5, 2019
1 parent
90d0b38
commit d2692da
Showing
8 changed files
with
113 additions
and
70 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 |
---|---|---|
@@ -1,17 +1,3 @@ | ||
# Copyright (C) 2018 Intel Corporation | ||
# | ||
# SPDX-License-Identifier: MIT | ||
|
||
from rest_framework import versioning | ||
|
||
class URLPathVersioning(versioning.URLPathVersioning): | ||
def determine_version(self, request, *args, **kwargs): | ||
# When you try to specify a version (e.g /api/v1/docs) it will generate | ||
# an error inside a template of Rest Framework (reverse of an URL | ||
# without argument). Also when you try don't use version at all it will | ||
# give you an error 'invalid version'. To avoid these problems just | ||
# redefine determine_version for /api/docs/*. | ||
if request.path.startswith('/api/docs/'): | ||
return None | ||
|
||
return super().determine_version(request, *args, **kwargs) |
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,30 @@ | ||
# Generated by Django 2.1.5 on 2019-02-05 10:07 | ||
|
||
import cvat.apps.engine.models | ||
from django.conf import settings | ||
from django.db import migrations, models | ||
import django.db.models.deletion | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
dependencies = [ | ||
migrations.swappable_dependency(settings.AUTH_USER_MODEL), | ||
('engine', '0022_auto_20190201_2223'), | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='Plugin', | ||
fields=[ | ||
('name', models.SlugField(max_length=32, primary_key=True, serialize=False)), | ||
('description', cvat.apps.engine.models.SafeCharField(max_length=8192)), | ||
('created_at', models.DateTimeField(auto_now_add=True)), | ||
('updated_at', models.DateTimeField(auto_now_add=True)), | ||
('maintainer', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='maintainers', to=settings.AUTH_USER_MODEL)), | ||
], | ||
options={ | ||
'default_permissions': (), | ||
}, | ||
), | ||
] |
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
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