Plugins » History » Version 1
  Philippe May, 12/11/2018 16:54 
  
| 1 | 1 | Philippe May | h1. Plugins | 
|---|---|---|---|
| 2 | 1 | Philippe May | |
| 3 | 1 | Philippe May | When building the model registry, Gisaf reads module with a specific entry point: @gisaf_extras.models@. | 
| 4 | 1 | Philippe May | |
| 5 | 1 | Philippe May | h2. Example | 
| 6 | 1 | Philippe May | |
| 7 | 1 | Philippe May | @setup.py@ file of a Pyhton module: | 
| 8 | 1 | Philippe May | |
| 9 | 1 | Philippe May | <pre> | 
| 10 | 1 | Philippe May | from setuptools import setup, find_packages | 
| 11 | 1 | Philippe May | setup( | 
| 12 | 1 | Philippe May | name='gisaf_foo_extras', | 
| 13 | 1 | Philippe May | packages=find_packages(), | 
| 14 | 1 | Philippe May | version='2018.1', | 
| 15 | 1 | Philippe May |     entry_points={ | 
| 16 | 1 | Philippe May | 'gisaf_extras.models': [ | 
| 17 | 1 | Philippe May | 'foo = models.foo:FooBar', | 
| 18 | 1 | Philippe May | ] | 
| 19 | 1 | Philippe May | } | 
| 20 | 1 | Philippe May | ) | 
| 21 | 1 | Philippe May | </pre> | 
| 22 | 1 | Philippe May | |
| 23 | 1 | Philippe May | Model defined in @models/foo.py@: | 
| 24 | 1 | Philippe May | |
| 25 | 1 | Philippe May | <pre> | 
| 26 | 1 | Philippe May | from gisaf.database import db | 
| 27 | 1 | Philippe May | from gisaf.models_base import GeoPolygonModel | 
| 28 | 1 | Philippe May | |
| 29 | 1 | Philippe May | class FooBar(GeoPolygonModel): | 
| 30 | 1 | Philippe May | __tablename__ = 'foobar' | 
| 31 | 1 | Philippe May |     __table_args__ = {'schema' : 'other_foobar'} | 
| 32 | 1 | Philippe May | name = db.Column(db.String) | 
| 33 | 1 | Philippe May | </pre> |