---
slug: "permission-test-for-model-in-django-template"
title: "Check Model Permissions within Templates in Django"
description: "Here is an example of using Django's template language to check if a logged-in user has permissions for a model.\n\nThe template variable `perms` is available by default, and you can use it to make this determination."
url: "https://www.ytyng.com/en/blog/permission-test-for-model-in-django-template"
publish_date: "2023-08-08T11:52:38Z"
created: "2023-08-08T11:52:38Z"
updated: "2026-02-26T01:13:07.932Z"
categories: []
keywords: ""
featured_image_url: "https://media.ytyng.com/resize/20250705/ca22b55a7798471db3fa5b80cedf76bb.png.webp?width=768"
has_video: true
has_music: true
video_urls: ["https://media.ytyng.net/ytyng-blog/289/featured-video-1.mp4", "https://media.ytyng.net/ytyng-blog/289/featured-video-2.mp4", "https://media.ytyng.net/ytyng-blog/289/featured-video-3.mp4"]
music_urls: ["https://media.ytyng.net/ytyng-blog/289/featured-music-289-3.mp3", "https://media.ytyng.net/ytyng-blog/289/featured-music-289-4.mp3"]
lang: "en"
---

# Check Model Permissions within Templates in Django

Here is an example of determining whether a logged-in user has permissions for a model using Django's template language.

There is a default template variable called `perms`, which can be used to make this determination.

```html
{% if perms.myapp.view_mymodel %}
  <li class="nav-item">
    <a href="{% url 'admin:myapp_mymodel_changelist' %}" class="nav-link">Admin Page</a>
  </li>
{% endif %}
```
