Files
sf_lactorapi/animals/models.py
2019-01-01 19:46:17 +01:00

27 lines
796 B
Python

from django.db import models
# Create your models here.
#animalnr INTEGER UNIQUE NOT NULL,
#earmark CHAR (25) NOT NULL,
#rfid INTEGER,
#forbidmilk CHAR (1) default '0'
#, tsforbidstart timestamp (14), tsforbidend timestamp (14));
class Animal (models.Model):
"""
Amimal Model
Defines the attributes of a animal
"""
animalnr = models.IntegerField (primary_key = True)
earmark = models.CharField (max_length = 25)
rfid = models.CharField (max_length = 25)
forbidmilk = models.CharField (max_length = 1)
forbidmilkstart = models.DateTimeField (auto_now_add = False, null = True)
forbidmilkend = models.DateTimeField (auto_now = False, null = True)
def get_forbidmilk (self):
return self.forbidmilk
def __repr__(self):
return self.animalnr + ' is added.'