-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes to be committed: new file: biocompute/__init__.py new file: biocompute/admin.py new file: biocompute/apis.py new file: biocompute/migrations/__init__.py new file: biocompute/models.py new file: biocompute/selectors.py new file: biocompute/services.py new file: biocompute/urls.py
- Loading branch information
1 parent
8fdb62a
commit 4cde8dc
Showing
8 changed files
with
81 additions
and
0 deletions.
There are no files selected for viewing
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,10 @@ | ||
"""BioCompute Object Admin Pannel | ||
""" | ||
|
||
from django.contrib import admin | ||
from biocompute.models import Bco | ||
|
||
# class BioComputeAdmin(admin.ModelAdmin): | ||
# list_display = ["", ""] | ||
|
||
admin.site.register(Bco) |
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 @@ | ||
#biocompute/apis.py |
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,63 @@ | ||
#!/usr/bin/env python3 | ||
# biocompute/models.py | ||
|
||
import sys | ||
from django.db import models | ||
from django.conf import settings | ||
from django.contrib.auth.models import Group, User | ||
from django.db.models.signals import post_save | ||
from django.dispatch import receiver | ||
from django.utils import timezone | ||
from rest_framework.authtoken.models import Token | ||
from prefix.models import Prefix | ||
|
||
STATE_CHOICES = [ | ||
("REFERENCED", "referenced"), | ||
("PUBLISHED", "published"), | ||
("DRAFT", "draft"), | ||
("DELETE", "delete") | ||
] | ||
|
||
class Bco(models.Model): | ||
"""BioComput Object Model. | ||
Attributes: | ||
----------- | ||
object_id: str | ||
BCO Object Identifier, and primary key | ||
contents: JSONField | ||
BCO JSON contents | ||
authorized_group: ManyToManyField(Group) | ||
String representing the django.contrib.auth.models.Group that 'owns' the object | ||
owner_user = ForeignKey(User) | ||
String representing the django.contrib.auth.models.User that 'owns' the object | ||
prefix: str | ||
Prefix for the BCO | ||
state:str | ||
State of object. REFERENCED, PUBLISHED, DRAFT, and DELETE are currently accepted values. | ||
last_update: DateTime | ||
Date Time object for the last database change to this object | ||
""" | ||
|
||
object_id = models.TextField(primary_key=True) | ||
contents = models.JSONField() | ||
prefix = models.ForeignKey(Prefix, on_delete=models.CASCADE, to_field="prefix") | ||
owner = models.ForeignKey( | ||
User, | ||
on_delete=models.CASCADE, | ||
related_name="owned_bcos" | ||
) | ||
authorized_users = models.ManyToManyField( | ||
User, | ||
related_name="authorized_bcos", | ||
blank=True | ||
) | ||
authorized_groups = models.ManyToManyField(Group,blank=True) | ||
state = models.CharField(max_length=20, choices=STATE_CHOICES, default="DRAFT") | ||
last_update = models.DateTimeField() | ||
access_count = models.IntegerField(default=0) | ||
|
||
def __str__(self): | ||
"""String for representing the BCO model (in Admin site etc.).""" | ||
return str(self.object_id) |
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,7 @@ | ||
# biocompute/urls.py | ||
|
||
from django.urls import path | ||
|
||
urlpatterns = [ | ||
|
||
] |