%PDF- %PDF-
Direktori : /usr/lib/python2.7/site-packages/salt/pillar/ |
Current File : //usr/lib/python2.7/site-packages/salt/pillar/django_orm.pyc |
� ���^c @@ s� d Z d d l m Z m Z m Z d d l Z d d l Z d d l Z d d l Z d d l m Z d d l Z e Z y d d l Z e Z Wn e k r� n Xe j e � Z d � Z d d d � Z d S( uk Generate Pillar data from Django models through the Django ORM :maintainer: Micah Hausler <micah.hausler@gmail.com> :maturity: new Configuring the django_orm ext_pillar ===================================== To use this module, your Django project must be on the salt master server with database access. This assumes you are using virtualenv with all the project's requirements installed. .. code-block:: yaml ext_pillar: - django_orm: pillar_name: my_application project_path: /path/to/project/ settings_module: my_application.settings env_file: /path/to/env/file.sh # Optional: If your project is not using the system python, # add your virtualenv path below. env: /path/to/virtualenv/ django_app: # Required: the app that is included in INSTALLED_APPS my_application.clients: # Required: the model name Client: # Required: model field to use as the key in the rendered # Pillar. Must be unique; must also be included in the # ``fields`` list below. name: shortname # Optional: # See Django's QuerySet documentation for how to use .filter() filter: {'kw': 'args'} # Required: a list of field names # List items will be used as arguments to the .values() method. # See Django's QuerySet documentation for how to use .values() fields: - field_1 - field_2 This would return pillar data that would look like .. code-block:: yaml my_application: my_application.clients: Client: client_1: field_1: data_from_field_1 field_2: data_from_field_2 client_2: field_1: data_from_field_1 field_2: data_from_field_2 As another example, data from multiple database tables can be fetched using Django's regular lookup syntax. Note, using ManyToManyFields will not currently work since the return from values() changes if a ManyToMany is present. .. code-block:: yaml ext_pillar: - django_orm: pillar_name: djangotutorial project_path: /path/to/mysite settings_module: mysite.settings django_app: mysite.polls: Choices: name: poll__question fields: - poll__question - poll__id - choice_text - votes Module Documentation ==================== i ( t absolute_importt print_functiont unicode_literalsN( t sixc C@ s t S( u Always load ( t True( ( ( s: /usr/lib/python2.7/site-packages/salt/pillar/django_orm.pyt __virtual__q s c ! O@ s$ t j j | � s&