Updates to new slice backend, and updated access permissions.
This commit is contained in:
parent
d9f56196f2
commit
e19e0fe659
20
qrtr_account/migrations/0009_auto_20210211_0202.py
Normal file
20
qrtr_account/migrations/0009_auto_20210211_0202.py
Normal file
@ -0,0 +1,20 @@
|
||||
# Generated by Django 3.1.3 on 2021-02-11 02:02
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('contenttypes', '0002_remove_content_type_name'),
|
||||
('qrtr_account', '0008_auto_20210211_0136'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='slice',
|
||||
name='parent_type',
|
||||
field=models.ForeignKey(limit_choices_to=models.Q(models.Q(('app_label', 'qrtr_account'), ('model', 'bank')), models.Q(('app_label', 'qrtr_account'), ('model', 'slice')), _connector='OR'), null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype'),
|
||||
),
|
||||
]
|
||||
20
qrtr_account/migrations/0010_auto_20210211_0202.py
Normal file
20
qrtr_account/migrations/0010_auto_20210211_0202.py
Normal file
@ -0,0 +1,20 @@
|
||||
# Generated by Django 3.1.3 on 2021-02-11 02:02
|
||||
|
||||
from django.db import migrations, models
|
||||
import django.db.models.deletion
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('contenttypes', '0002_remove_content_type_name'),
|
||||
('qrtr_account', '0009_auto_20210211_0202'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='slice',
|
||||
name='parent_type',
|
||||
field=models.ForeignKey(blank=True, limit_choices_to=models.Q(models.Q(('app_label', 'qrtr_account'), ('model', 'bank')), models.Q(('app_label', 'qrtr_account'), ('model', 'slice')), _connector='OR'), null=True, on_delete=django.db.models.deletion.CASCADE, to='contenttypes.contenttype'),
|
||||
),
|
||||
]
|
||||
18
qrtr_account/migrations/0011_auto_20210211_0203.py
Normal file
18
qrtr_account/migrations/0011_auto_20210211_0203.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.1.3 on 2021-02-11 02:03
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('qrtr_account', '0010_auto_20210211_0202'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='slice',
|
||||
name='parent_id',
|
||||
field=models.PositiveIntegerField(null=True),
|
||||
),
|
||||
]
|
||||
18
qrtr_account/migrations/0012_slice_description.py
Normal file
18
qrtr_account/migrations/0012_slice_description.py
Normal file
@ -0,0 +1,18 @@
|
||||
# Generated by Django 3.1.3 on 2021-02-11 02:35
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('qrtr_account', '0011_auto_20210211_0203'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='slice',
|
||||
name='description',
|
||||
field=models.TextField(blank=True, max_length=255, null=True),
|
||||
),
|
||||
]
|
||||
@ -60,6 +60,7 @@ class Slice(models.Model):
|
||||
name = models.CharField(max_length=250)
|
||||
icon = models.CharField(max_length=250)
|
||||
budget = models.DecimalField(decimal_places=3, max_digits=100)
|
||||
description = models.TextField(max_length=255, null=True, blank=True)
|
||||
avail_parents = models.Q(
|
||||
app_label='qrtr_account',
|
||||
model='bank') | models.Q(
|
||||
@ -68,8 +69,8 @@ class Slice(models.Model):
|
||||
parent_type = models.ForeignKey(
|
||||
ContentType,
|
||||
limit_choices_to=avail_parents,
|
||||
on_delete=models.CASCADE)
|
||||
parent_id = models.PositiveIntegerField()
|
||||
on_delete=models.CASCADE, null=True, blank=True)
|
||||
parent_id = models.PositiveIntegerField(null=True)
|
||||
is_unsliced = models.BooleanField(default=False)
|
||||
slice_of = GenericForeignKey('parent_type', 'parent_id')
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
from django.shortcuts import render
|
||||
from rest_framework import viewsets, mixins
|
||||
from .models import Account, Bank, Institution, Transaction, Slice, Rule
|
||||
from rest_framework.permissions import IsAuthenticated
|
||||
from connection.models import Connection, ConnectionType
|
||||
from api.serializers import (AccountReadSerializer, AccountWriteSerializer,
|
||||
BankSerializer, BankSerializerPOST,
|
||||
@ -46,6 +47,13 @@ class BankViewSet(viewsets.ModelViewSet):
|
||||
return BankSerializer
|
||||
|
||||
|
||||
class SliceViewSet(viewsets.ModelViewSet):
|
||||
"""API endpoint that allows Banks to be viewed.
|
||||
"""
|
||||
queryset = Slice.objects.all()
|
||||
serializer_class = SliceSerializer
|
||||
|
||||
|
||||
class InstitutionViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
"""API endpoint that allows Banks to be viewed.
|
||||
"""
|
||||
@ -53,20 +61,13 @@ class InstitutionViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
serializer_class = InstitutionSerializer
|
||||
|
||||
|
||||
class TransactionViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
class TransactionViewSet(viewsets.ModelViewSet):
|
||||
"""API endpoint that allows Banks to be viewed.
|
||||
"""
|
||||
queryset = Transaction.objects.all()
|
||||
serializer_class = TransactionSerializer
|
||||
|
||||
|
||||
class SliceViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
"""API endpoint that allows Banks to be viewed.
|
||||
"""
|
||||
queryset = Slice.objects.all()
|
||||
serializer_class = SliceSerializer
|
||||
|
||||
|
||||
class RuleViewSet(viewsets.ReadOnlyModelViewSet):
|
||||
"""API endpoint that allows Banks to be viewed.
|
||||
"""
|
||||
|
||||
Loading…
Reference in New Issue
Block a user