django-contentrelations 1.1 documentation
This class provides an abstraction for unifying access to different resources under a common interface. If a resource doesn’t have a FOO attribute, the subclass should defined a get_FOO method that returns the appropriate value.
str Default: ''
The value returned when all methods of retrieving it has failed. Only used if BaseResource.raise_error_on_missing is False
bool Default: False
An AttributeError should be raised when all methods of retrieving it has failed.
object
Set during instantiation, this is the instance used to resolve all attribute requests.
This is the get_FOO method used when attempting to resolve the resource_type attribute. By default it returns the verbose_name of the instance.
This is the get_FOO method used when attempting to resolve the url attribute. by default it returns the value from instance.get_absolute_url()
This class provides the registry of models to their sub-classed BaseResource models. It is instantiated for use in resource_list.
Returns a Q object used for limiting ContentType objects for selection to only those registered.
Parameters: | instance – An instance of a Model |
---|
Returns the registered resource for the passed instance instantiated with that instance.
Parameters: |
|
---|
from contentrelations import resource_list
The instantiated ResourceList used for registering Models with their BaseResource sub-classes.