Ejemplo n.º 1
0
def add_new_weather(currentCity,pm25,data,Picture,the_weather,temperature,today_or_future=1):
    """
    currentCity:城市名
    pm25:PM25值
    data:日期
    Picture:图片
    the_weather:天气
    temperature:温度
    today_or_future=1:今天还是未来(今天为:1,未来为:2),默认为今天
    :return:
    """
    weather = Weather()  # 实例化新的天气
    weather.currentCity = currentCity
    weather.pm25 = pm25
    weather.data = data
    weather.Picture = Picture
    weather.the_weather = the_weather
    weather.temperature = temperature
    weather.today_or_future = today_or_future
    weather.save()