Template tags — django-guardian v1.0.0.beta1 documentation

### Navigation

- index
- modules |
- next |
- previous |
- django-guardian v1.0.0.beta1 documentation »
- API Reference »

# Template tags

`django-guardian` template tags. To use in a template just put the following load tag inside a template:

    {% load guardian_tags %}

## get_obj_perms

`guardian.templatetags.guardian_tags.` `get_obj_perms`(parser, token)

  Returns a list of permissions (as `codename` strings) for a given `user`/`group` and `obj` (Model instance).

  Parses `get_obj_perms` tag which should be in format:

      {% get_obj_perms user/group for obj as "context_var" %}

  Example of usage (assuming `flatpage` and `perm` objects are available from context):

      {% get_obj_perms request.user for flatpage as "flatpage_perms" %}

      {% if "delete_flatpage" in flatpage_perms %}
          <a href="/pages/delete?target={{ flatpage.url }}">Remove page</a>
      {% endif %}

### Navigation

- index
- modules |
- next |
- previous |
- django-guardian v1.0.0.beta1 documentation »
- API Reference »