class INTERPRETATION(models.Model):
	class Meta:
		pass

	description = None
	tier = None

	concerns = models.ManyToMany('MORPHOLOGY')
	concerns = models.ManyToMany('TOPOGRAPHY')
	 = models.ForeingKey('GENE', on_delete=models.PROTECT)
Example #2
0
class Bowl(models.Model):

    bowlID = models.CharField(max_length=8)

    owner = models.ForeignKey('Person', related_name="bowlOwner")
    caretakers = models.ManyToMany('Person',related_name="bowlMods")

    petsToServe = models.ManyToMany('Bowl')

    maxCapacity = models.IntegerField(max_length=5)
    currentCapacity = models.IntegerField(max_length=5)
Example #3
0
class Chat(models.Model):
    participants = models.ManyToMany(Contacts,related_name="chats")
    messages = models.ManyToMany(Message,blank=True)


    def last_20_messages(self):

        return self.messages.objects.order_by("-created_at").all()[:20]
        
    
    def __str__(slef):
        return str(self.id)
Example #4
0
class Post(models.Model):
    """
    文章表的数据有些复杂,涉及的字段较多。
    而且还需要实现与Tag、Category表的关联
    """

    # 文章标题字段
    title = models.CharField(max_length=70)

    # 正文字段
    # 由于正文较长,需要使用TextFiele类型
    body = models.TextField()

    # 创建时间和修改时间字段
    created_time = models.DateTimeField()
    modified_time = models.DateTimeField()

    # 文章摘要字段
    # 这是一个可选字段,也即可以是空的,需要指定blank=True
    excerpt = models.CharField(max_length=200, blank=True)

    # 还需要分类和标签字段
    # 这两个字段需要与分类、标签表相关联
    # 由于一篇文章只能对应一个分类,但是一个分类下可以存在多篇文章,也即1对多的关联关系,实现方式为ForeignKey
    # 对于标签而言,一个文章可以存在多个标签,一个标签下也可以存在多篇文章,为多对多的关联关系,实现方式为ManyToMany
    # 同时,文章必须分类,但是可以没有标签,因此tags字段需要指定blank=True
    category = models.ForeignKey(Category)
    tags = models.ManyToMany(Tag, blank=True)

    # 文章作者字段
    # 文章和作者之间也是1对多关联关系
    author = models.ForeignKey(User)
Example #5
0
class Order(models.Model):
    orderitems = models.ManyToMany(Cart)
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    ordered = models.BooleanField(default=False)
    created = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return self.user.username
class REFERENCE(models.Model):
    class Meta:
        pass

    type = None
    description = None

    describes = models.ManyToMany('INTERPRETATION')
class REFERENCE(models.Model):
	class Meta:
		pass

	type = None
	description = None

	gives_details = models.ManyToMany('DRUG_EFFECT')
class DRUG_EFFECT(models.Model):
    class Meta:
        pass

    description = None
    tier = None
    level = None
    actionable = None

    advises = models.ManyToMany('DRUG')
Example #9
0
class VARIANT(models.Model):
    class Meta:
        pass

    alteration = None
    protein_change = None
    oncogenicity = None
    mutation_effect = None
    full_name = None

    influences = models.ManyToMany('TRANSCRIPT')
Example #10
0
class Pet(models.Model):

    # there could currently be only one owner to a pet.
    owner = models.ForeignKey('Person', related_name = 'petOwner')
    caretakers = models.ManyToMany('Person',related_name='petMods')

    profilePic= models.ImageField(upload_to='petProfilePic',blank=True)
    name = models.CharField(max_length=50)

    rfid= models.IntegerField(max_length=30)

    statistics = models.OneToOneField('PetStats')

    schedule = models.ForeignKey('FoodSchedule')
Example #11
0
class Songs(models.Model):
	""" 
	Songs model class
	The purpose of this class is to define the Songs data model.
	author: Ike
	subclasses: Meta (with ordering by name)
	
	"""
	song_name = models.CharField(max_length=100)
	genre = models.ForeignKey(Genres, null=True)
	artists = models.ManyToMany(Artists)

	def __str__(self):
		return '{}'.format(self.song_name)
