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`:
```shell
$ pip install django_pyowm
```
Then add `django_pyowm` to the `INSTALLED_APPS` list into your Django project's `settings.py` file:
```python
INSTALLED_APPS = [
...
'django_pyowm' # <---
]
```
Finally generate tables by applying migrations:
```shell
$ python manage.py makemigrations django_pyowm
$ python manage.py migrate
```
## Features
Models behave as all other Django models but they have a few useful
functions:
- `<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
```python
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
m.location.save()
m.weather.save()
m.save()
# .. or save everything in one shot
m.save_all()
# From model instance to entity
original_obs = m.to_entity()
```
## Testing
All details about testing are [here](https://github.com/csparpa/django-pyowm/wiki/Testing)
Metadata
Release files for django-pyowm 0.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_pyowm-0.2.0.tar.gz | 9.5 kB | Without provenance | Details for django_pyowm-0.2.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_pyowm-0.2.0-py2.7.egg | Legacy Egg format | - | - | Details for django_pyowm-0.2.0-py2.7.egg |
Total release size: 31.2 kB
Release files / django_pyowm-0.2.0.tar.gz
| Download URL | django_pyowm-0.2.0.tar.gz |
|---|---|
| Size | 9.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d5ca9bc64a98307fc1a1e4c49cf375d9e487aaa9ab6a9d8436fa30ddd2c315cc
|
|
BLAKE2b-256 checksum How to use checksums |
16de8663a13d0b7052f9e52608892a693abb41619070372b01e2a0b6f8c25ad3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Release files / django_pyowm-0.2.0-py2.7.egg
| Download URL | django_pyowm-0.2.0-py2.7.egg |
|---|---|
| Size | 21.8 kB |
| Tags | Egg |
|
SHA-256 checksum How to use checksums |
5b2715448a2e345ac8fa4def727fa772a383adddf5bc8f50639c38fb03253de9
|
|
BLAKE2b-256 checksum How to use checksums |
6fec937099134bb9bf5bb207d08c09460c7e69da2a24398ec711db98c333c1d3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for django-pyowm 0.2.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.