Skip to content
Snippets Groups Projects
Commit cfb81ae4 authored by Nico Vermaas's avatar Nico Vermaas
Browse files

merging Zheng's changes from esap-gateway-auth into easp-gateway-dev

parent d3240cd0
No related branches found
No related tags found
1 merge request!12merging Zheng's changes from esap-gateway-auth (via easp-gateway-dev)
......@@ -14,10 +14,12 @@ Including another URLconf
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import include, path
from django.urls import include, path, re_path
urlpatterns = [
path('esap-api/', include('api.urls')),
path('esap-api/admin/', admin.site.urls, name='admin-view'),
path('esap-api/api-auth/', include('rest_framework.urls')),
path('api/', include('rucio.api.urls')),
path('accounts/', include('accounts.urls')),
re_path('^oidc/', include('mozilla_django_oidc.urls')),
]
from django.contrib import admin
# Register your models here.
from rest_framework import serializers
from rucio.models import Staging
class StagingSerializer(serializers.ModelSerializer):
class Meta:
model = Staging
fields = '__all__'
\ No newline at end of file
from rest_framework import routers
from .views import StagingViewSet
router = routers.DefaultRouter()
router.register('staging', StagingViewSet, 'staging')
urlpatterns = router.urls
\ No newline at end of file
from rest_framework import viewsets, permissions
from .serializers import StagingSerializer
class StagingViewSet(viewsets.ModelViewSet):
serializer_class = StagingSerializer
permission_classes = [permissions.IsAuthenticated]
def get_queryset(self):
return self.request.user.staging.all()
def perform_create(self, serializer):
serializer.save(owner=self.request.user)
\ No newline at end of file
from django.apps import AppConfig
class RucioConfig(AppConfig):
name = 'rucio'
# Generated by Django 3.0.2 on 2020-05-11 20:15
from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
]
operations = [
migrations.CreateModel(
name='Staging',
fields=[
('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
('task', models.CharField(max_length=255)),
('owner', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, related_name='staging', to=settings.AUTH_USER_MODEL)),
],
),
]
from django.db import models
from django.contrib.auth.models import User
class Staging(models.Model):
task = models.CharField(max_length=255)
owner = models.ForeignKey(
User, related_name="staging", on_delete=models.CASCADE, null=True)
def __str__(self):
return self.task
\ No newline at end of file
from django.test import TestCase
# Create your tests here.
from django.shortcuts import render
# Create your views here.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment