-
Notifications
You must be signed in to change notification settings - Fork 14
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
1 parent
b10b758
commit 73f3406
Showing
48 changed files
with
271 additions
and
56 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,17 @@ | ||
Django==2.2.3 | ||
Django==2.2.14 | ||
django-filter==2.2.0 | ||
djangorestframework==3.10.2 | ||
Markdown==2.6.11 | ||
djangorestframework==3.10.3 | ||
Markdown==3.2.1 | ||
drfdocs==0.0.11 | ||
django-cors-headers==3.0.2 | ||
Faker==0.8.17 | ||
factory-boy==2.10.0 | ||
django-import-export==1.2.0 | ||
django-import-export==2.0.1 | ||
django-anymail==6.1 | ||
coreapi==2.3.3 | ||
django-orderable==6.0.1 | ||
django-ckeditor==5.7.1 | ||
django-reversion==3.0.3 | ||
xlrd==1.2.0 | ||
xlwt==1.3.0 | ||
openpyxl==3.0.3 |
Empty file.
Empty file.
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,15 @@ | ||
from rest_framework import permissions | ||
|
||
|
||
class IsAdminOrReadOnly(permissions.BasePermission): | ||
""" | ||
Custom permission to only allow admins to modify objects. | ||
""" | ||
|
||
def has_permission(self, request, view): | ||
# Read permissions are allowed to any request, | ||
# so we'll always allow GET, HEAD or OPTIONS requests. | ||
if request.method in permissions.SAFE_METHODS: | ||
return True | ||
|
||
return request.user.is_staff |
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
4 changes: 2 additions & 2 deletions
4
source/apiVolontaria/apiVolontaria/tests/tests_model_ActionToken.py
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
4 changes: 2 additions & 2 deletions
4
source/apiVolontaria/apiVolontaria/tests/tests_model_Profile.py
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
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
Empty file.
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,11 @@ | ||
from django.contrib import admin | ||
|
||
from .models import CKEditorPage | ||
|
||
|
||
@admin.register(CKEditorPage) | ||
class CKEditorPageAdmin(admin.ModelAdmin): | ||
readonly_fields = ( | ||
'updated_at', | ||
'created_at' | ||
) |
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,5 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class CkeditorApiConfig(AppConfig): | ||
name = 'ckeditor_api' |
24 changes: 24 additions & 0 deletions
24
source/apiVolontaria/ckeditor_api/migrations/0001_initial.py
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 @@ | ||
# Generated by Django 2.2.10 on 2020-03-18 21:25 | ||
|
||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
|
||
initial = True | ||
|
||
dependencies = [ | ||
] | ||
|
||
operations = [ | ||
migrations.CreateModel( | ||
name='CKEditorPage', | ||
fields=[ | ||
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')), | ||
('key', models.CharField(max_length=255, unique=True, verbose_name='Key')), | ||
('data', models.TextField(blank=True, verbose_name='Data')), | ||
('created_at', models.DateTimeField(auto_now_add=True, verbose_name='Created at')), | ||
('updated_at', models.DateTimeField(auto_now=True, verbose_name='Updated at')), | ||
], | ||
), | ||
] |
Empty file.
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,29 @@ | ||
from django.db import models | ||
from django.utils.translation import ugettext_lazy as _ | ||
|
||
|
||
class CKEditorPage(models.Model): | ||
|
||
key = models.CharField( | ||
verbose_name=_('Key'), | ||
unique=True, | ||
max_length=255 | ||
) | ||
|
||
data = models.TextField( | ||
verbose_name=_('Data'), | ||
blank=True | ||
) | ||
|
||
created_at = models.DateTimeField( | ||
verbose_name=_('Created at'), | ||
auto_now_add=True | ||
) | ||
|
||
updated_at = models.DateTimeField( | ||
verbose_name=_('Updated at'), | ||
auto_now=True | ||
) | ||
|
||
def __str__(self): | ||
return self.key |
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,13 @@ | ||
from rest_framework import serializers | ||
|
||
from .models import ( | ||
CKEditorPage | ||
) | ||
|
||
|
||
class CKEditorPageSerializer(serializers.HyperlinkedModelSerializer): | ||
id = serializers.ReadOnlyField() | ||
|
||
class Meta: | ||
model = CKEditorPage | ||
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,23 @@ | ||
from rest_framework.routers import SimpleRouter | ||
from django.urls import path | ||
from django.conf.urls import include | ||
|
||
from . import views | ||
|
||
|
||
class OptionalSlashSimpleRouter(SimpleRouter): | ||
""" Subclass of SimpleRouter to make the trailing slash optional """ | ||
|
||
def __init__(self, *args, **kwargs): | ||
super(SimpleRouter, self).__init__(*args, **kwargs) | ||
self.trailing_slash = '/?' | ||
|
||
|
||
app_name = "ckeditor_api" | ||
|
||
ckeditor_router = OptionalSlashSimpleRouter() | ||
ckeditor_router.register('ckeditor_page', views.CKEditorPageViewSet) | ||
|
||
urlpatterns = [ | ||
path('', include(ckeditor_router.urls)), # includes router generated URL | ||
] |
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,16 @@ | ||
from rest_framework import viewsets | ||
|
||
from apiVolontaria import permissions | ||
from .models import ( | ||
CKEditorPage | ||
) | ||
|
||
from . import serializers | ||
|
||
|
||
class CKEditorPageViewSet(viewsets.ModelViewSet): | ||
|
||
serializer_class = serializers.CKEditorPageSerializer | ||
queryset = CKEditorPage.objects.all() | ||
filterset_fields = '__all__' | ||
permission_classes = [permissions.IsAdminOrReadOnly] |
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
2 changes: 1 addition & 1 deletion
2
source/apiVolontaria/location/tests/tests_model_StateProvince.py
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
Oops, something went wrong.