Skip to content
Snippets Groups Projects
Commit c6ab9e7b authored by abeaugrand's avatar abeaugrand
Browse files

models team with doc for sphinx

parent f0e6bfa9
No related branches found
Tags 3.4
No related merge requests found
# -*- coding: utf-8 -*-
"""ThaliaDB is developed by the ABI-SOFT team of GQE-Le Moulon INRA unit
""" LICENCE
ThaliaDB is developed by the ABI-SOFT team of GQE-Le Moulon INRA unit
Copyright (C) 2017, Guy-Ross Assoumou, Lan-Anh Nguyen, Olivier Akmansoy, Alice Beaugrand, Yannick De-Oliveira, Delphine Steinbach
......@@ -17,6 +18,7 @@
You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
LICENCE
"""
from django.db import models
......@@ -30,13 +32,33 @@ from commonfct.constants import METHOD_TYPE, DOCUMENT_TYPE
from team.managers import UserManager
class GenomeVersion(models.Model):
"""
The GenomeVersion model give information about the genome version.
:var CharField name: the name of the genome version
:var TextField description: the description of the genome version
"""
name = models.CharField(max_length=100, db_index=True)
description = models.TextField(max_length=500, blank=True, null=True)
def __str__(self):
return self.name
class Institution(models.Model):
"""
The Institution model give information about the institution.
:var CharField name: the name of the institution
:var CharField acronym: the short name of the institution
:var TextField address: the location of the institution
:var CharField postal_code: the postal code of the institution
:var CharField country: the country from where is the institution
:var URLField web_site: the address where can be found the web site of the institution
:var EmailField email_address: the email address of the institution
"""
name = models.CharField(max_length=200, unique=True)
acronym = models.CharField(max_length=50, blank=True, null=True)
address = models.TextField(max_length=500, blank=True, null=True)
......@@ -50,12 +72,28 @@ class Institution(models.Model):
return self.name
class Person(models.Model):
"""
The Person model give information about the person.
:var CharField first_name: the first name of the person
:var CharField last_name: the last name of the person
:var TextField initial: the initial (first letters of the first name and of the last name) of the person
:var CharField title_of_person: the title of the person
:var CharField other_language: the other language which might be spoken by the person
:var CharField work_phone: the phone number from work where the person can be found
:var CharField work_extension: the work extension of the person (useless field)
:var CharField fax_number: the fax number of the person
:var EmailField email_address: the email address of the person
:var TextField note_on_person: description about the person (useless field)
:var ManyToManyField institutions: institution where the person is from
"""
first_name = models.CharField(max_length=200)
last_name = models.CharField(max_length=200)
initial = models.CharField(max_length=25,blank=True, null=True)
title_of_person = models.CharField(max_length=25, blank=True, null=True)
other_langage = models.CharField(max_length=25, blank=True, null=True)
other_language = models.CharField(max_length=25, blank=True, null=True)
work_phone = models.CharField(max_length=25, blank=True, null=True)
work_extension = models.CharField(max_length=25, blank=True, null=True)
fax_number = models.CharField(max_length=25, blank=True, null=True)
......@@ -70,7 +108,23 @@ class Person(models.Model):
unique_together=("first_name","last_name")
class User(AbstractBaseUser):
"""
The User model give information about the user.
:var CharField person: the real name of the user
:var CharField login: the login of the user
:var DateField start_date: the date when the account of the user is activated
:var DateField end_date: the date when the account of the user is closed
:var BooleanField is_team_admin: check if the user is admin for the team app
:var BooleanField is_accession_admin: check if the user is admin for the accession app
:var BooleanField is_seedlot_admin: check if the user is admin for the seedlot app
:var BooleanField is_genotyping_admin: check if the user is admin for the genotyping app
:var BooleanField is_phenotyping_admin: check if the user is admin for the phenotyping app
:var BooleanField is_classification_admin: check if the user is admin for the classification app
:var ForeignKey genome_version: the fax number of the person
"""
person = models.OneToOneField('Person')
login = models.CharField(max_length=50, unique=True)
start_date = models.DateField(auto_now_add=True)
......@@ -116,12 +170,30 @@ class User(AbstractBaseUser):
fs = FileSystemStorage(location='/var/store/thaliadbv3')
class Documents(models.Model):
"""
The Documents model give information about the documents.
:var CharField name: the name of the document
:var IntegerField type: the type of the document
"""
name = models.CharField(max_length=200, unique=True)
type = models.IntegerField(choices=DOCUMENT_TYPE)
def __str__(self):
return self.name
class DataFile(models.Model):
"""
The DataFile model give information about the datafile.
:var FileField datafile: the datafile to load
:var ForeignKey document: the document to link to the datafile
:var ForeignKey source: the source of the datafile
:var DateField date: the date of submission of the datafile
:var TextField comments: the description of the datafile
:var CharField version: the version of the datafile
"""
datafile = models.FileField(upload_to='./team/', storage=fs)
document = models.ForeignKey('Documents', blank=True, null=True)
source = models.ForeignKey('Person')
......@@ -132,6 +204,19 @@ class DataFile(models.Model):
unique_together = ("version","document")
class Project(models.Model):
"""
The Project model give information about the project.
:var CharField name: the name of the project
:var CharField authors: the authors who made the project
:var DateField start_date: the beginning date of the project
:var DateField end_date: the ending date of the project
:var TextField description: the description of the project
:var ManyToManyField users: the users who have rights on the project
:var ManyToManyField institutions: the institution where the project has been created
:var ManyToManyField linked_files: the files linked to the project
"""
name = models.CharField(max_length=200, unique=True)
authors = models.CharField(max_length=200)
start_date = models.DateField()
......@@ -151,6 +236,14 @@ class Project(models.Model):
# favorite = models.BooleanField(default=True)
class Method(models.Model):
"""
The Method model give information about the method.
:var CharField name: the name of the method
:var IntegerField type: the type of the method
:var TextField description: the description of the method
"""
name = models.CharField(max_length=200, unique=True)
type = models.IntegerField(choices=METHOD_TYPE, null=True)
description = models.TextField(max_length=500, blank=True, null=True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment