Skip to main content

A Django ORM interface to operate with PyOWM domain entities

Project description

# Django PyOWM

A Django ORM interface for PyOWM domain entities

## Requirements

- Django 1.10+
- PyOWM 2.5+

Python 2.7 is supported.

** Please notice that the API can be unstable as this project is still in beta testing **

## Install

Install the library with `pip`:

$ pip install django_pyowm

Then add `django_pyowm` to the `INSTALLED_APPS` list into your Django project's `` file:

'django_pyowm' # <---

Finally generate tables by applying migrations:

$ python makemigrations django_pyowm
$ python migrate

## Features
Models behave as all other Django models but they have a few useful

- `<Model_class>.from_entity(entity)` - creates a PyOWM model instance
from the corresponding PyOWM domain object instance
- `<Model_instance>.to_entity(entity)` - turns the model instance to
the corresponding PyOWM domain object instance
- `<Model_class>.save_all()` - persists the model instance along with all related objects

## Quick usage examples

from pyowm import OWM
from django_pyowm import models

# Get data an Observation from the API
owm = OWM(API_key='my_key')
obs = owm.weather_at_place('London,UK')

# Create a model instance from API response
m = models.Observation.from_entity(obs)

# Save related objects and then the model itself

# .. or save everything in one shot

# From model instance to entity
original_obs = m.to_entity()

## Testing
All details about testing are [here](

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_pyowm-0.2.0.tar.gz (9.5 kB view hashes)

Uploaded source

Built Distribution

django_pyowm-0.2.0-py2.7.egg (21.8 kB view hashes)

Uploaded 2 7

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page