Skip to content

Commit

Permalink
init
Browse files Browse the repository at this point in the history
  • Loading branch information
myavuzokumus committed Dec 14, 2023
1 parent fec913c commit 9078072
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions api/models.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
from django.db import models
class WeatherInfo(models.Model):
city = models.CharField(max_length=255)
currentWeather = models.CharField(max_length=30)

instantTemperature = models.IntegerField(default=10)
dayTemperature = models.IntegerField(default=10)
nightTemperature = models.IntegerField(default=10)
feelsLike = models.IntegerField(default=10)
humidity = models.IntegerField(default=10)

timestamp = models.DateTimeField(auto_now=True)

def __str__(self):
return (f""
f"City: {self.city}")

class DailyWeather(models.Model):
city = models.ForeignKey(WeatherInfo, on_delete=models.CASCADE, related_name="daily")
date = models.DateField()
dayWeather = models.CharField(max_length=30)
nightWeather = models.CharField(max_length=30)

dayTemperature = models.IntegerField(default=10)
nightTemperature = models.IntegerField(default=10)
humidity = models.IntegerField(default=10)

class HourlyWeather(models.Model):
city = models.ForeignKey(WeatherInfo, on_delete=models.CASCADE, related_name="hourly")
hour = models.CharField(max_length=4)
weatherType = models.CharField(max_length=30)

temperature = models.IntegerField(default=10)

0 comments on commit 9078072

Please sign in to comment.