Package madrona :: Package features :: Class Link
[hide private]

Class Link

source code

Instance Methods [hide private]
 
__init__(self, rel, title, view, method='GET', select='single', type=None, slug=None, generic=False, models=None, extra_kwargs={}, confirm=False, edits_original=None, must_own=False, limit_to_groups=None) source code
 
_validate_view(self, view)
Ensures view has a compatible signature to be able to hook into the features app url registration facilities
source code
 
can_user_view(self, user, is_owner)
Returns True/False depending on whether user can view the link.
source code
 
url_name(self)
Links are registered with named-urls.
source code
 
parent_slug(self)
Returns either the slug of the only model this view applies to, or 'generic'
source code
 
reverse(self, instances)
Can be used to get the url for this link.
source code
 
__str__(self) source code
 
__unicode__(self) source code
 
dict(self, user, is_owner) source code
 
json(self) source code
Instance Variables [hide private]
  rel
Type of link - alternate, related, edit, or edit_form.
  view
View function handling requests to this link.
  title
Human-readable title for the link to be shown in the user interface.
  method
For rel=edit links, identifies whether a form should be requested or that url should just be POST'ed to.
  type
MIME type of this link, useful for alternate links.
  slug
Part of this link's path.
  select
Determines whether this link accepts requests with single or multiple instances of a feature class.
  extra_kwargs
Extra keyword arguments to pass to the view.
  generic
Whether this view can be applied to multiple feature classes.
  models
List of feature classes that a this view can be applied to, if it is generic.
  confirm
Confirmation message to show the user before POSTing to rel=edit link
  edits_original
Set to false for editing links that create a copy of the original.
  must_own
Whether this link should be accessible to non-owners.
  limit_to_groups
Allows you to specify groups (a list of group names) that should have access to the link.
Method Details [hide private]

_validate_view(self, view)

source code 

Ensures view has a compatible signature to be able to hook into the 
features app url registration facilities

For single-select views
    must accept a second argument named instance
For multiple-select views
    must accept a second argument named instances

Must also ensure that if the extra_kwargs option is specified, the 
view can handle them

url_name(self)

source code 

Links are registered with named-urls. This function will return that name so that it can be used in calls to reverse().

Decorators:
  • @property

parent_slug(self)

source code 

Returns either the slug of the only model this view applies to, or 'generic'

Decorators:
  • @property

reverse(self, instances)

source code 

Can be used to get the url for this link.

In the case of select=single links, just pass in a single instance. In the case of select=multiple links, pass in an array.


Instance Variable Details [hide private]

type

MIME type of this link, useful for alternate links. May in the future be used to automatically assign an icon in the dropdown Export menu.

select

Determines whether this link accepts requests with single or multiple instances of a feature class. Valid values are "single", "multiple", "single multiple", and "multiple single".

edits_original

Set to false for editing links that create a copy of the original. This will allow users who do not own the instance(s) but can view them perform the action.

must_own

Whether this link should be accessible to non-owners. Default link behavior is False; i.e. Link can be used for shared features as well as for user-owned features. If edits_original is true, this implies must_own = True as well.

limit_to_groups

Allows you to specify groups (a list of group names) that should have access to the link. Default is None; i.e. All users have link access regardless of group membership