Skip to content
Luboš Mátl edited this page May 19, 2014 · 27 revisions

This documentation is related to version 0.6.xx

Instalation

You can install django-is-core very simply with command:

pip install https://github.com/matllubos/django-is-core/tarball/master

Settings

Firstly you must add 'is_core' to INSTALLED_APPS and 'is_core.middleware.RequestKwargsMiddleware' to MIDDLEWARE_CLASSES

Simple example

Example of usage you can see in directory example of this repository.

There is one model class Issue

` class Issue(models.Model): title = models.CharField(_('Subject'), max_length=100, null=False, blank=False)

def __unicode__(self):
    return self.title

`

Model RestMeta

It is possible define rest fields inside Model

class RestMeta:
    image_field = 'photo'  
    selectbox_fields = ('pk', '_obj_name') 
    rest_fields = ('email', 'first_name', 'last_name', 'is_active', 'role', 'photo', 'salutation','language_code', 'is_verified')
    default_obj_fields('email', 'first_name', 'last_name') 
    default_list_fields('role', 'email')

image_field

value for related selectbox. If you want show image with options (default: None)

selectbox_fields

fields that should be dowloaded for selectbox (default: ('id', '_obj_name'))

rest_fields

allowed rest fiels (default: all model fields)

default_obj_fields

default fields that is send for one object (can be changed with X-Fields header) (default: default_obj_fields = rest_fields)

default_list_fields

default fields that is send for objects list (can be changed with X-Fields header) (default: default_list_fields = rest_fields)

get meta

You can get RestMeta from model: model._rest_meta

Clone this wiki locally