Example #12
0
class Albums(models.Model):

	""" 
	Albums model class
	The purpose of this class is to define the Albums data model.
	author: Ike
	subclasses: Meta (with ordering by name)
	"""
	name = models.CharField(max_length=55)
	price = models.DecimalField(max_digits=8, decimal_places=2)
	description = models.CharField(max_length=140)
	song_Id = models.ForeignKey(Songs, null=True)
	artists = models.ManyToMany(Artists)

	def __str__(self):
		return '{} {} {} {}'.format(self.name, self.price, self.description, self.song_Id, self.artists)
Example #13
0
class Oppurtunity(WhoAndWhenBase):
    title = models.CharField(max_length=255, unique=True)
    gender = models.CharField(max_length=6,
                              choices=(
                                  ('male', _('Male')),
                                  ('female', _('Female')),
                                  ('any', _('Any')),
                                  ('other', _('Other')),
                              ))
    application_cost = models.IntegerField()
    application_deadline = models.DateField()
    benefit_description = models.TextField()
    agency_contact_name = models.CharField(max_length=255)
    agency_contact_phone = models.CharField(max_length=255)
    agency_contact_email = models.EmailField()
    minimum_years_in_business = models.IntegerField()
    additional_information = models.TextField()
    investing_own_money = models.BooleanField()
    money_invested = models.CharField(max_length=255)
    agency = models.ForeignKey(Agency)
    requirement = models.ManyToMany(Requirement)
    age_min = models.IntegerField()
    age_max = models.IntegerField(null=True, blank=True)
    employees_min = models.IntegerField()
    employees_max = models.IntegerField(null=True, blank=True)
    annual_revenue_min = models.IntegerField()
    annual_revenue_max = models.IntegerField(null=True, blank=True)

    _average_application_time = models.CharField(max_length=255, blank=True)
    """
    Convert to Many to Many with a single field for location.
    eligibleBusinessLocation     | character varying(255)[] | not null

    Use this tutorial https://bradmontgomery.net/blog/nice-arrayfield-widgets-choices-and-chosenjs/
    eligibleEntityTypes          | character varying(255)[] | not null
    eligibleIndustries           | character varying(255)[] | not null
    additionalDemographics       | character varying(255)[] |
    benefitType                  | character varying(255)[] | not null default ARRAY['incentive'::character varying]
    purpose                      | text[]                   | not null default ARRAY['anything'::text]

    """
    def __str__(self):
        return self.title

    class Meta:
        verbose_name_plural = 'Oppurtunities'
Example #14
0
class Artists(models.Model):
	"""Artists model class
		The purpose of this class is to define the Artists data model.
		author: Ike
		methods: __str__ Returns a string
		subclasses: Meta (with ordering by last_name)
	"""
	
	first_name = models.CharField(max_length=50, default='')
	last_name = models.CharField(max_length =50)
	created_date = models.DateTimeField(auto_now_add=True)
	genres = models.ManyToMany(Genres)

	class Meta:
		ordering = ('last_name',)

	def __str__(self):
		return '{} {} {} {} {} {} {}'.format(self.first_name, self.last_name, self.created_date)
Example #15
0
class Nodes(models.Model):
    node_name = models.CharField(max_length=200)
    node_links = models.ManyToMany(Relationship)
Example #16
0
class Categoria(models.Model):
	nome=models.CharField('nome', max_length=15)
	chamado=models.ManyToMany(Chamado)

	def __str__(self):
		return "Categoria: "+self.nome
Example #17
0
class Deamon(models.Model):
    ip = models.IPAddressField(_("IP"))
    port = models.IntegerField(_("port"))
    owner = models.ForeignKey(User, blank=True, null=True)
    data_send = models.ManyToMany(AnalysePeptide, through=DeamonCalculation)
Example #18
0
class UserMembership(models.Model):
    user_id = models.ManyToMany(User)
    group_id = models.ManyToMany(Group)
    is_admin = models.BooleanField(default=false)
Example #19
0
class Contacts(models.Model):
    user = models.ForeignKey(User, related_name="friends", on_delete=models.CASCADE)
    friends =models.ManyToMany("self",blank=True)

    def __str__(self):
        return self.user.username