class IucnData(models.Model): iucnid = models.IntegerField(primary_key=True) species = models.ForeignKey(Species) iucn_status = models.CharField(max_length=4, blank=True, null=True) red_list_criteria = models.CharField(max_length=100, blank=True, null=True) year_assessed = models.IntegerField(blank=True, null=True) population_trend = models.CharField(max_length=60, blank=True, null=True) population_estimate = models.IntegerField(blank=True, null=True) population_range = FloatRangeField(blank=True, null=True) population_uncertainty = models.CharField(max_length=10, blank=True, null=True) population_location = models.CharField(max_length=30, blank=True, null=True) def __unicode__(self): return self.species_id + " | " + str(self.year_assessed) class Meta: managed = False db_table = 'iucn_data' verbose_name = 'IUCN data' verbose_name_plural = 'IUCN data'
class NumericTraits(models.Model): feature_id = models.IntegerField(primary_key=True) species = models.ForeignKey(Species) traits = models.CharField(max_length=30) mean = models.DecimalField(max_digits=10, decimal_places=4, blank=True, null=True) range = FloatRangeField (blank=True, null=True) uncertainty = models.CharField(max_length=10, blank=True, null=True) units = models.CharField(max_length=20) comments = models.TextField(blank=True, null=True) study_year = models.CharField(blank=True, null=True,max_length=300) study_location = models.CharField(blank=True, null=True,max_length=300) cite = models.ForeignKey(Citation) username = models.CharField(max_length=30) dt = models.CharField(max_length=30) def __unicode__(self): return self.species_id + " | " + self.traits + " | " + self.cite_id class Meta: db_table = 'numeric_traits' verbose_name = "Numeric Traits" verbose_name_plural = "Numeric Traits"
class MineralType(models.Model): """ Defines the mineral type model. This model is used as a ManyToMany-field inside the Handpiece model. """ CLEAVAGE_CHOICES = ( ('PE', _("perfect")), ('LP', _("less perfect")), ('GO', _("good")), ('DI', _("distinct")), ('ID', _("indistinct")), ('NO', _("none")), ) LUSTRE_CHOICES = ( ('AM', _("adamantine lustre")), ('DL', _("dull lustre")), ('GR', _("greasy lustre")), ('MT', _("metallic lustre")), ('PY', _("pearly lustre")), ('SL', _("silky lustre")), ('SM', _("submetallic lustre")), ('VT', _("vitreous lustre")), ('WY', _("waxy lustre")), ) FRACTURE_CHOICES = ( ('CF', _("conchoidal")), ('EF', _("earthy")), ('HF', _("hackly")), ('SF', _("splintery")), ('UF', _("uneven")), ) trivial_name = models.CharField(max_length=100, blank=True, verbose_name=_("trivial name")) systematics = models.ForeignKey("TreeNode", related_name="mineraltypes", on_delete=models.DO_NOTHING, null=True) variety = models.CharField(max_length=100, blank=True, verbose_name=_("variety")) minerals = models.CharField(max_length=100, blank=True, verbose_name=_("minerals")) mohs_scale = FloatRangeField(null=True, blank=True) density = FloatRangeField(null=True, blank=True) streak = models.CharField(max_length=100, verbose_name=_("streak")) normal_color = models.CharField(max_length=100, verbose_name=_("normal color")) fracture = ChoiceArrayField(models.CharField( max_length=2, choices=FRACTURE_CHOICES, ), null=True, verbose_name=_("fracture")) lustre = ChoiceArrayField(models.CharField( max_length=2, choices=LUSTRE_CHOICES, ), null=True, verbose_name=_("lustre")) chemical_formula = models.CharField(max_length=100, verbose_name=_("chemical formula")) other = models.TextField(max_length=500, blank=True, verbose_name=_("comment")) resource_mindat = models.CharField(max_length=100, blank=True, verbose_name=_("MinDat ID")) resource_mineralienatlas = models.CharField( max_length=100, blank=True, verbose_name=_("MineralienAtlas ID")) created_at = models.DateTimeField(auto_now_add=True, verbose_name=_("created at")) last_modified = models.DateTimeField(auto_now=True, verbose_name=_("last modified")) class Meta: verbose_name = _("mineral type") verbose_name_plural = _("mineral types") def __str__(self): return self.trivial_name
class Person(models.Model): gender = models.CharField(max_length=1, choices=GENDER_CHOICES) # Jards Macalé is an amazing brazilian musician! =] enjoy_jards_macale = models.BooleanField(default=True) like_metal_music = models.BooleanField(default=False) name = models.CharField(max_length=30) nickname = models.SlugField(max_length=36) age = models.IntegerField() bio = models.TextField() birthday = models.DateField() birth_time = models.TimeField() appointment = models.DateTimeField() blog = models.URLField() occupation = models.CharField(max_length=10, choices=OCCUPATION_CHOICES) uuid = models.UUIDField(primary_key=False) name_hash = models.BinaryField(max_length=16) days_since_last_login = models.BigIntegerField() duration_of_sleep = models.DurationField() email = models.EmailField() id_document = models.CharField(unique=True, max_length=10) try: from django.db.models import JSONField data = JSONField() except ImportError: # Skip JSONField-related fields pass try: from django.contrib.postgres.fields import ArrayField, HStoreField from django.contrib.postgres.fields import JSONField as PostgresJSONField from django.contrib.postgres.fields.citext import ( CICharField, CIEmailField, CITextField, ) from django.contrib.postgres.fields.ranges import ( BigIntegerRangeField, DateRangeField, DateTimeRangeField, IntegerRangeField, ) if settings.USING_POSTGRES: acquaintances = ArrayField(models.IntegerField()) postgres_data = PostgresJSONField() hstore_data = HStoreField() ci_char = CICharField(max_length=30) ci_email = CIEmailField() ci_text = CITextField() int_range = IntegerRangeField() bigint_range = BigIntegerRangeField() date_range = DateRangeField() datetime_range = DateTimeRangeField() except ImportError: # Skip PostgreSQL-related fields pass try: from django.contrib.postgres.fields.ranges import FloatRangeField if settings.USING_POSTGRES: float_range = FloatRangeField() except ImportError: # Django version greater or equal than 3.1 pass try: from django.contrib.postgres.fields.ranges import DecimalRangeField if settings.USING_POSTGRES: decimal_range = DecimalRangeField() except ImportError: # Django version lower than 2.2 pass if BAKER_GIS: geom = models.GeometryField() point = models.PointField() line_string = models.LineStringField() polygon = models.PolygonField() multi_point = models.MultiPointField() multi_line_string = models.MultiLineStringField() multi_polygon = models.MultiPolygonField() geom_collection = models.GeometryCollectionField()