This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Provides inspection conveniences for django models.

Features

Convenience attributes

all_fields
All model fields, including all relationships (back and forth).
fields
Only local fields, ie. any regular field and relationships (excluding backwards).
non_rel_fields
Basically the same thing as fields, but excluding all relationships.
fk_fields
Local foreign key fields.
backwards_fk_fields
Only backwards foreign key fields.
all_fk_fields
All foreign key fields (back and forth).
m2m_fields
Local many to many fields.
backwards_m2m_fields
Only backwards many to many fields.
all_m2m_fields
All many to many fields (back and forth).

Sub-inspecting

Futher inspection on relationship fields.

After inspecting a model (creating an Inspect instance) call:

inspect.sub_inspect("field")

Paths are supported too:

inspect.sub_inspect("field.other_field..")

It returns a new Inspect instance, containing information about the target model of the relationship field.

Installation

Available through pip:

$ pip install django-inspect

Usage

Simple inspection

from django.contrib.auth.models import User

from django_inspect import Inspect

inspect = Inspect(User)

# Using an instance/object is also possible.
# user = User()
# inspect = Inspect(user)

inspect.fields
[u'id', 'password', 'last_login', 'is_superuser', 'username',
 'first_name', 'last_name', 'email', 'is_staff', 'is_active',
 'date_joined', 'groups', 'user_permissions']

inspect.non_rel_fields
[u'id', 'password', 'last_login', 'is_superuser', 'username',
 'first_name', 'last_name', 'email', 'is_staff', 'is_active',
 'date_joined']

inspect.m2m_fields
['groups', 'user_permissions']

inspect.backwards_fk_fields
['logentry_set']

Sub-inspecting

from django.contrib.auth.models import User

from django_inspect import Inspect

inspect = Inspect(User)

sub_inspect = inspect.sub_inspect("user_permissions")

sub_inspect.all_fields
[u'id', 'name', 'content_type', 'codename']

futher_inspect = sub_inspect.sub_inspect("content_type")
futher_inspect.all_fields
[u'id', 'name', 'app_label', 'model']

# Sub-inspecting by path

sub_inspect = inspect.sub_inspect("user_permissions.content_type")

sub_inspect.all_fields
[u'id', 'name', 'app_label', 'model']

Testing

Install

Run make install to install dev requirements.

Run tests

Run make test to run tests.

Release History

Release History

0.4.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.3.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.3.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-inspect-0.4.1.tar.gz (4.4 kB) Copy SHA256 Checksum SHA256 Source Nov 19, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting