Last updated:
0 purchases
djangopyowm 0.2.0
# Django PyOWMA 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 **## InstallInstall the library with `pip`:```shellYou can't use 'macro parameter character #' in math modeYou can't use 'macro parameter character #' in math mode python manage.py makemigrations django_pyowm$ python manage.py migrate```## FeaturesModels 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```pythonfrom pyowm import OWMfrom 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 responsem = models.Observation.from_entity(obs)# Save related objects and then the model itselfm.location.save()m.weather.save()m.save()# .. or save everything in one shotm.save_all()# From model instance to entityoriginal_obs = m.to_entity()```## TestingAll details about testing are [here](https://github.com/csparpa/django-pyowm/wiki/Testing)
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.