Skip to content

Commit

Permalink
Adds relationships between request model and research products (#526)
Browse files Browse the repository at this point in the history
  • Loading branch information
djperrefort authored Feb 18, 2025
1 parent cd11068 commit 3b5d4e4
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 0 deletions.
16 changes: 16 additions & 0 deletions docs/api.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5309,6 +5309,14 @@ components:
type: array
items:
type: integer
publications:
type: array
items:
type: integer
grants:
type: array
items:
type: integer
required:
- description
- id
Expand Down Expand Up @@ -5581,6 +5589,14 @@ components:
type: array
items:
type: integer
publications:
type: array
items:
type: integer
grants:
type: array
items:
type: integer
PatchedAllocationReview:
type: object
description: Object serializer for the `AllocationReview` class.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Generated by Django 5.1.5 on 2025-02-18 20:53

from django.db import migrations, models


class Migration(migrations.Migration):

dependencies = [
('allocations', '0011_rename_allocationrequestreview_allocationreview'),
('research_products', '0003_remove_grant_group_remove_publication_group'),
]

operations = [
migrations.AddField(
model_name='allocationrequest',
name='grants',
field=models.ManyToManyField(blank=True, to='research_products.grant'),
),
migrations.AddField(
model_name='allocationrequest',
name='publications',
field=models.ManyToManyField(blank=True, to='research_products.publication'),
),
]
3 changes: 3 additions & 0 deletions keystone_api/apps/allocations/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
from django.template.defaultfilters import truncatechars

from apps.allocations.managers import AllocationManager
from apps.research_products.models import Grant, Publication
from apps.users.models import Team, User

__all__ = [
Expand Down Expand Up @@ -80,6 +81,8 @@ class StatusChoices(models.TextChoices):

team: Team = models.ForeignKey(Team, on_delete=models.CASCADE)
assignees: User = models.ManyToManyField(User, blank=True, related_name='assigned_allocationrequest_set')
publications: Publication = models.ManyToManyField(Publication, blank=True)
grants: Grant = models.ManyToManyField(Grant, blank=True)

def clean(self) -> None:
"""Validate the model instance.
Expand Down

0 comments on commit 3b5d4e4

Please sign in to comment.