Autoreference¶
This document is an autogenerated reference for the django_owm package. It provides detailed information about the modules, classes, functions, and methods available in the package.
admin.py¶
Admin for the django_owm app.
apps.py¶
App configuration for the django_owm app.
app_settings.py¶
App settings for the django_owm app.
- django_owm.app_settings.OWM_BASE_MODEL()¶
Get the base model for OWM models.
forms.py¶
Forms for django_owm.
- class django_owm.forms.TrimmedDecimalField(*, max_value=None, min_value=None, max_digits=None, decimal_places=None, **kwargs)[source]¶
Custom DecimalField that trims the value to 2 decimal places.
management/commands/¶
create_location.py¶
Management command to create a new weather location.
delete_location.py¶
Management command to delete a weather location.
list_locations.py¶
Management command to list all weather locations.
manual_weather_fetch.py¶
Management command to manually fetch weather data for a specific location.
models/¶
abstract.py¶
Models for OpenWeatherMap API data storage in django_owm.
- class django_owm.models.abstract.AbstractAPICallLog(*args, **kwargs)[source]¶
Abstract model for storing API call logs.
- Parameters:
timestamp (DateTimeField) – timestamp
api_name (CharField) – api name
units (CharField) – Units
- class django_owm.models.abstract.AbstractCurrentWeather(*args, **kwargs)[source]¶
Abstract model for storing current weather data.
- Parameters:
location_id (ForeignKey) – Location for this weather data
timestamp (DateTimeField) – Unix timestamp converted to DateTime
pressure (IntegerField) – pressure
humidity (IntegerField) – humidity
dew_point (DecimalField) – Dew Point
uvi (DecimalField) – UV Index
clouds (IntegerField) – clouds
wind_speed (DecimalField) – Wind Speed
wind_deg (IntegerField) – wind deg
wind_gust (DecimalField) – Wind Gust
weather_condition_id (IntegerField) – weather condition id
weather_condition_main (CharField) – weather condition main
weather_condition_description (CharField) – Icon description
weather_condition_icon (CharField) – weather condition icon
sunrise (DateTimeField) – sunrise
sunset (DateTimeField) – sunset
temp (DecimalField) – Temperature
feels_like (DecimalField) – Feels Like Temperature
visibility (IntegerField) – visibility
rain_1h (DecimalField) – Precipitation in mm/h
snow_1h (DecimalField) – Snowfall in mm/h
- class django_owm.models.abstract.AbstractDailyWeather(*args, **kwargs)[source]¶
Abstract model for storing daily weather data.
- Parameters:
location_id (ForeignKey) – Location for this weather data
timestamp (DateTimeField) – Unix timestamp converted to DateTime
pressure (IntegerField) – pressure
humidity (IntegerField) – humidity
dew_point (DecimalField) – Dew Point
uvi (DecimalField) – UV Index
clouds (IntegerField) – clouds
wind_speed (DecimalField) – Wind Speed
wind_deg (IntegerField) – wind deg
wind_gust (DecimalField) – Wind Gust
weather_condition_id (IntegerField) – weather condition id
weather_condition_main (CharField) – weather condition main
weather_condition_description (CharField) – Icon description
weather_condition_icon (CharField) – weather condition icon
sunrise (DateTimeField) – sunrise
sunset (DateTimeField) – sunset
moonrise (DateTimeField) – moonrise
moonset (DateTimeField) – moonset
moon_phase (DecimalField) – Moon Phase
summary (TextField) – summary
temp_min (DecimalField) – Temperature Min
temp_max (DecimalField) – Temperature Max
temp_morn (DecimalField) – Morning Temperature
temp_day (DecimalField) – Day Temperature
temp_eve (DecimalField) – Evening Temperature
temp_night (DecimalField) – Night Temperature
feels_like_morn (DecimalField) – Feels Like - Morning
feels_like_day (DecimalField) – Feels Like - Day
feels_like_eve (DecimalField) – Feels Like - Evening
feels_like_night (DecimalField) – Feels Like - Night
pop (DecimalField) – Probability of Precipitation
rain (DecimalField) – Rain
snow (DecimalField) – Snow
- property moon_phase_description¶
Return a description of the moon phase.
- class django_owm.models.abstract.AbstractHourlyWeather(*args, **kwargs)[source]¶
Abstract model for storing hourly weather data.
- Parameters:
location_id (ForeignKey) – Location for this weather data
timestamp (DateTimeField) – Unix timestamp converted to DateTime
pressure (IntegerField) – pressure
humidity (IntegerField) – humidity
dew_point (DecimalField) – Dew Point
uvi (DecimalField) – UV Index
clouds (IntegerField) – clouds
wind_speed (DecimalField) – Wind Speed
wind_deg (IntegerField) – wind deg
wind_gust (DecimalField) – Wind Gust
weather_condition_id (IntegerField) – weather condition id
weather_condition_main (CharField) – weather condition main
weather_condition_description (CharField) – Icon description
weather_condition_icon (CharField) – weather condition icon
temp (DecimalField) – Temperature
feels_like (DecimalField) – Feels Like Temperature
visibility (IntegerField) – visibility
pop (DecimalField) – Probability of Precipitation
rain_1h (DecimalField) – Rain (1h)
snow_1h (DecimalField) – Snow (1h)
- class django_owm.models.abstract.AbstractMinutelyWeather(*args, **kwargs)[source]¶
Abstract model for storing minutely weather data.
- Parameters:
location_id (ForeignKey) – Location for this weather data by minute
timestamp (DateTimeField) – Unix timestamp converted to DateTime
precipitation (DecimalField) – Precipitation
- class django_owm.models.abstract.AbstractWeatherAlert(*args, **kwargs)[source]¶
Abstract model for storing weather alerts.
- Parameters:
location_id (ForeignKey) – location
sender_name (CharField) – sender name
event (CharField) – event
start (DateTimeField) – Start time of the alert
end (DateTimeField) – End time of the alert
description (TextField) – description
tags (JSONField) – tags
- class django_owm.models.abstract.AbstractWeatherErrorLog(*args, **kwargs)[source]¶
Abstract model for storing weather API error logs.
- Parameters:
timestamp (DateTimeField) – timestamp
location_id (ForeignKey) – location
api_name (CharField) – api name
error_message (TextField) – error message
response_data (TextField) – response data
- class django_owm.models.abstract.AbstractWeatherLocation(*args, **kwargs)[source]¶
Abstract model for storing weather location data.
- Parameters:
name (CharField) – Location Name
latitude (DecimalField) – Latitude of the location, decimal (−90; 90)
longitude (DecimalField) – Longitude of the location, decimal (−180; 180)
timezone (CharField) – Timezone name for the requested location
timezone_offset (IntegerField) – Offset from UTC in seconds
base.py¶
Base Models for django_owm. These are not meant to be used directly.
- class django_owm.models.base.AbstractBaseWeatherData(*args, **kwargs)[source]¶
Abstract base model for storing weather data. Not intended to be used directly.
- Parameters:
location_id (ForeignKey) – Location for this weather data
timestamp (DateTimeField) – Unix timestamp converted to DateTime
pressure (IntegerField) – pressure
humidity (IntegerField) – humidity
dew_point (DecimalField) – Dew Point
uvi (DecimalField) – UV Index
clouds (IntegerField) – clouds
wind_speed (DecimalField) – Wind Speed
wind_deg (IntegerField) – wind deg
wind_gust (DecimalField) – Wind Gust
weather_condition_id (IntegerField) – weather condition id
weather_condition_main (CharField) – weather condition main
weather_condition_description (CharField) – Icon description
weather_condition_icon (CharField) – weather condition icon
- property icon_url¶
Return the URL for the weather condition icon.
- property large_icon_url¶
Return the URL for the weather condition icon.
- property weather_description¶
Return the weather description.
concrete.py¶
Optional concrete models for django_owm app.
tasks.py¶
Celery tasks for fetching weather data from OpenWeatherMap API for django_owm.
urls.py¶
URLs for the django_owm app.
utils/¶
api.py¶
Utility functions for working with the OpenWeatherMap API.
- django_owm.utils.api.check_api_limits(func)[source]¶
Decorator to check API call limits before running a task.
- django_owm.utils.api.get_api_call_counts(api_name)[source]¶
Get the number of API calls made in the last minute and last month.
saving.py¶
Utility functions for saving weather data to the database.
- django_owm.utils.saving.save_alerts(location, data)[source]¶
Save weather alerts to the database.
- Parameters:
location (AbstractWeatherLocation)
- Return type:
None
- django_owm.utils.saving.save_current_weather(location, data)[source]¶
Save current weather data to the database.
- Parameters:
location (AbstractWeatherLocation)
- Return type:
None
- django_owm.utils.saving.save_daily_weather(location, data)[source]¶
Save daily weather data to the database.
- Parameters:
location (AbstractWeatherLocation)
- Return type:
None
- django_owm.utils.saving.save_error_log(location, api_name, error_message, response_data=None)[source]¶
Save error log to the database.
- Parameters:
location (AbstractWeatherLocation)
api_name (str)
error_message (str)
- Return type:
None
- django_owm.utils.saving.save_hourly_weather(location, data)[source]¶
Save hourly weather data to the database.
- Parameters:
location (AbstractWeatherLocation)
- Return type:
None
- django_owm.utils.saving.save_minutely_weather(location, data)[source]¶
Save minutely weather data to the database.
- Parameters:
location (AbstractWeatherLocation)
- Return type:
None
- django_owm.utils.saving.save_weather_data(location, data)[source]¶
Save weather data to the database.
- Parameters:
location (AbstractWeatherLocation)
- Return type:
None
validators.py¶
Validators for the models of the django_owm app.
views.py¶
Views for the django_owm app.
- django_owm.views.list_locations(request)[source]¶
View to display a list of all weather locations with an optional map.
- django_owm.views.weather_alerts(request, location_id)[source]¶
View to display weather alerts for a location.
- django_owm.views.weather_alerts_partial(request, location_id)[source]¶
Partial view to display weather alerts for a location inside weather_detail.html.
- django_owm.views.weather_detail(request, location_id)[source]¶
View to display the weather details for a location.
- django_owm.views.weather_errors(request, location_id)[source]¶
View to display weather errors for a location.
- django_owm.views.weather_errors_partial(request, location_id)[source]¶
Partial view to display weather errors for a location inside weather_detail.html.
- django_owm.views.weather_forecast(request, location_id)[source]¶
View to display weather forecast for a location.
- django_owm.views.weather_forecast_partial(request, location_id)[source]¶
Partial view to display weather forecast for a location inside weather_detail.html.