drought_backup/dashboard/models.py

202 lines
8.9 KiB
Python
Raw Normal View History

2018-07-06 09:04:06 +00:00
import uuid
2018-07-06 06:08:28 +00:00
from django.db import models
# Create your models here.
2018-07-06 09:04:06 +00:00
from django.urls import reverse
2018-07-06 13:31:05 +00:00
from django.utils import timezone
2018-07-06 09:04:06 +00:00
class Country(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4)
name = models.CharField('区域', max_length=256, null=False)
2018-07-06 11:59:04 +00:00
parent_name = models.CharField('上级区域', max_length=256, null=True, blank=True)
2018-07-06 09:04:06 +00:00
level = models.CharField('级别', max_length=256, null=True, blank=True)
datetime = models.CharField('时间', max_length=256, null=True, blank=True)
area = models.FloatField('区域面积', null=True, blank=True)
arable_land_area = models.FloatField('耕地面积', null=True, blank=True)
population = models.FloatField('总人口', null=True, blank=True)
agricultural_population = models.FloatField('农业人口', null=True, blank=True)
gross_national_product = models.FloatField('国民生产总值', null=True, blank=True)
total_agricultural_output = models.FloatField('农业生产总值', null=True, blank=True)
arable_land_per_capita = models.FloatField('每一乡村人口占有耕地', null=True, blank=True)
added = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
def get_absolute_url(self):
2018-07-06 10:27:06 +00:00
return reverse('data-country-detail', kwargs={'pk': self.pk})
2018-07-06 09:04:06 +00:00
def __str__(self):
return self.name
2018-07-06 10:27:06 +00:00
class Spi(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4())
code = models.CharField('区站号', max_length=256, null=False)
longitude = models.FloatField('经度', null=True, blank=True)
latitude = models.FloatField('纬度', null=True, blank=True)
year = models.IntegerField('年份', null=True, blank=True)
month = models.IntegerField('月份', null=True, blank=True)
mean_precipitation = models.FloatField('月平均降水', null=True, blank=True)
mean_temperature = models.FloatField('月平均温度', null=True, blank=True)
added = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
def get_absolute_url(self):
return reverse('data-spi-detail', kwargs={'pk': self.pk})
def __str__(self):
return self.code
2018-07-06 11:59:04 +00:00
class Hydro(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4())
name = models.CharField('站名', max_length=256, null=False)
date = models.DateTimeField('时间', null=True, blank=True)
average_water_level = models.FloatField('逐日平均水位', null=True, blank=True)
average_flow_rate = models.FloatField('逐日平均流量', null=True, blank=True)
precipitation = models.FloatField('逐日降水量', null=True, blank=True)
added = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
def get_absolute_url(self):
return reverse('data-hydro-detail', kwargs={'pk': self.pk})
def __str__(self):
return self.name
class Landuse(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4())
name = models.CharField('县区', max_length=256, null=False)
date = models.IntegerField('时间', null=True, blank=True)
Cultivated_land_area = models.IntegerField('年末常用耕地面积', null=True, blank=True)
Irrigated_land = models.IntegerField('水浇地', null=True, blank=True)
eatch_land = models.FloatField('每一乡村人口占有耕地', null=True, blank=True)
eatch_Irrigated_land = models.FloatField('水浇地', null=True, blank=True)
added = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
def get_absolute_url(self):
return reverse('data-landuse-detail', kwargs={'pk': self.pk})
def __str__(self):
return self.name
class Finance(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4())
region = models.CharField('区域', max_length=256, null=False)
level = models.CharField('级别', max_length=256, null=True, blank=True)
date = models.IntegerField('时间', null=True, blank=True)
financial_revenue = models.IntegerField('地方财政收入', null=True, blank=True)
tax_revenue = models.IntegerField('税收收入', null=True, blank=True)
2018-07-06 13:31:05 +00:00
value_added_tax = models.IntegerField('增值税', null=True, blank=True)
sales_tax = models.IntegerField('营业税', null=True, blank=True)
corporate_income_tax = models.IntegerField('企业所得税', null=True, blank=True)
individual_income_tax = models.IntegerField('个人所得税(款)', null=True, blank=True)
resource_tax = models.IntegerField('资源税', null=True, blank=True)
urban_maintenance_construction_tax = models.IntegerField('城市维护建设税', null=True, blank=True)
property_tax = models.IntegerField('房产税', null=True, blank=True)
stamp_duty = models.IntegerField('印花税', null=True, blank=True)
urban_land_use_tax = models.IntegerField('城镇土地使用税', null=True, blank=True)
land_value_added_tax = models.IntegerField('土地增值税', null=True, blank=True)
vehicle_vessel_tax = models.IntegerField('车船税(款)', null=True, blank=True)
arable_land_occupancy_tax = models.IntegerField('耕地占用税(款)', null=True, blank=True)
deed_tax = models.IntegerField('契税(款)', null=True, blank=True)
tobacco_tax = models.IntegerField('烟叶税(款)', null=True, blank=True)
non_tax_revenue = models.IntegerField('非税收入', null=True, blank=True)
2018-07-06 12:53:41 +00:00
added = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
def get_absolute_url(self):
return reverse('data-finance-detail', kwargs={'pk': self.pk})
def __str__(self):
return self.region
2018-07-06 13:31:05 +00:00
class Popu(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4())
region = models.CharField('区域', max_length=256, null=False)
date = models.IntegerField('时间', null=True, blank=True)
permanent_population = models.IntegerField('常住人口', null=True, blank=True)
households = models.IntegerField('总户数', null=True, blank=True)
census_register_population = models.FloatField('户籍人口', null=True, blank=True)
male = models.FloatField('男性', null=True, blank=True)
female_sex = models.FloatField('女性', null=True, blank=True)
birth_rate = models.FloatField('出生率', null=True, blank=True)
mortality = models.FloatField('死亡率', null=True, blank=True)
growth_rate = models.FloatField('人口自然增长率', null=True, blank=True)
urbanization_rate = models.FloatField('常住人口城镇化率', null=True, blank=True)
added = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
2018-07-06 12:53:41 +00:00
2018-07-06 13:31:05 +00:00
def get_absolute_url(self):
return reverse('data-popu-detail', kwargs={'pk': self.pk})
2018-07-06 12:53:41 +00:00
2018-07-06 13:31:05 +00:00
def __str__(self):
return self.region
2018-07-06 14:13:29 +00:00
class Crop(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4())
county_area = models.CharField('县区',max_length=256,null=False)
date = models.IntegerField('时间',null=True,blank=True)
seeded_area = models.IntegerField('播种面积(亩)',null=True,blank=True)
growth_rate1 = models.FloatField('比上年增长(%)',null=True,blank=True)
yield1 = models.IntegerField('产量(吨)',null=True,blank=True)
growth_rate2 = models.FloatField('比上年增长(%)',null=True,blank=True)
seeded_area = models.IntegerField('播种面积(亩)',null=True,blank=True)
growth_rate3 = models.FloatField('比上年增长(%)', null=True, blank=True)
yield2 = models.IntegerField('产量(吨)', null=True, blank=True)
growth_rate4 = models.FloatField('比上年增长(%)', null=True, blank=True)
added = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
def get_absolute_url(self):
return reverse('data-crop-detail', kwargs={'pk': self.pk})
def __str__(self):
return self.county_area
class Admdiv(models.Model):
id = models.UUIDField('id', primary_key=True, default=uuid.uuid4())
county_area = models.CharField('县区',max_length=256,null=False)
date = models.IntegerField('时间',null=True,blank=True)
government = models.IntegerField('镇人民政府',null=True,blank=True)
villager_committee = models.IntegerField('村民委员会',null=True,blank=True)
street_office = models.IntegerField('街道办事处',null=True,blank=True)
residents_committee = models.IntegerField('居民委员会',null=True,blank=True)
land_area = models.FloatField('土地面积',null=True,blank=True)
proportion = models.FloatField('比重(%)',null=True,blank=True)
added = models.DateTimeField(auto_now_add=True)
updated = models.DateTimeField(auto_now=True)
def get_absolute_url(self):
return reverse('data-admdiv-detail', kwargs={'pk': self.pk})
def __str__(self):
return self.county_area