class filling_tank(models.Model): state_time = models.FloatField(default=10.0) high_level_sensor = models.ForeignField(variable) high_level_active_value = models.BooleanField(default=True) bottom_level_sensor = models.ForeignField(variable) bottom_level_active_value = models.BoobleanField(default=False) filling_element = models.ForeignField(variable)
class Operation(models.Model): equipment = models.ForeignField(Equipment, blank=True, null=True) action = models.ForeignField(Equipment, blank=True, null=True) person = models.ForeignField(Equipment, blank=True, null=True) date = models.DateTimeField(auto_now=True) def __str__(self): return self.equipment.model + " " + self.action.name
class Category(models.Model): name models.CharField(max_length=250, db_index=True, unique=True, blank=True, default="", verbose_name='Название') title = models.CharField(max_length=250, blank=True, verbose_name='Заголовок в браузере') metakey = models.CharField(max_length=250, blank=True, verbose_name='Ключевые слова') metadesc = models.CharField(max_length=250, blank=True, verbose_name='Мета описание') slug = models.CharField(max_length=250, unique=True, blank=True, verbose_name='Урл') parent = models.ForeignField('self', blank=True, null=True, verbose_name='Родительская категория') published = models.BooleanField(verbose_name='Опубликован', default=0) ordering = models.IntegerField(verbose_name='Порядок сортировки', default=0, blank=True, null=True) count_posts = models.IntegerField(verbose_name='Количество постов', default=0, blank=True, null=True) @property def name2(self): return self.name + self.title def save(self): super(Category, self).save() def ger_url(self): return "/blog/%s" % self.slug def __str__(self): return self.name class Meta: verbose_name_plural="Категории" verbose_name="Категории" ordering = ['ordering']
class Country(models.Model): place = models.OneToOneField( Place, related_name='country', ) tld = models.CharField(max_length=100, ) cca2 = models.CharField(max_length=2, ) cca3 = models.CharField(max_length=3, ) ccn3 = models.CharField(max_length=3, ) world_region = models.ForeignField( Place, related_name='countries_world_region', ) world_sub_region = models.ForeignField( Place, related_name='countries_world_sub_region')
class Project(models.Model): type = models.ForeignField( PlaceType, related_name='projects', ) name = models.CharField( max_length=100, )
class Equipment(models.Model): type = models.CharField(choices=EEQUIPMENT_TYPE, blank=True, null=True) model = models.CharField(choices=MODEL, blank=True, null=True) bought = models.DateField(blank=True, null=True) qr_code = models.CharField(max_lenght=550 ,blank=True, null=True) building = models.ForeignField(Building, blank=True, null=True) def __str__(self): return self.name
class PlaceAltName(models.Model): place = models.ForeignField(Place, related_name='place_alt_names') alt_name = models.CharField(max_length=100, ) class Meta: unique_together = (( 'place', 'alt_name', ), )
class CountryCurrency(models.Model): country = models.ForeignField(Country, related_name='country_currencies') currency = models.CharField(max_length=100, )
class CountryCallingCode(models.Model): country = models.ForeignField(Country, related_name='country_calling_codes') calling_code = models.CharField(max_length=100, )