Sith/reference/core/views/index.html

11693 lines
437 KiB
HTML

<!doctype html>
<html lang="fr" class="no-js">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="description" content="Le site de l'association des étudiants de l'UTBM">
<link rel="canonical" href="https://ae-utbm.github.io/sith/reference/core/views/">
<link rel="prev" href="../model_fields/">
<link rel="next" href="../schemas/">
<link rel="icon" href="../../../img/favicon.png">
<meta name="generator" content="mkdocs-1.6.1, mkdocs-material-9.5.48">
<title>Views - Site AE UTBM</title>
<link rel="stylesheet" href="../../../assets/stylesheets/main.6f8fc17f.min.css">
<link rel="stylesheet" href="../../../assets/stylesheets/palette.06af60db.min.css">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,300i,400,400i,700,700i%7CRoboto+Mono:400,400i,700,700i&display=fallback">
<style>:root{--md-text-font:"Roboto";--md-code-font:"Roboto Mono"}</style>
<link rel="stylesheet" href="../../../assets/_mkdocstrings.css">
<link rel="stylesheet" href="../../../stylesheets/extra.css">
<script>__md_scope=new URL("../../..",location),__md_hash=e=>[...e].reduce(((e,_)=>(e<<5)-e+_.charCodeAt(0)),0),__md_get=(e,_=localStorage,t=__md_scope)=>JSON.parse(_.getItem(t.pathname+"."+e)),__md_set=(e,_,t=localStorage,a=__md_scope)=>{try{t.setItem(a.pathname+"."+e,JSON.stringify(_))}catch(e){}}</script>
</head>
<body dir="ltr" data-md-color-scheme="default" data-md-color-primary="deeppurple" data-md-color-accent="deeppurple">
<input class="md-toggle" data-md-toggle="drawer" type="checkbox" id="__drawer" autocomplete="off">
<input class="md-toggle" data-md-toggle="search" type="checkbox" id="__search" autocomplete="off">
<label class="md-overlay" for="__drawer"></label>
<div data-md-component="skip">
<a href="#core.views.GenericContentPermissionMixinBuilder" class="md-skip">
Aller au contenu
</a>
</div>
<div data-md-component="announce">
</div>
<header class="md-header md-header--shadow" data-md-component="header">
<nav class="md-header__inner md-grid" aria-label="En-tête">
<a href="../../.." title="Site AE UTBM" class="md-header__button md-logo" aria-label="Site AE UTBM" data-md-component="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg>
</a>
<label class="md-header__button md-icon" for="__drawer">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M3 6h18v2H3zm0 5h18v2H3zm0 5h18v2H3z"/></svg>
</label>
<div class="md-header__title" data-md-component="header-title">
<div class="md-header__ellipsis">
<div class="md-header__topic">
<span class="md-ellipsis">
Site AE UTBM
</span>
</div>
<div class="md-header__topic" data-md-component="header-topic">
<span class="md-ellipsis">
Views
</span>
</div>
</div>
</div>
<form class="md-header__option" data-md-component="palette">
<input class="md-option" data-md-color-media="(prefers-color-scheme: light)" data-md-color-scheme="default" data-md-color-primary="deeppurple" data-md-color-accent="deeppurple" aria-label="Switch to dark mode" type="radio" name="__palette" id="__palette_0">
<label class="md-header__button md-icon" title="Switch to dark mode" for="__palette_1" hidden>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17 7H7a5 5 0 0 0-5 5 5 5 0 0 0 5 5h10a5 5 0 0 0 5-5 5 5 0 0 0-5-5m0 8a3 3 0 0 1-3-3 3 3 0 0 1 3-3 3 3 0 0 1 3 3 3 3 0 0 1-3 3"/></svg>
</label>
<input class="md-option" data-md-color-media="(prefers-color-scheme: dark)" data-md-color-scheme="slate" data-md-color-primary="blue" data-md-color-accent="blue" aria-label="Switch to light mode" type="radio" name="__palette" id="__palette_1">
<label class="md-header__button md-icon" title="Switch to light mode" for="__palette_0" hidden>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M17 6H7c-3.31 0-6 2.69-6 6s2.69 6 6 6h10c3.31 0 6-2.69 6-6s-2.69-6-6-6m0 10H7c-2.21 0-4-1.79-4-4s1.79-4 4-4h10c2.21 0 4 1.79 4 4s-1.79 4-4 4M7 9c-1.66 0-3 1.34-3 3s1.34 3 3 3 3-1.34 3-3-1.34-3-3-3"/></svg>
</label>
</form>
<script>var palette=__md_get("__palette");if(palette&&palette.color){if("(prefers-color-scheme)"===palette.color.media){var media=matchMedia("(prefers-color-scheme: light)"),input=document.querySelector(media.matches?"[data-md-color-media='(prefers-color-scheme: light)']":"[data-md-color-media='(prefers-color-scheme: dark)']");palette.color.media=input.getAttribute("data-md-color-media"),palette.color.scheme=input.getAttribute("data-md-color-scheme"),palette.color.primary=input.getAttribute("data-md-color-primary"),palette.color.accent=input.getAttribute("data-md-color-accent")}for(var[key,value]of Object.entries(palette.color))document.body.setAttribute("data-md-color-"+key,value)}</script>
<label class="md-header__button md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg>
</label>
<div class="md-search" data-md-component="search" role="dialog">
<label class="md-search__overlay" for="__search"></label>
<div class="md-search__inner" role="search">
<form class="md-search__form" name="search">
<input type="text" class="md-search__input" name="query" aria-label="Rechercher" placeholder="Rechercher" autocapitalize="off" autocorrect="off" autocomplete="off" spellcheck="false" data-md-component="search-query" required>
<label class="md-search__icon md-icon" for="__search">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M9.5 3A6.5 6.5 0 0 1 16 9.5c0 1.61-.59 3.09-1.56 4.23l.27.27h.79l5 5-1.5 1.5-5-5v-.79l-.27-.27A6.52 6.52 0 0 1 9.5 16 6.5 6.5 0 0 1 3 9.5 6.5 6.5 0 0 1 9.5 3m0 2C7 5 5 7 5 9.5S7 14 9.5 14 14 12 14 9.5 12 5 9.5 5"/></svg>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z"/></svg>
</label>
<nav class="md-search__options" aria-label="Recherche">
<button type="reset" class="md-search__icon md-icon" title="Effacer" aria-label="Effacer" tabindex="-1">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M19 6.41 17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"/></svg>
</button>
</nav>
</form>
<div class="md-search__output">
<div class="md-search__scrollwrap" tabindex="0" data-md-scrollfix>
<div class="md-search-result" data-md-component="search-result">
<div class="md-search-result__meta">
Initialisation de la recherche
</div>
<ol class="md-search-result__list" role="presentation"></ol>
</div>
</div>
</div>
</div>
</div>
<div class="md-header__source">
<a href="https://github.com/ae-utbm/sith" title="Aller au dépôt" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.7.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81"/></svg>
</div>
<div class="md-source__repository">
sith
</div>
</a>
</div>
</nav>
</header>
<div class="md-container" data-md-component="container">
<main class="md-main" data-md-component="main">
<div class="md-main__inner md-grid">
<div class="md-sidebar md-sidebar--primary" data-md-component="sidebar" data-md-type="navigation" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--primary" aria-label="Navigation" data-md-level="0">
<label class="md-nav__title" for="__drawer">
<a href="../../.." title="Site AE UTBM" class="md-nav__button md-logo" aria-label="Site AE UTBM" data-md-component="logo">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M12 8a3 3 0 0 0 3-3 3 3 0 0 0-3-3 3 3 0 0 0-3 3 3 3 0 0 0 3 3m0 3.54C9.64 9.35 6.5 8 3 8v11c3.5 0 6.64 1.35 9 3.54 2.36-2.19 5.5-3.54 9-3.54V8c-3.5 0-6.64 1.35-9 3.54"/></svg>
</a>
Site AE UTBM
</label>
<div class="md-nav__source">
<a href="https://github.com/ae-utbm/sith" title="Aller au dépôt" class="md-source" data-md-component="source">
<div class="md-source__icon md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><!--! Font Awesome Free 6.7.1 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free (Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License) Copyright 2024 Fonticons, Inc.--><path d="M439.55 236.05 244 40.45a28.87 28.87 0 0 0-40.81 0l-40.66 40.63 51.52 51.52c27.06-9.14 52.68 16.77 43.39 43.68l49.66 49.66c34.23-11.8 61.18 31 35.47 56.69-26.49 26.49-70.21-2.87-56-37.34L240.22 199v121.85c25.3 12.54 22.26 41.85 9.08 55a34.34 34.34 0 0 1-48.55 0c-17.57-17.6-11.07-46.91 11.25-56v-123c-20.8-8.51-24.6-30.74-18.64-45L142.57 101 8.45 235.14a28.86 28.86 0 0 0 0 40.81l195.61 195.6a28.86 28.86 0 0 0 40.8 0l194.69-194.69a28.86 28.86 0 0 0 0-40.81"/></svg>
</div>
<div class="md-source__repository">
sith
</div>
</a>
</div>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../.." class="md-nav__link">
<span class="md-ellipsis">
Accueil
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_2" >
<label class="md-nav__link" for="__nav_2" id="__nav_2_label" tabindex="0">
<span class="md-ellipsis">
Explications
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_2_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_2">
<span class="md-nav__icon md-icon"></span>
Explications
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../../explanation/" class="md-nav__link">
<span class="md-ellipsis">
Accueil
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../explanation/technos/" class="md-nav__link">
<span class="md-ellipsis">
Technologies utilisées
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../explanation/conventions/" class="md-nav__link">
<span class="md-ellipsis">
Conventions
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../explanation/archives/" class="md-nav__link">
<span class="md-ellipsis">
Archives
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_3" >
<label class="md-nav__link" for="__nav_3" id="__nav_3_label" tabindex="0">
<span class="md-ellipsis">
Tutoriels
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_3_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_3">
<span class="md-nav__icon md-icon"></span>
Tutoriels
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../../tutorial/install/" class="md-nav__link">
<span class="md-ellipsis">
Installer le projet
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../tutorial/install-advanced/" class="md-nav__link">
<span class="md-ellipsis">
Installer le projet (avancé)
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../tutorial/devtools/" class="md-nav__link">
<span class="md-ellipsis">
Configurer son éditeur
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../tutorial/structure/" class="md-nav__link">
<span class="md-ellipsis">
Structure du projet
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../tutorial/perms/" class="md-nav__link">
<span class="md-ellipsis">
Gestion des permissions
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../tutorial/groups/" class="md-nav__link">
<span class="md-ellipsis">
Gestion des groupes
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../tutorial/fragments/" class="md-nav__link">
<span class="md-ellipsis">
Créer des fragments
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../tutorial/etransaction/" class="md-nav__link">
<span class="md-ellipsis">
Etransactions
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_4" >
<label class="md-nav__link" for="__nav_4" id="__nav_4_label" tabindex="0">
<span class="md-ellipsis">
How-to
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_4_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_4">
<span class="md-nav__icon md-icon"></span>
How-to
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../../howto/querysets/" class="md-nav__link">
<span class="md-ellipsis">
L'ORM de Django
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../howto/migrations/" class="md-nav__link">
<span class="md-ellipsis">
Gérer les migrations
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../howto/translation/" class="md-nav__link">
<span class="md-ellipsis">
Gérer les traductions
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../howto/statics/" class="md-nav__link">
<span class="md-ellipsis">
Gérer les statics
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../howto/js-import-paths/" class="md-nav__link">
<span class="md-ellipsis">
Ajouter un chemin d'import javascript
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../howto/prod/" class="md-nav__link">
<span class="md-ellipsis">
Configurer pour la production
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../howto/logo/" class="md-nav__link">
<span class="md-ellipsis">
Ajouter un logo de promo
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../howto/subscriptions/" class="md-nav__link">
<span class="md-ellipsis">
Ajouter une cotisation
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../howto/weekmail/" class="md-nav__link">
<span class="md-ellipsis">
Modifier le weekmail
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../howto/terminal/" class="md-nav__link">
<span class="md-ellipsis">
Terminal
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../../howto/direnv/" class="md-nav__link">
<span class="md-ellipsis">
Direnv
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--active md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5" checked>
<label class="md-nav__link" for="__nav_5" id="__nav_5_label" tabindex="0">
<span class="md-ellipsis">
Reference
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="1" aria-labelledby="__nav_5_label" aria-expanded="true">
<label class="md-nav__title" for="__nav_5">
<span class="md-nav__icon md-icon"></span>
Reference
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_1" >
<label class="md-nav__link" for="__nav_5_1" id="__nav_5_1_label" tabindex="0">
<span class="md-ellipsis">
accounting
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_1_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5_1">
<span class="md-nav__icon md-icon"></span>
accounting
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../accounting/models/" class="md-nav__link">
<span class="md-ellipsis">
Models
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../accounting/views/" class="md-nav__link">
<span class="md-ellipsis">
Views
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_2" >
<label class="md-nav__link" for="__nav_5_2" id="__nav_5_2_label" tabindex="0">
<span class="md-ellipsis">
antispam
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_2_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5_2">
<span class="md-nav__icon md-icon"></span>
antispam
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../antispam/models/" class="md-nav__link">
<span class="md-ellipsis">
Models
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../antispam/forms/" class="md-nav__link">
<span class="md-ellipsis">
Forms
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_3" >
<label class="md-nav__link" for="__nav_5_3" id="__nav_5_3_label" tabindex="0">
<span class="md-ellipsis">
club
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_3_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5_3">
<span class="md-nav__icon md-icon"></span>
club
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../club/models/" class="md-nav__link">
<span class="md-ellipsis">
Models
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../club/views/" class="md-nav__link">
<span class="md-ellipsis">
Views
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_4" >
<label class="md-nav__link" for="__nav_5_4" id="__nav_5_4_label" tabindex="0">
<span class="md-ellipsis">
com
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_4_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5_4">
<span class="md-nav__icon md-icon"></span>
com
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../com/models/" class="md-nav__link">
<span class="md-ellipsis">
Models
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../com/views/" class="md-nav__link">
<span class="md-ellipsis">
Views
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--active md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_5" checked>
<label class="md-nav__link" for="__nav_5_5" id="__nav_5_5_label" tabindex="0">
<span class="md-ellipsis">
core
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_5_label" aria-expanded="true">
<label class="md-nav__title" for="__nav_5_5">
<span class="md-nav__icon md-icon"></span>
core
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../models/" class="md-nav__link">
<span class="md-ellipsis">
Models
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../model_fields/" class="md-nav__link">
<span class="md-ellipsis">
Champs de modèle
</span>
</a>
</li>
<li class="md-nav__item md-nav__item--active">
<input class="md-nav__toggle md-toggle" type="checkbox" id="__toc">
<label class="md-nav__link md-nav__link--active" for="__toc">
<span class="md-ellipsis">
Views
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<a href="./" class="md-nav__link md-nav__link--active">
<span class="md-ellipsis">
Views
</span>
</a>
<nav class="md-nav md-nav--secondary" aria-label="Table des matières">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table des matières
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#core.views.GenericContentPermissionMixinBuilder" class="md-nav__link">
<span class="md-ellipsis">
GenericContentPermissionMixinBuilder
</span>
</a>
<nav class="md-nav" aria-label="GenericContentPermissionMixinBuilder">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#core.views.GenericContentPermissionMixinBuilder.permission_function" class="md-nav__link">
<span class="md-ellipsis">
permission_function
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#core.views.CanCreateMixin" class="md-nav__link">
<span class="md-ellipsis">
CanCreateMixin
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.CanEditPropMixin" class="md-nav__link">
<span class="md-ellipsis">
CanEditPropMixin
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.CanEditMixin" class="md-nav__link">
<span class="md-ellipsis">
CanEditMixin
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.CanViewMixin" class="md-nav__link">
<span class="md-ellipsis">
CanViewMixin
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserIsRootMixin" class="md-nav__link">
<span class="md-ellipsis">
UserIsRootMixin
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.FormerSubscriberMixin" class="md-nav__link">
<span class="md-ellipsis">
FormerSubscriberMixin
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.SubscriberMixin" class="md-nav__link">
<span class="md-ellipsis">
SubscriberMixin
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.TabedViewMixin" class="md-nav__link">
<span class="md-ellipsis">
TabedViewMixin
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.QuickNotifMixin" class="md-nav__link">
<span class="md-ellipsis">
QuickNotifMixin
</span>
</a>
<nav class="md-nav" aria-label="QuickNotifMixin">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#core.views.QuickNotifMixin.get_context_data" class="md-nav__link">
<span class="md-ellipsis">
get_context_data
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#core.views.DetailFormView" class="md-nav__link">
<span class="md-ellipsis">
DetailFormView
</span>
</a>
<nav class="md-nav" aria-label="DetailFormView">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#core.views.DetailFormView.get_object" class="md-nav__link">
<span class="md-ellipsis">
get_object
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.DetailFormView.cached_object" class="md-nav__link">
<span class="md-ellipsis">
cached_object
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#core.views.AllowFragment" class="md-nav__link">
<span class="md-ellipsis">
AllowFragment
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.SithFile" class="md-nav__link">
<span class="md-ellipsis">
SithFile
</span>
</a>
<nav class="md-nav" aria-label="SithFile">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#core.views.SithFile.clean" class="md-nav__link">
<span class="md-ellipsis">
clean
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.SithFile.apply_rights_recursively" class="md-nav__link">
<span class="md-ellipsis">
apply_rights_recursively
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.SithFile.copy_rights" class="md-nav__link">
<span class="md-ellipsis">
copy_rights
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.SithFile.move_to" class="md-nav__link">
<span class="md-ellipsis">
move_to
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#core.views.MultipleFileInput" class="md-nav__link">
<span class="md-ellipsis">
MultipleFileInput
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.MultipleFileField" class="md-nav__link">
<span class="md-ellipsis">
MultipleFileField
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.MultipleImageField" class="md-nav__link">
<span class="md-ellipsis">
MultipleImageField
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.AddFilesForm" class="md-nav__link">
<span class="md-ellipsis">
AddFilesForm
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.FileListView" class="md-nav__link">
<span class="md-ellipsis">
FileListView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.FileEditView" class="md-nav__link">
<span class="md-ellipsis">
FileEditView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.FileEditPropForm" class="md-nav__link">
<span class="md-ellipsis">
FileEditPropForm
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.FileEditPropView" class="md-nav__link">
<span class="md-ellipsis">
FileEditPropView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.FileView" class="md-nav__link">
<span class="md-ellipsis">
FileView
</span>
</a>
<nav class="md-nav" aria-label="FileView">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#core.views.FileView.handle_clipboard" class="md-nav__link">
<span class="md-ellipsis">
handle_clipboard
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#core.views.FileDeleteView" class="md-nav__link">
<span class="md-ellipsis">
FileDeleteView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.FileModerationView" class="md-nav__link">
<span class="md-ellipsis">
FileModerationView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.FileModerateView" class="md-nav__link">
<span class="md-ellipsis">
FileModerateView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.RealGroup" class="md-nav__link">
<span class="md-ellipsis">
RealGroup
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.EditMembersForm" class="md-nav__link">
<span class="md-ellipsis">
EditMembersForm
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.GroupListView" class="md-nav__link">
<span class="md-ellipsis">
GroupListView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.GroupEditView" class="md-nav__link">
<span class="md-ellipsis">
GroupEditView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.GroupCreateView" class="md-nav__link">
<span class="md-ellipsis">
GroupCreateView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.GroupTemplateView" class="md-nav__link">
<span class="md-ellipsis">
GroupTemplateView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.GroupDeleteView" class="md-nav__link">
<span class="md-ellipsis">
GroupDeleteView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.LockError" class="md-nav__link">
<span class="md-ellipsis">
LockError
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Page" class="md-nav__link">
<span class="md-ellipsis">
Page
</span>
</a>
<nav class="md-nav" aria-label="Page">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#core.views.Page.save" class="md-nav__link">
<span class="md-ellipsis">
save
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Page.get_page_by_full_name" class="md-nav__link">
<span class="md-ellipsis">
get_page_by_full_name
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Page.clean" class="md-nav__link">
<span class="md-ellipsis">
clean
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Page.is_locked" class="md-nav__link">
<span class="md-ellipsis">
is_locked
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Page.set_lock" class="md-nav__link">
<span class="md-ellipsis">
set_lock
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Page.set_lock_recursive" class="md-nav__link">
<span class="md-ellipsis">
set_lock_recursive
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Page.unset_lock_recursive" class="md-nav__link">
<span class="md-ellipsis">
unset_lock_recursive
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Page.unset_lock" class="md-nav__link">
<span class="md-ellipsis">
unset_lock
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Page.get_lock" class="md-nav__link">
<span class="md-ellipsis">
get_lock
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Page.get_full_name" class="md-nav__link">
<span class="md-ellipsis">
get_full_name
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#core.views.PageRev" class="md-nav__link">
<span class="md-ellipsis">
PageRev
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.CanEditPagePropMixin" class="md-nav__link">
<span class="md-ellipsis">
CanEditPagePropMixin
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.PageListView" class="md-nav__link">
<span class="md-ellipsis">
PageListView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.PageView" class="md-nav__link">
<span class="md-ellipsis">
PageView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.PageHistView" class="md-nav__link">
<span class="md-ellipsis">
PageHistView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.PageRevView" class="md-nav__link">
<span class="md-ellipsis">
PageRevView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.PageCreateView" class="md-nav__link">
<span class="md-ellipsis">
PageCreateView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.PagePropView" class="md-nav__link">
<span class="md-ellipsis">
PagePropView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.PageEditViewBase" class="md-nav__link">
<span class="md-ellipsis">
PageEditViewBase
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.PageEditView" class="md-nav__link">
<span class="md-ellipsis">
PageEditView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.PageDeleteView" class="md-nav__link">
<span class="md-ellipsis">
PageDeleteView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Notification" class="md-nav__link">
<span class="md-ellipsis">
Notification
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Club" class="md-nav__link">
<span class="md-ellipsis">
Club
</span>
</a>
<nav class="md-nav" aria-label="Club">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#core.views.Club.check_loop" class="md-nav__link">
<span class="md-ellipsis">
check_loop
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Club.is_owned_by" class="md-nav__link">
<span class="md-ellipsis">
is_owned_by
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Club.can_be_edited_by" class="md-nav__link">
<span class="md-ellipsis">
can_be_edited_by
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Club.can_be_viewed_by" class="md-nav__link">
<span class="md-ellipsis">
can_be_viewed_by
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Club.get_membership_for" class="md-nav__link">
<span class="md-ellipsis">
get_membership_for
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#core.views.NotificationList" class="md-nav__link">
<span class="md-ellipsis">
NotificationList
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User" class="md-nav__link">
<span class="md-ellipsis">
User
</span>
</a>
<nav class="md-nav" aria-label="User">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#core.views.User.cached_groups" class="md-nav__link">
<span class="md-ellipsis">
cached_groups
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User.is_in_group" class="md-nav__link">
<span class="md-ellipsis">
is_in_group
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User.age" class="md-nav__link">
<span class="md-ellipsis">
age
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User.get_short_name" class="md-nav__link">
<span class="md-ellipsis">
get_short_name
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User.get_display_name" class="md-nav__link">
<span class="md-ellipsis">
get_display_name
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User.get_age" class="md-nav__link">
<span class="md-ellipsis">
get_age
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User.get_family" class="md-nav__link">
<span class="md-ellipsis">
get_family
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User.email_user" class="md-nav__link">
<span class="md-ellipsis">
email_user
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User.generate_username" class="md-nav__link">
<span class="md-ellipsis">
generate_username
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User.is_owner" class="md-nav__link">
<span class="md-ellipsis">
is_owner
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User.can_edit" class="md-nav__link">
<span class="md-ellipsis">
can_edit
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User.can_view" class="md-nav__link">
<span class="md-ellipsis">
can_view
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User.clubs_with_rights" class="md-nav__link">
<span class="md-ellipsis">
clubs_with_rights
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#core.views.Gift" class="md-nav__link">
<span class="md-ellipsis">
Gift
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Preferences" class="md-nav__link">
<span class="md-ellipsis">
Preferences
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.SithLoginView" class="md-nav__link">
<span class="md-ellipsis">
SithLoginView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.SithPasswordChangeView" class="md-nav__link">
<span class="md-ellipsis">
SithPasswordChangeView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.SithPasswordChangeDoneView" class="md-nav__link">
<span class="md-ellipsis">
SithPasswordChangeDoneView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.SithPasswordResetView" class="md-nav__link">
<span class="md-ellipsis">
SithPasswordResetView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.SithPasswordResetDoneView" class="md-nav__link">
<span class="md-ellipsis">
SithPasswordResetDoneView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.SithPasswordResetConfirmView" class="md-nav__link">
<span class="md-ellipsis">
SithPasswordResetConfirmView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.SithPasswordResetCompleteView" class="md-nav__link">
<span class="md-ellipsis">
SithPasswordResetCompleteView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserCreationView" class="md-nav__link">
<span class="md-ellipsis">
UserCreationView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserTabsMixin" class="md-nav__link">
<span class="md-ellipsis">
UserTabsMixin
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserView" class="md-nav__link">
<span class="md-ellipsis">
UserView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserPicturesView" class="md-nav__link">
<span class="md-ellipsis">
UserPicturesView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserGodfathersView" class="md-nav__link">
<span class="md-ellipsis">
UserGodfathersView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserGodfathersTreeView" class="md-nav__link">
<span class="md-ellipsis">
UserGodfathersTreeView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserStatsView" class="md-nav__link">
<span class="md-ellipsis">
UserStatsView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserMiniView" class="md-nav__link">
<span class="md-ellipsis">
UserMiniView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserListView" class="md-nav__link">
<span class="md-ellipsis">
UserListView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserUpdateProfileView" class="md-nav__link">
<span class="md-ellipsis">
UserUpdateProfileView
</span>
</a>
<nav class="md-nav" aria-label="UserUpdateProfileView">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#core.views.UserUpdateProfileView.remove_restricted_fields" class="md-nav__link">
<span class="md-ellipsis">
remove_restricted_fields
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#core.views.UserClubView" class="md-nav__link">
<span class="md-ellipsis">
UserClubView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserPreferencesView" class="md-nav__link">
<span class="md-ellipsis">
UserPreferencesView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserUpdateGroupView" class="md-nav__link">
<span class="md-ellipsis">
UserUpdateGroupView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserToolsView" class="md-nav__link">
<span class="md-ellipsis">
UserToolsView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserAccountBase" class="md-nav__link">
<span class="md-ellipsis">
UserAccountBase
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserAccountView" class="md-nav__link">
<span class="md-ellipsis">
UserAccountView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserAccountDetailView" class="md-nav__link">
<span class="md-ellipsis">
UserAccountDetailView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.GiftCreateView" class="md-nav__link">
<span class="md-ellipsis">
GiftCreateView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.GiftDeleteView" class="md-nav__link">
<span class="md-ellipsis">
GiftDeleteView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.forbidden" class="md-nav__link">
<span class="md-ellipsis">
forbidden
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.not_found" class="md-nav__link">
<span class="md-ellipsis">
not_found
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.internal_servor_error" class="md-nav__link">
<span class="md-ellipsis">
internal_servor_error
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.can_edit_prop" class="md-nav__link">
<span class="md-ellipsis">
can_edit_prop
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.can_edit" class="md-nav__link">
<span class="md-ellipsis">
can_edit
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.can_view" class="md-nav__link">
<span class="md-ellipsis">
can_view
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.send_file" class="md-nav__link">
<span class="md-ellipsis">
send_file
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.index" class="md-nav__link">
<span class="md-ellipsis">
index
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.notification" class="md-nav__link">
<span class="md-ellipsis">
notification
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.search_user" class="md-nav__link">
<span class="md-ellipsis">
search_user
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.search_club" class="md-nav__link">
<span class="md-ellipsis">
search_club
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.search_view" class="md-nav__link">
<span class="md-ellipsis">
search_view
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.search_user_json" class="md-nav__link">
<span class="md-ellipsis">
search_user_json
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.search_json" class="md-nav__link">
<span class="md-ellipsis">
search_json
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.logout" class="md-nav__link">
<span class="md-ellipsis">
logout
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.password_root_change" class="md-nav__link">
<span class="md-ellipsis">
password_root_change
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.delete_user_godfather" class="md-nav__link">
<span class="md-ellipsis">
delete_user_godfather
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="../schemas/" class="md-nav__link">
<span class="md-ellipsis">
Schemas
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../api_permissions/" class="md-nav__link">
<span class="md-ellipsis">
Api permissions
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_6" >
<label class="md-nav__link" for="__nav_5_6" id="__nav_5_6_label" tabindex="0">
<span class="md-ellipsis">
counter
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_6_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5_6">
<span class="md-nav__icon md-icon"></span>
counter
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../counter/models/" class="md-nav__link">
<span class="md-ellipsis">
Models
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../counter/views/" class="md-nav__link">
<span class="md-ellipsis">
Views
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../counter/schemas/" class="md-nav__link">
<span class="md-ellipsis">
Schemas
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_7" >
<label class="md-nav__link" for="__nav_5_7" id="__nav_5_7_label" tabindex="0">
<span class="md-ellipsis">
eboutic
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_7_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5_7">
<span class="md-nav__icon md-icon"></span>
eboutic
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../eboutic/models/" class="md-nav__link">
<span class="md-ellipsis">
Models
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../eboutic/views/" class="md-nav__link">
<span class="md-ellipsis">
Views
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_8" >
<label class="md-nav__link" for="__nav_5_8" id="__nav_5_8_label" tabindex="0">
<span class="md-ellipsis">
election
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_8_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5_8">
<span class="md-nav__icon md-icon"></span>
election
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../election/models/" class="md-nav__link">
<span class="md-ellipsis">
Models
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../election/views/" class="md-nav__link">
<span class="md-ellipsis">
Views
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_9" >
<label class="md-nav__link" for="__nav_5_9" id="__nav_5_9_label" tabindex="0">
<span class="md-ellipsis">
forum
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_9_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5_9">
<span class="md-nav__icon md-icon"></span>
forum
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../forum/models/" class="md-nav__link">
<span class="md-ellipsis">
Models
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../forum/views/" class="md-nav__link">
<span class="md-ellipsis">
Views
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_10" >
<label class="md-nav__link" for="__nav_5_10" id="__nav_5_10_label" tabindex="0">
<span class="md-ellipsis">
galaxy
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_10_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5_10">
<span class="md-nav__icon md-icon"></span>
galaxy
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../galaxy/models/" class="md-nav__link">
<span class="md-ellipsis">
Models
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../galaxy/views/" class="md-nav__link">
<span class="md-ellipsis">
Views
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_11" >
<label class="md-nav__link" for="__nav_5_11" id="__nav_5_11_label" tabindex="0">
<span class="md-ellipsis">
launderette
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_11_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5_11">
<span class="md-nav__icon md-icon"></span>
launderette
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../launderette/models/" class="md-nav__link">
<span class="md-ellipsis">
Models
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../launderette/views/" class="md-nav__link">
<span class="md-ellipsis">
Views
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_12" >
<label class="md-nav__link" for="__nav_5_12" id="__nav_5_12_label" tabindex="0">
<span class="md-ellipsis">
matmat
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_12_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5_12">
<span class="md-nav__icon md-icon"></span>
matmat
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../matmat/models/" class="md-nav__link">
<span class="md-ellipsis">
Models
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../matmat/views/" class="md-nav__link">
<span class="md-ellipsis">
Views
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_13" >
<label class="md-nav__link" for="__nav_5_13" id="__nav_5_13_label" tabindex="0">
<span class="md-ellipsis">
pedagogy
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_13_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5_13">
<span class="md-nav__icon md-icon"></span>
pedagogy
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../pedagogy/models/" class="md-nav__link">
<span class="md-ellipsis">
Models
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../pedagogy/views/" class="md-nav__link">
<span class="md-ellipsis">
Views
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../pedagogy/schemas/" class="md-nav__link">
<span class="md-ellipsis">
Schemas
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_14" >
<label class="md-nav__link" for="__nav_5_14" id="__nav_5_14_label" tabindex="0">
<span class="md-ellipsis">
rootplace
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_14_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5_14">
<span class="md-nav__icon md-icon"></span>
rootplace
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../rootplace/models/" class="md-nav__link">
<span class="md-ellipsis">
Models
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../rootplace/views/" class="md-nav__link">
<span class="md-ellipsis">
Views
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_15" >
<label class="md-nav__link" for="__nav_5_15" id="__nav_5_15_label" tabindex="0">
<span class="md-ellipsis">
sas
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_15_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5_15">
<span class="md-nav__icon md-icon"></span>
sas
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../sas/models/" class="md-nav__link">
<span class="md-ellipsis">
Models
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../sas/views/" class="md-nav__link">
<span class="md-ellipsis">
Views
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../sas/schemas/" class="md-nav__link">
<span class="md-ellipsis">
Schemas
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_16" >
<label class="md-nav__link" for="__nav_5_16" id="__nav_5_16_label" tabindex="0">
<span class="md-ellipsis">
staticfiles
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_16_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5_16">
<span class="md-nav__icon md-icon"></span>
staticfiles
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../staticfiles/apps/" class="md-nav__link">
<span class="md-ellipsis">
Apps
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../staticfiles/storage/" class="md-nav__link">
<span class="md-ellipsis">
Storage
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../staticfiles/finders/" class="md-nav__link">
<span class="md-ellipsis">
Finders
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../staticfiles/processors/" class="md-nav__link">
<span class="md-ellipsis">
Processors
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_17" >
<label class="md-nav__link" for="__nav_5_17" id="__nav_5_17_label" tabindex="0">
<span class="md-ellipsis">
subscription
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_17_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5_17">
<span class="md-nav__icon md-icon"></span>
subscription
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../subscription/models/" class="md-nav__link">
<span class="md-ellipsis">
Models
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../subscription/views/" class="md-nav__link">
<span class="md-ellipsis">
Views
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item md-nav__item--nested">
<input class="md-nav__toggle md-toggle " type="checkbox" id="__nav_5_18" >
<label class="md-nav__link" for="__nav_5_18" id="__nav_5_18_label" tabindex="0">
<span class="md-ellipsis">
trombi
</span>
<span class="md-nav__icon md-icon"></span>
</label>
<nav class="md-nav" data-md-level="2" aria-labelledby="__nav_5_18_label" aria-expanded="false">
<label class="md-nav__title" for="__nav_5_18">
<span class="md-nav__icon md-icon"></span>
trombi
</label>
<ul class="md-nav__list" data-md-scrollfix>
<li class="md-nav__item">
<a href="../../trombi/models/" class="md-nav__link">
<span class="md-ellipsis">
Models
</span>
</a>
</li>
<li class="md-nav__item">
<a href="../../trombi/views/" class="md-nav__link">
<span class="md-ellipsis">
Views
</span>
</a>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-sidebar md-sidebar--secondary" data-md-component="sidebar" data-md-type="toc" >
<div class="md-sidebar__scrollwrap">
<div class="md-sidebar__inner">
<nav class="md-nav md-nav--secondary" aria-label="Table des matières">
<label class="md-nav__title" for="__toc">
<span class="md-nav__icon md-icon"></span>
Table des matières
</label>
<ul class="md-nav__list" data-md-component="toc" data-md-scrollfix>
<li class="md-nav__item">
<a href="#core.views.GenericContentPermissionMixinBuilder" class="md-nav__link">
<span class="md-ellipsis">
GenericContentPermissionMixinBuilder
</span>
</a>
<nav class="md-nav" aria-label="GenericContentPermissionMixinBuilder">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#core.views.GenericContentPermissionMixinBuilder.permission_function" class="md-nav__link">
<span class="md-ellipsis">
permission_function
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#core.views.CanCreateMixin" class="md-nav__link">
<span class="md-ellipsis">
CanCreateMixin
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.CanEditPropMixin" class="md-nav__link">
<span class="md-ellipsis">
CanEditPropMixin
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.CanEditMixin" class="md-nav__link">
<span class="md-ellipsis">
CanEditMixin
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.CanViewMixin" class="md-nav__link">
<span class="md-ellipsis">
CanViewMixin
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserIsRootMixin" class="md-nav__link">
<span class="md-ellipsis">
UserIsRootMixin
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.FormerSubscriberMixin" class="md-nav__link">
<span class="md-ellipsis">
FormerSubscriberMixin
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.SubscriberMixin" class="md-nav__link">
<span class="md-ellipsis">
SubscriberMixin
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.TabedViewMixin" class="md-nav__link">
<span class="md-ellipsis">
TabedViewMixin
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.QuickNotifMixin" class="md-nav__link">
<span class="md-ellipsis">
QuickNotifMixin
</span>
</a>
<nav class="md-nav" aria-label="QuickNotifMixin">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#core.views.QuickNotifMixin.get_context_data" class="md-nav__link">
<span class="md-ellipsis">
get_context_data
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#core.views.DetailFormView" class="md-nav__link">
<span class="md-ellipsis">
DetailFormView
</span>
</a>
<nav class="md-nav" aria-label="DetailFormView">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#core.views.DetailFormView.get_object" class="md-nav__link">
<span class="md-ellipsis">
get_object
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.DetailFormView.cached_object" class="md-nav__link">
<span class="md-ellipsis">
cached_object
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#core.views.AllowFragment" class="md-nav__link">
<span class="md-ellipsis">
AllowFragment
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.SithFile" class="md-nav__link">
<span class="md-ellipsis">
SithFile
</span>
</a>
<nav class="md-nav" aria-label="SithFile">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#core.views.SithFile.clean" class="md-nav__link">
<span class="md-ellipsis">
clean
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.SithFile.apply_rights_recursively" class="md-nav__link">
<span class="md-ellipsis">
apply_rights_recursively
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.SithFile.copy_rights" class="md-nav__link">
<span class="md-ellipsis">
copy_rights
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.SithFile.move_to" class="md-nav__link">
<span class="md-ellipsis">
move_to
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#core.views.MultipleFileInput" class="md-nav__link">
<span class="md-ellipsis">
MultipleFileInput
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.MultipleFileField" class="md-nav__link">
<span class="md-ellipsis">
MultipleFileField
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.MultipleImageField" class="md-nav__link">
<span class="md-ellipsis">
MultipleImageField
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.AddFilesForm" class="md-nav__link">
<span class="md-ellipsis">
AddFilesForm
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.FileListView" class="md-nav__link">
<span class="md-ellipsis">
FileListView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.FileEditView" class="md-nav__link">
<span class="md-ellipsis">
FileEditView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.FileEditPropForm" class="md-nav__link">
<span class="md-ellipsis">
FileEditPropForm
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.FileEditPropView" class="md-nav__link">
<span class="md-ellipsis">
FileEditPropView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.FileView" class="md-nav__link">
<span class="md-ellipsis">
FileView
</span>
</a>
<nav class="md-nav" aria-label="FileView">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#core.views.FileView.handle_clipboard" class="md-nav__link">
<span class="md-ellipsis">
handle_clipboard
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#core.views.FileDeleteView" class="md-nav__link">
<span class="md-ellipsis">
FileDeleteView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.FileModerationView" class="md-nav__link">
<span class="md-ellipsis">
FileModerationView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.FileModerateView" class="md-nav__link">
<span class="md-ellipsis">
FileModerateView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.RealGroup" class="md-nav__link">
<span class="md-ellipsis">
RealGroup
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.EditMembersForm" class="md-nav__link">
<span class="md-ellipsis">
EditMembersForm
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.GroupListView" class="md-nav__link">
<span class="md-ellipsis">
GroupListView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.GroupEditView" class="md-nav__link">
<span class="md-ellipsis">
GroupEditView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.GroupCreateView" class="md-nav__link">
<span class="md-ellipsis">
GroupCreateView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.GroupTemplateView" class="md-nav__link">
<span class="md-ellipsis">
GroupTemplateView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.GroupDeleteView" class="md-nav__link">
<span class="md-ellipsis">
GroupDeleteView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.LockError" class="md-nav__link">
<span class="md-ellipsis">
LockError
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Page" class="md-nav__link">
<span class="md-ellipsis">
Page
</span>
</a>
<nav class="md-nav" aria-label="Page">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#core.views.Page.save" class="md-nav__link">
<span class="md-ellipsis">
save
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Page.get_page_by_full_name" class="md-nav__link">
<span class="md-ellipsis">
get_page_by_full_name
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Page.clean" class="md-nav__link">
<span class="md-ellipsis">
clean
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Page.is_locked" class="md-nav__link">
<span class="md-ellipsis">
is_locked
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Page.set_lock" class="md-nav__link">
<span class="md-ellipsis">
set_lock
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Page.set_lock_recursive" class="md-nav__link">
<span class="md-ellipsis">
set_lock_recursive
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Page.unset_lock_recursive" class="md-nav__link">
<span class="md-ellipsis">
unset_lock_recursive
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Page.unset_lock" class="md-nav__link">
<span class="md-ellipsis">
unset_lock
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Page.get_lock" class="md-nav__link">
<span class="md-ellipsis">
get_lock
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Page.get_full_name" class="md-nav__link">
<span class="md-ellipsis">
get_full_name
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#core.views.PageRev" class="md-nav__link">
<span class="md-ellipsis">
PageRev
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.CanEditPagePropMixin" class="md-nav__link">
<span class="md-ellipsis">
CanEditPagePropMixin
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.PageListView" class="md-nav__link">
<span class="md-ellipsis">
PageListView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.PageView" class="md-nav__link">
<span class="md-ellipsis">
PageView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.PageHistView" class="md-nav__link">
<span class="md-ellipsis">
PageHistView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.PageRevView" class="md-nav__link">
<span class="md-ellipsis">
PageRevView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.PageCreateView" class="md-nav__link">
<span class="md-ellipsis">
PageCreateView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.PagePropView" class="md-nav__link">
<span class="md-ellipsis">
PagePropView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.PageEditViewBase" class="md-nav__link">
<span class="md-ellipsis">
PageEditViewBase
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.PageEditView" class="md-nav__link">
<span class="md-ellipsis">
PageEditView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.PageDeleteView" class="md-nav__link">
<span class="md-ellipsis">
PageDeleteView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Notification" class="md-nav__link">
<span class="md-ellipsis">
Notification
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Club" class="md-nav__link">
<span class="md-ellipsis">
Club
</span>
</a>
<nav class="md-nav" aria-label="Club">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#core.views.Club.check_loop" class="md-nav__link">
<span class="md-ellipsis">
check_loop
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Club.is_owned_by" class="md-nav__link">
<span class="md-ellipsis">
is_owned_by
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Club.can_be_edited_by" class="md-nav__link">
<span class="md-ellipsis">
can_be_edited_by
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Club.can_be_viewed_by" class="md-nav__link">
<span class="md-ellipsis">
can_be_viewed_by
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Club.get_membership_for" class="md-nav__link">
<span class="md-ellipsis">
get_membership_for
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#core.views.NotificationList" class="md-nav__link">
<span class="md-ellipsis">
NotificationList
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User" class="md-nav__link">
<span class="md-ellipsis">
User
</span>
</a>
<nav class="md-nav" aria-label="User">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#core.views.User.cached_groups" class="md-nav__link">
<span class="md-ellipsis">
cached_groups
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User.is_in_group" class="md-nav__link">
<span class="md-ellipsis">
is_in_group
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User.age" class="md-nav__link">
<span class="md-ellipsis">
age
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User.get_short_name" class="md-nav__link">
<span class="md-ellipsis">
get_short_name
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User.get_display_name" class="md-nav__link">
<span class="md-ellipsis">
get_display_name
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User.get_age" class="md-nav__link">
<span class="md-ellipsis">
get_age
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User.get_family" class="md-nav__link">
<span class="md-ellipsis">
get_family
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User.email_user" class="md-nav__link">
<span class="md-ellipsis">
email_user
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User.generate_username" class="md-nav__link">
<span class="md-ellipsis">
generate_username
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User.is_owner" class="md-nav__link">
<span class="md-ellipsis">
is_owner
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User.can_edit" class="md-nav__link">
<span class="md-ellipsis">
can_edit
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User.can_view" class="md-nav__link">
<span class="md-ellipsis">
can_view
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.User.clubs_with_rights" class="md-nav__link">
<span class="md-ellipsis">
clubs_with_rights
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#core.views.Gift" class="md-nav__link">
<span class="md-ellipsis">
Gift
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.Preferences" class="md-nav__link">
<span class="md-ellipsis">
Preferences
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.SithLoginView" class="md-nav__link">
<span class="md-ellipsis">
SithLoginView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.SithPasswordChangeView" class="md-nav__link">
<span class="md-ellipsis">
SithPasswordChangeView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.SithPasswordChangeDoneView" class="md-nav__link">
<span class="md-ellipsis">
SithPasswordChangeDoneView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.SithPasswordResetView" class="md-nav__link">
<span class="md-ellipsis">
SithPasswordResetView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.SithPasswordResetDoneView" class="md-nav__link">
<span class="md-ellipsis">
SithPasswordResetDoneView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.SithPasswordResetConfirmView" class="md-nav__link">
<span class="md-ellipsis">
SithPasswordResetConfirmView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.SithPasswordResetCompleteView" class="md-nav__link">
<span class="md-ellipsis">
SithPasswordResetCompleteView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserCreationView" class="md-nav__link">
<span class="md-ellipsis">
UserCreationView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserTabsMixin" class="md-nav__link">
<span class="md-ellipsis">
UserTabsMixin
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserView" class="md-nav__link">
<span class="md-ellipsis">
UserView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserPicturesView" class="md-nav__link">
<span class="md-ellipsis">
UserPicturesView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserGodfathersView" class="md-nav__link">
<span class="md-ellipsis">
UserGodfathersView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserGodfathersTreeView" class="md-nav__link">
<span class="md-ellipsis">
UserGodfathersTreeView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserStatsView" class="md-nav__link">
<span class="md-ellipsis">
UserStatsView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserMiniView" class="md-nav__link">
<span class="md-ellipsis">
UserMiniView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserListView" class="md-nav__link">
<span class="md-ellipsis">
UserListView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserUpdateProfileView" class="md-nav__link">
<span class="md-ellipsis">
UserUpdateProfileView
</span>
</a>
<nav class="md-nav" aria-label="UserUpdateProfileView">
<ul class="md-nav__list">
<li class="md-nav__item">
<a href="#core.views.UserUpdateProfileView.remove_restricted_fields" class="md-nav__link">
<span class="md-ellipsis">
remove_restricted_fields
</span>
</a>
</li>
</ul>
</nav>
</li>
<li class="md-nav__item">
<a href="#core.views.UserClubView" class="md-nav__link">
<span class="md-ellipsis">
UserClubView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserPreferencesView" class="md-nav__link">
<span class="md-ellipsis">
UserPreferencesView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserUpdateGroupView" class="md-nav__link">
<span class="md-ellipsis">
UserUpdateGroupView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserToolsView" class="md-nav__link">
<span class="md-ellipsis">
UserToolsView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserAccountBase" class="md-nav__link">
<span class="md-ellipsis">
UserAccountBase
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserAccountView" class="md-nav__link">
<span class="md-ellipsis">
UserAccountView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.UserAccountDetailView" class="md-nav__link">
<span class="md-ellipsis">
UserAccountDetailView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.GiftCreateView" class="md-nav__link">
<span class="md-ellipsis">
GiftCreateView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.GiftDeleteView" class="md-nav__link">
<span class="md-ellipsis">
GiftDeleteView
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.forbidden" class="md-nav__link">
<span class="md-ellipsis">
forbidden
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.not_found" class="md-nav__link">
<span class="md-ellipsis">
not_found
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.internal_servor_error" class="md-nav__link">
<span class="md-ellipsis">
internal_servor_error
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.can_edit_prop" class="md-nav__link">
<span class="md-ellipsis">
can_edit_prop
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.can_edit" class="md-nav__link">
<span class="md-ellipsis">
can_edit
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.can_view" class="md-nav__link">
<span class="md-ellipsis">
can_view
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.send_file" class="md-nav__link">
<span class="md-ellipsis">
send_file
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.index" class="md-nav__link">
<span class="md-ellipsis">
index
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.notification" class="md-nav__link">
<span class="md-ellipsis">
notification
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.search_user" class="md-nav__link">
<span class="md-ellipsis">
search_user
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.search_club" class="md-nav__link">
<span class="md-ellipsis">
search_club
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.search_view" class="md-nav__link">
<span class="md-ellipsis">
search_view
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.search_user_json" class="md-nav__link">
<span class="md-ellipsis">
search_user_json
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.search_json" class="md-nav__link">
<span class="md-ellipsis">
search_json
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.logout" class="md-nav__link">
<span class="md-ellipsis">
logout
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.password_root_change" class="md-nav__link">
<span class="md-ellipsis">
password_root_change
</span>
</a>
</li>
<li class="md-nav__item">
<a href="#core.views.delete_user_godfather" class="md-nav__link">
<span class="md-ellipsis">
delete_user_godfather
</span>
</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<div class="md-content" data-md-component="content">
<article class="md-content__inner md-typeset">
<h1>Views</h1>
<div class="doc doc-object doc-module">
<div class="doc doc-contents first">
<div class="doc doc-children">
<div class="doc doc-object doc-class">
<h2 id="core.views.GenericContentPermissionMixinBuilder" class="doc doc-heading">
<code>GenericContentPermissionMixinBuilder</code>
<a href="#core.views.GenericContentPermissionMixinBuilder" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.views.generic.base.View">View</span></code></p>
<p>Used to build permission mixins.</p>
<p>This view protect any child view that would be showing an object that is restricted based
on two properties.</p>
<p><span class="doc-section-title">Attributes:</span></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td><code><span title="core.views.GenericContentPermissionMixinBuilder.raised_error">raised_error</span></code></td>
<td>
</td>
<td>
<div class="doc-md-description">
<p>permission to be raised</p>
</div>
</td>
</tr>
</tbody>
</table>
<div class="doc doc-children">
<div class="doc doc-object doc-function">
<h3 id="core.views.GenericContentPermissionMixinBuilder.permission_function" class="doc doc-heading">
<code class="highlight language-python"><span class="n">permission_function</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="n">user</span><span class="p">)</span></code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-staticmethod"><code>staticmethod</code></small>
</span>
<a href="#core.views.GenericContentPermissionMixinBuilder.permission_function" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Function to test permission with.</p>
<details class="quote">
<summary>Source code in <code>core/views/__init__.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-141">141</a></span>
<span class="normal"><a href="#__codelineno-0-142">142</a></span>
<span class="normal"><a href="#__codelineno-0-143">143</a></span>
<span class="normal"><a href="#__codelineno-0-144">144</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-141"><a id="__codelineno-0-141" name="__codelineno-0-141"></a><span class="nd">@staticmethod</span>
</span><span id="__span-0-142"><a id="__codelineno-0-142" name="__codelineno-0-142"></a><span class="k">def</span> <span class="nf">permission_function</span><span class="p">(</span><span class="n">obj</span><span class="p">:</span> <span class="n">Any</span><span class="p">,</span> <span class="n">user</span><span class="p">:</span> <span class="n">User</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span>
</span><span id="__span-0-143"><a id="__codelineno-0-143" name="__codelineno-0-143"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Function to test permission with.&quot;&quot;&quot;</span>
</span><span id="__span-0-144"><a id="__codelineno-0-144" name="__codelineno-0-144"></a> <span class="k">return</span> <span class="kc">False</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.CanCreateMixin" class="doc doc-heading">
<code>CanCreateMixin</code>
<a href="#core.views.CanCreateMixin" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.views.generic.base.View">View</span></code></p>
<p>Protect any child view that would create an object.</p>
<p><span class="doc-section-title">Raises:</span></p>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code><span title="core.views.user.PermissionDenied">PermissionDenied</span></code>
</td>
<td>
<div class="doc-md-description">
<p>If the user has not the necessary permission
to create the object of the view.</p>
</div>
</td>
</tr>
</tbody>
</table>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.CanEditPropMixin" class="doc doc-heading">
<code>CanEditPropMixin</code>
<a href="#core.views.CanEditPropMixin" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.GenericContentPermissionMixinBuilder" href="#core.views.GenericContentPermissionMixinBuilder">GenericContentPermissionMixinBuilder</a></code></p>
<p>Ensure the user has owner permissions on the child view object.</p>
<p>In other word, you can make a view with this view as parent,
and it will be retricted to the users that are in the
object's owner_group or that pass the <code>obj.can_be_viewed_by</code> test.</p>
<p><span class="doc-section-title">Raises:</span></p>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code><span title="core.views.user.PermissionDenied">PermissionDenied</span></code>
</td>
<td>
<div class="doc-md-description">
<p>If the user cannot see the object</p>
</div>
</td>
</tr>
</tbody>
</table>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.CanEditMixin" class="doc doc-heading">
<code>CanEditMixin</code>
<a href="#core.views.CanEditMixin" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.GenericContentPermissionMixinBuilder" href="#core.views.GenericContentPermissionMixinBuilder">GenericContentPermissionMixinBuilder</a></code></p>
<p>Ensure the user has permission to edit this view's object.</p>
<p><span class="doc-section-title">Raises:</span></p>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code><span title="core.views.user.PermissionDenied">PermissionDenied</span></code>
</td>
<td>
<div class="doc-md-description">
<p>if the user cannot edit this view's object.</p>
</div>
</td>
</tr>
</tbody>
</table>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.CanViewMixin" class="doc doc-heading">
<code>CanViewMixin</code>
<a href="#core.views.CanViewMixin" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.GenericContentPermissionMixinBuilder" href="#core.views.GenericContentPermissionMixinBuilder">GenericContentPermissionMixinBuilder</a></code></p>
<p>Ensure the user has permission to view this view's object.</p>
<p><span class="doc-section-title">Raises:</span></p>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code><span title="core.views.user.PermissionDenied">PermissionDenied</span></code>
</td>
<td>
<div class="doc-md-description">
<p>if the user cannot edit this view's object.</p>
</div>
</td>
</tr>
</tbody>
</table>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.UserIsRootMixin" class="doc doc-heading">
<code>UserIsRootMixin</code>
<a href="#core.views.UserIsRootMixin" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.GenericContentPermissionMixinBuilder" href="#core.views.GenericContentPermissionMixinBuilder">GenericContentPermissionMixinBuilder</a></code></p>
<p>Allow only root admins.</p>
<p><span class="doc-section-title">Raises:</span></p>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code><span title="core.views.user.PermissionDenied">PermissionDenied</span></code>
</td>
<td>
<div class="doc-md-description">
<p>if the user isn't root</p>
</div>
</td>
</tr>
</tbody>
</table>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.FormerSubscriberMixin" class="doc doc-heading">
<code>FormerSubscriberMixin</code>
<a href="#core.views.FormerSubscriberMixin" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.contrib.auth.mixins.AccessMixin">AccessMixin</span></code></p>
<p>Check if the user was at least an old subscriber.</p>
<p><span class="doc-section-title">Raises:</span></p>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code><span title="core.views.user.PermissionDenied">PermissionDenied</span></code>
</td>
<td>
<div class="doc-md-description">
<p>if the user never subscribed.</p>
</div>
</td>
</tr>
</tbody>
</table>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.SubscriberMixin" class="doc doc-heading">
<code>SubscriberMixin</code>
<a href="#core.views.SubscriberMixin" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.contrib.auth.mixins.AccessMixin">AccessMixin</span></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.TabedViewMixin" class="doc doc-heading">
<code>TabedViewMixin</code>
<a href="#core.views.TabedViewMixin" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.views.generic.base.View">View</span></code></p>
<p>Basic functions for displaying tabs in the template.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.QuickNotifMixin" class="doc doc-heading">
<code>QuickNotifMixin</code>
<a href="#core.views.QuickNotifMixin" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<div class="doc doc-children">
<div class="doc doc-object doc-function">
<h3 id="core.views.QuickNotifMixin.get_context_data" class="doc doc-heading">
<code class="highlight language-python"><span class="n">get_context_data</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></code>
<a href="#core.views.QuickNotifMixin.get_context_data" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Add quick notifications to context.</p>
<details class="quote">
<summary>Source code in <code>core/views/__init__.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-303">303</a></span>
<span class="normal"><a href="#__codelineno-0-304">304</a></span>
<span class="normal"><a href="#__codelineno-0-305">305</a></span>
<span class="normal"><a href="#__codelineno-0-306">306</a></span>
<span class="normal"><a href="#__codelineno-0-307">307</a></span>
<span class="normal"><a href="#__codelineno-0-308">308</a></span>
<span class="normal"><a href="#__codelineno-0-309">309</a></span>
<span class="normal"><a href="#__codelineno-0-310">310</a></span>
<span class="normal"><a href="#__codelineno-0-311">311</a></span>
<span class="normal"><a href="#__codelineno-0-312">312</a></span>
<span class="normal"><a href="#__codelineno-0-313">313</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-303"><a id="__codelineno-0-303" name="__codelineno-0-303"></a><span class="k">def</span> <span class="nf">get_context_data</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
</span><span id="__span-0-304"><a id="__codelineno-0-304" name="__codelineno-0-304"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Add quick notifications to context.&quot;&quot;&quot;</span>
</span><span id="__span-0-305"><a id="__codelineno-0-305" name="__codelineno-0-305"></a> <span class="n">kwargs</span> <span class="o">=</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">get_context_data</span><span class="p">(</span><span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
</span><span id="__span-0-306"><a id="__codelineno-0-306" name="__codelineno-0-306"></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">&quot;quick_notifs&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
</span><span id="__span-0-307"><a id="__codelineno-0-307" name="__codelineno-0-307"></a> <span class="k">for</span> <span class="n">n</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">quick_notif_list</span><span class="p">:</span>
</span><span id="__span-0-308"><a id="__codelineno-0-308" name="__codelineno-0-308"></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">&quot;quick_notifs&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">settings</span><span class="o">.</span><span class="n">SITH_QUICK_NOTIF</span><span class="p">[</span><span class="n">n</span><span class="p">])</span>
</span><span id="__span-0-309"><a id="__codelineno-0-309" name="__codelineno-0-309"></a> <span class="k">for</span> <span class="n">key</span><span class="p">,</span> <span class="n">val</span> <span class="ow">in</span> <span class="n">settings</span><span class="o">.</span><span class="n">SITH_QUICK_NOTIF</span><span class="o">.</span><span class="n">items</span><span class="p">():</span>
</span><span id="__span-0-310"><a id="__codelineno-0-310" name="__codelineno-0-310"></a> <span class="k">for</span> <span class="n">gk</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">request</span><span class="o">.</span><span class="n">GET</span><span class="p">:</span>
</span><span id="__span-0-311"><a id="__codelineno-0-311" name="__codelineno-0-311"></a> <span class="k">if</span> <span class="n">key</span> <span class="o">==</span> <span class="n">gk</span><span class="p">:</span>
</span><span id="__span-0-312"><a id="__codelineno-0-312" name="__codelineno-0-312"></a> <span class="n">kwargs</span><span class="p">[</span><span class="s2">&quot;quick_notifs&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">val</span><span class="p">)</span>
</span><span id="__span-0-313"><a id="__codelineno-0-313" name="__codelineno-0-313"></a> <span class="k">return</span> <span class="n">kwargs</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.DetailFormView" class="doc doc-heading">
<code>DetailFormView</code>
<a href="#core.views.DetailFormView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="core.views.files.SingleObjectMixin">SingleObjectMixin</span></code>, <code><span title="core.views.user.FormView">FormView</span></code></p>
<p>Class that allow both a detail view and a form view.</p>
<div class="doc doc-children">
<div class="doc doc-object doc-function">
<h3 id="core.views.DetailFormView.get_object" class="doc doc-heading">
<code class="highlight language-python"><span class="n">get_object</span><span class="p">()</span></code>
<a href="#core.views.DetailFormView.get_object" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Get current group from id in url.</p>
<details class="quote">
<summary>Source code in <code>core/views/__init__.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-319">319</a></span>
<span class="normal"><a href="#__codelineno-0-320">320</a></span>
<span class="normal"><a href="#__codelineno-0-321">321</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-319"><a id="__codelineno-0-319" name="__codelineno-0-319"></a><span class="k">def</span> <span class="nf">get_object</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
</span><span id="__span-0-320"><a id="__codelineno-0-320" name="__codelineno-0-320"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Get current group from id in url.&quot;&quot;&quot;</span>
</span><span id="__span-0-321"><a id="__codelineno-0-321" name="__codelineno-0-321"></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">cached_object</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.DetailFormView.cached_object" class="doc doc-heading">
<code class="highlight language-python"><span class="n">cached_object</span><span class="p">()</span></code>
<a href="#core.views.DetailFormView.cached_object" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Optimisation on group retrieval.</p>
<details class="quote">
<summary>Source code in <code>core/views/__init__.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-323">323</a></span>
<span class="normal"><a href="#__codelineno-0-324">324</a></span>
<span class="normal"><a href="#__codelineno-0-325">325</a></span>
<span class="normal"><a href="#__codelineno-0-326">326</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-323"><a id="__codelineno-0-323" name="__codelineno-0-323"></a><span class="nd">@cached_property</span>
</span><span id="__span-0-324"><a id="__codelineno-0-324" name="__codelineno-0-324"></a><span class="k">def</span> <span class="nf">cached_object</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
</span><span id="__span-0-325"><a id="__codelineno-0-325" name="__codelineno-0-325"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Optimisation on group retrieval.&quot;&quot;&quot;</span>
</span><span id="__span-0-326"><a id="__codelineno-0-326" name="__codelineno-0-326"></a> <span class="k">return</span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">get_object</span><span class="p">()</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.AllowFragment" class="doc doc-heading">
<code>AllowFragment</code>
<a href="#core.views.AllowFragment" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p>Add <code>is_fragment</code> to templates. It's only True if the request is emitted by htmx</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.SithFile" class="doc doc-heading">
<code>SithFile</code>
<a href="#core.views.SithFile" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.db.models.Model">Model</span></code></p>
<div class="doc doc-children">
<div class="doc doc-object doc-function">
<h3 id="core.views.SithFile.clean" class="doc doc-heading">
<code class="highlight language-python"><span class="n">clean</span><span class="p">()</span></code>
<a href="#core.views.SithFile.clean" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Cleans up the file.</p>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-988"> 988</a></span>
<span class="normal"><a href="#__codelineno-0-989"> 989</a></span>
<span class="normal"><a href="#__codelineno-0-990"> 990</a></span>
<span class="normal"><a href="#__codelineno-0-991"> 991</a></span>
<span class="normal"><a href="#__codelineno-0-992"> 992</a></span>
<span class="normal"><a href="#__codelineno-0-993"> 993</a></span>
<span class="normal"><a href="#__codelineno-0-994"> 994</a></span>
<span class="normal"><a href="#__codelineno-0-995"> 995</a></span>
<span class="normal"><a href="#__codelineno-0-996"> 996</a></span>
<span class="normal"><a href="#__codelineno-0-997"> 997</a></span>
<span class="normal"><a href="#__codelineno-0-998"> 998</a></span>
<span class="normal"><a href="#__codelineno-0-999"> 999</a></span>
<span class="normal"><a href="#__codelineno-0-1000">1000</a></span>
<span class="normal"><a href="#__codelineno-0-1001">1001</a></span>
<span class="normal"><a href="#__codelineno-0-1002">1002</a></span>
<span class="normal"><a href="#__codelineno-0-1003">1003</a></span>
<span class="normal"><a href="#__codelineno-0-1004">1004</a></span>
<span class="normal"><a href="#__codelineno-0-1005">1005</a></span>
<span class="normal"><a href="#__codelineno-0-1006">1006</a></span>
<span class="normal"><a href="#__codelineno-0-1007">1007</a></span>
<span class="normal"><a href="#__codelineno-0-1008">1008</a></span>
<span class="normal"><a href="#__codelineno-0-1009">1009</a></span>
<span class="normal"><a href="#__codelineno-0-1010">1010</a></span>
<span class="normal"><a href="#__codelineno-0-1011">1011</a></span>
<span class="normal"><a href="#__codelineno-0-1012">1012</a></span>
<span class="normal"><a href="#__codelineno-0-1013">1013</a></span>
<span class="normal"><a href="#__codelineno-0-1014">1014</a></span>
<span class="normal"><a href="#__codelineno-0-1015">1015</a></span>
<span class="normal"><a href="#__codelineno-0-1016">1016</a></span>
<span class="normal"><a href="#__codelineno-0-1017">1017</a></span>
<span class="normal"><a href="#__codelineno-0-1018">1018</a></span>
<span class="normal"><a href="#__codelineno-0-1019">1019</a></span>
<span class="normal"><a href="#__codelineno-0-1020">1020</a></span>
<span class="normal"><a href="#__codelineno-0-1021">1021</a></span>
<span class="normal"><a href="#__codelineno-0-1022">1022</a></span>
<span class="normal"><a href="#__codelineno-0-1023">1023</a></span>
<span class="normal"><a href="#__codelineno-0-1024">1024</a></span>
<span class="normal"><a href="#__codelineno-0-1025">1025</a></span>
<span class="normal"><a href="#__codelineno-0-1026">1026</a></span>
<span class="normal"><a href="#__codelineno-0-1027">1027</a></span>
<span class="normal"><a href="#__codelineno-0-1028">1028</a></span>
<span class="normal"><a href="#__codelineno-0-1029">1029</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-988"><a id="__codelineno-0-988" name="__codelineno-0-988"></a><span class="k">def</span> <span class="nf">clean</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
</span><span id="__span-0-989"><a id="__codelineno-0-989" name="__codelineno-0-989"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Cleans up the file.&quot;&quot;&quot;</span>
</span><span id="__span-0-990"><a id="__codelineno-0-990" name="__codelineno-0-990"></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">clean</span><span class="p">()</span>
</span><span id="__span-0-991"><a id="__codelineno-0-991" name="__codelineno-0-991"></a> <span class="k">if</span> <span class="s2">&quot;/&quot;</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">:</span>
</span><span id="__span-0-992"><a id="__codelineno-0-992" name="__codelineno-0-992"></a> <span class="k">raise</span> <span class="n">ValidationError</span><span class="p">(</span><span class="n">_</span><span class="p">(</span><span class="s2">&quot;Character &#39;/&#39; not authorized in name&quot;</span><span class="p">))</span>
</span><span id="__span-0-993"><a id="__codelineno-0-993" name="__codelineno-0-993"></a> <span class="k">if</span> <span class="bp">self</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="p">:</span>
</span><span id="__span-0-994"><a id="__codelineno-0-994" name="__codelineno-0-994"></a> <span class="k">raise</span> <span class="n">ValidationError</span><span class="p">(</span><span class="n">_</span><span class="p">(</span><span class="s2">&quot;Loop in folder tree&quot;</span><span class="p">),</span> <span class="n">code</span><span class="o">=</span><span class="s2">&quot;loop&quot;</span><span class="p">)</span>
</span><span id="__span-0-995"><a id="__codelineno-0-995" name="__codelineno-0-995"></a> <span class="k">if</span> <span class="bp">self</span> <span class="o">==</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="ow">or</span> <span class="p">(</span>
</span><span id="__span-0-996"><a id="__codelineno-0-996" name="__codelineno-0-996"></a> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">and</span> <span class="bp">self</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_parent_list</span><span class="p">()</span>
</span><span id="__span-0-997"><a id="__codelineno-0-997" name="__codelineno-0-997"></a> <span class="p">):</span>
</span><span id="__span-0-998"><a id="__codelineno-0-998" name="__codelineno-0-998"></a> <span class="k">raise</span> <span class="n">ValidationError</span><span class="p">(</span><span class="n">_</span><span class="p">(</span><span class="s2">&quot;Loop in folder tree&quot;</span><span class="p">),</span> <span class="n">code</span><span class="o">=</span><span class="s2">&quot;loop&quot;</span><span class="p">)</span>
</span><span id="__span-0-999"><a id="__codelineno-0-999" name="__codelineno-0-999"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">is_file</span><span class="p">:</span>
</span><span id="__span-0-1000"><a id="__codelineno-0-1000" name="__codelineno-0-1000"></a> <span class="k">raise</span> <span class="n">ValidationError</span><span class="p">(</span>
</span><span id="__span-0-1001"><a id="__codelineno-0-1001" name="__codelineno-0-1001"></a> <span class="n">_</span><span class="p">(</span><span class="s2">&quot;You can not make a file be a children of a non folder file&quot;</span><span class="p">)</span>
</span><span id="__span-0-1002"><a id="__codelineno-0-1002" name="__codelineno-0-1002"></a> <span class="p">)</span>
</span><span id="__span-0-1003"><a id="__codelineno-0-1003" name="__codelineno-0-1003"></a> <span class="k">if</span> <span class="p">(</span>
</span><span id="__span-0-1004"><a id="__codelineno-0-1004" name="__codelineno-0-1004"></a> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="ow">is</span> <span class="kc">None</span>
</span><span id="__span-0-1005"><a id="__codelineno-0-1005" name="__codelineno-0-1005"></a> <span class="ow">and</span> <span class="n">SithFile</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">exclude</span><span class="p">(</span><span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">id</span><span class="p">)</span>
</span><span id="__span-0-1006"><a id="__codelineno-0-1006" name="__codelineno-0-1006"></a> <span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">parent</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">)</span>
</span><span id="__span-0-1007"><a id="__codelineno-0-1007" name="__codelineno-0-1007"></a> <span class="o">.</span><span class="n">exists</span><span class="p">()</span>
</span><span id="__span-0-1008"><a id="__codelineno-0-1008" name="__codelineno-0-1008"></a> <span class="p">)</span> <span class="ow">or</span> <span class="p">(</span>
</span><span id="__span-0-1009"><a id="__codelineno-0-1009" name="__codelineno-0-1009"></a> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span>
</span><span id="__span-0-1010"><a id="__codelineno-0-1010" name="__codelineno-0-1010"></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">children</span><span class="o">.</span><span class="n">exclude</span><span class="p">(</span><span class="nb">id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">id</span><span class="p">)</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">)</span><span class="o">.</span><span class="n">exists</span><span class="p">()</span>
</span><span id="__span-0-1011"><a id="__codelineno-0-1011" name="__codelineno-0-1011"></a> <span class="p">):</span>
</span><span id="__span-0-1012"><a id="__codelineno-0-1012" name="__codelineno-0-1012"></a> <span class="k">raise</span> <span class="n">ValidationError</span><span class="p">(</span><span class="n">_</span><span class="p">(</span><span class="s2">&quot;Duplicate file&quot;</span><span class="p">),</span> <span class="n">code</span><span class="o">=</span><span class="s2">&quot;duplicate&quot;</span><span class="p">)</span>
</span><span id="__span-0-1013"><a id="__codelineno-0-1013" name="__codelineno-0-1013"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_folder</span><span class="p">:</span>
</span><span id="__span-0-1014"><a id="__codelineno-0-1014" name="__codelineno-0-1014"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">file</span><span class="p">:</span>
</span><span id="__span-0-1015"><a id="__codelineno-0-1015" name="__codelineno-0-1015"></a> <span class="k">try</span><span class="p">:</span>
</span><span id="__span-0-1016"><a id="__codelineno-0-1016" name="__codelineno-0-1016"></a> <span class="kn">import</span> <span class="nn">imghdr</span>
</span><span id="__span-0-1017"><a id="__codelineno-0-1017" name="__codelineno-0-1017"></a>
</span><span id="__span-0-1018"><a id="__codelineno-0-1018" name="__codelineno-0-1018"></a> <span class="k">if</span> <span class="n">imghdr</span><span class="o">.</span><span class="n">what</span><span class="p">(</span><span class="kc">None</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">file</span><span class="o">.</span><span class="n">read</span><span class="p">())</span> <span class="ow">not</span> <span class="ow">in</span> <span class="p">[</span>
</span><span id="__span-0-1019"><a id="__codelineno-0-1019" name="__codelineno-0-1019"></a> <span class="s2">&quot;gif&quot;</span><span class="p">,</span>
</span><span id="__span-0-1020"><a id="__codelineno-0-1020" name="__codelineno-0-1020"></a> <span class="s2">&quot;png&quot;</span><span class="p">,</span>
</span><span id="__span-0-1021"><a id="__codelineno-0-1021" name="__codelineno-0-1021"></a> <span class="s2">&quot;jpeg&quot;</span><span class="p">,</span>
</span><span id="__span-0-1022"><a id="__codelineno-0-1022" name="__codelineno-0-1022"></a> <span class="p">]:</span>
</span><span id="__span-0-1023"><a id="__codelineno-0-1023" name="__codelineno-0-1023"></a> <span class="bp">self</span><span class="o">.</span><span class="n">file</span><span class="o">.</span><span class="n">delete</span><span class="p">()</span>
</span><span id="__span-0-1024"><a id="__codelineno-0-1024" name="__codelineno-0-1024"></a> <span class="bp">self</span><span class="o">.</span><span class="n">file</span> <span class="o">=</span> <span class="kc">None</span>
</span><span id="__span-0-1025"><a id="__codelineno-0-1025" name="__codelineno-0-1025"></a> <span class="k">except</span><span class="p">:</span> <span class="c1"># noqa E722 I don&#39;t know the exception that can be raised</span>
</span><span id="__span-0-1026"><a id="__codelineno-0-1026" name="__codelineno-0-1026"></a> <span class="bp">self</span><span class="o">.</span><span class="n">file</span> <span class="o">=</span> <span class="kc">None</span>
</span><span id="__span-0-1027"><a id="__codelineno-0-1027" name="__codelineno-0-1027"></a> <span class="bp">self</span><span class="o">.</span><span class="n">mime_type</span> <span class="o">=</span> <span class="s2">&quot;inode/directory&quot;</span>
</span><span id="__span-0-1028"><a id="__codelineno-0-1028" name="__codelineno-0-1028"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_file</span> <span class="ow">and</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">file</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="bp">self</span><span class="o">.</span><span class="n">file</span> <span class="o">==</span> <span class="s2">&quot;&quot;</span><span class="p">):</span>
</span><span id="__span-0-1029"><a id="__codelineno-0-1029" name="__codelineno-0-1029"></a> <span class="k">raise</span> <span class="n">ValidationError</span><span class="p">(</span><span class="n">_</span><span class="p">(</span><span class="s2">&quot;You must provide a file&quot;</span><span class="p">))</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.SithFile.apply_rights_recursively" class="doc doc-heading">
<code class="highlight language-python"><span class="n">apply_rights_recursively</span><span class="p">(</span><span class="o">*</span><span class="p">,</span> <span class="n">only_folders</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span></code>
<a href="#core.views.SithFile.apply_rights_recursively" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Apply the rights of this file to all children recursively.</p>
<p><span class="doc-section-title">Parameters:</span></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code>only_folders</code>
</td>
<td>
<code>bool</code>
</td>
<td>
<div class="doc-md-description">
<p>If True, only apply the rights to SithFiles that are folders.</p>
</div>
</td>
<td>
<code>False</code>
</td>
</tr>
</tbody>
</table>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-1031">1031</a></span>
<span class="normal"><a href="#__codelineno-0-1032">1032</a></span>
<span class="normal"><a href="#__codelineno-0-1033">1033</a></span>
<span class="normal"><a href="#__codelineno-0-1034">1034</a></span>
<span class="normal"><a href="#__codelineno-0-1035">1035</a></span>
<span class="normal"><a href="#__codelineno-0-1036">1036</a></span>
<span class="normal"><a href="#__codelineno-0-1037">1037</a></span>
<span class="normal"><a href="#__codelineno-0-1038">1038</a></span>
<span class="normal"><a href="#__codelineno-0-1039">1039</a></span>
<span class="normal"><a href="#__codelineno-0-1040">1040</a></span>
<span class="normal"><a href="#__codelineno-0-1041">1041</a></span>
<span class="normal"><a href="#__codelineno-0-1042">1042</a></span>
<span class="normal"><a href="#__codelineno-0-1043">1043</a></span>
<span class="normal"><a href="#__codelineno-0-1044">1044</a></span>
<span class="normal"><a href="#__codelineno-0-1045">1045</a></span>
<span class="normal"><a href="#__codelineno-0-1046">1046</a></span>
<span class="normal"><a href="#__codelineno-0-1047">1047</a></span>
<span class="normal"><a href="#__codelineno-0-1048">1048</a></span>
<span class="normal"><a href="#__codelineno-0-1049">1049</a></span>
<span class="normal"><a href="#__codelineno-0-1050">1050</a></span>
<span class="normal"><a href="#__codelineno-0-1051">1051</a></span>
<span class="normal"><a href="#__codelineno-0-1052">1052</a></span>
<span class="normal"><a href="#__codelineno-0-1053">1053</a></span>
<span class="normal"><a href="#__codelineno-0-1054">1054</a></span>
<span class="normal"><a href="#__codelineno-0-1055">1055</a></span>
<span class="normal"><a href="#__codelineno-0-1056">1056</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-1031"><a id="__codelineno-0-1031" name="__codelineno-0-1031"></a><span class="k">def</span> <span class="nf">apply_rights_recursively</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="p">,</span> <span class="n">only_folders</span><span class="p">:</span> <span class="nb">bool</span> <span class="o">=</span> <span class="kc">False</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="kc">None</span><span class="p">:</span>
</span><span id="__span-0-1032"><a id="__codelineno-0-1032" name="__codelineno-0-1032"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Apply the rights of this file to all children recursively.</span>
</span><span id="__span-0-1033"><a id="__codelineno-0-1033" name="__codelineno-0-1033"></a>
</span><span id="__span-0-1034"><a id="__codelineno-0-1034" name="__codelineno-0-1034"></a><span class="sd"> Args:</span>
</span><span id="__span-0-1035"><a id="__codelineno-0-1035" name="__codelineno-0-1035"></a><span class="sd"> only_folders: If True, only apply the rights to SithFiles that are folders.</span>
</span><span id="__span-0-1036"><a id="__codelineno-0-1036" name="__codelineno-0-1036"></a><span class="sd"> &quot;&quot;&quot;</span>
</span><span id="__span-0-1037"><a id="__codelineno-0-1037" name="__codelineno-0-1037"></a> <span class="n">file_ids</span> <span class="o">=</span> <span class="p">[]</span>
</span><span id="__span-0-1038"><a id="__codelineno-0-1038" name="__codelineno-0-1038"></a> <span class="n">explored_ids</span> <span class="o">=</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">id</span><span class="p">]</span>
</span><span id="__span-0-1039"><a id="__codelineno-0-1039" name="__codelineno-0-1039"></a> <span class="k">while</span> <span class="nb">len</span><span class="p">(</span><span class="n">explored_ids</span><span class="p">)</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span> <span class="c1"># find all children recursively</span>
</span><span id="__span-0-1040"><a id="__codelineno-0-1040" name="__codelineno-0-1040"></a> <span class="n">file_ids</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">explored_ids</span><span class="p">)</span>
</span><span id="__span-0-1041"><a id="__codelineno-0-1041" name="__codelineno-0-1041"></a> <span class="n">next_level</span> <span class="o">=</span> <span class="n">SithFile</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">parent_id__in</span><span class="o">=</span><span class="n">explored_ids</span><span class="p">)</span>
</span><span id="__span-0-1042"><a id="__codelineno-0-1042" name="__codelineno-0-1042"></a> <span class="k">if</span> <span class="n">only_folders</span><span class="p">:</span>
</span><span id="__span-0-1043"><a id="__codelineno-0-1043" name="__codelineno-0-1043"></a> <span class="n">next_level</span> <span class="o">=</span> <span class="n">next_level</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">is_folder</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
</span><span id="__span-0-1044"><a id="__codelineno-0-1044" name="__codelineno-0-1044"></a> <span class="n">explored_ids</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">next_level</span><span class="o">.</span><span class="n">values_list</span><span class="p">(</span><span class="s2">&quot;id&quot;</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">))</span>
</span><span id="__span-0-1045"><a id="__codelineno-0-1045" name="__codelineno-0-1045"></a> <span class="k">for</span> <span class="n">through</span> <span class="ow">in</span> <span class="p">(</span><span class="n">SithFile</span><span class="o">.</span><span class="n">view_groups</span><span class="o">.</span><span class="n">through</span><span class="p">,</span> <span class="n">SithFile</span><span class="o">.</span><span class="n">edit_groups</span><span class="o">.</span><span class="n">through</span><span class="p">):</span>
</span><span id="__span-0-1046"><a id="__codelineno-0-1046" name="__codelineno-0-1046"></a> <span class="c1"># force evaluation. Without this, the iterator yields nothing</span>
</span><span id="__span-0-1047"><a id="__codelineno-0-1047" name="__codelineno-0-1047"></a> <span class="n">groups</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span>
</span><span id="__span-0-1048"><a id="__codelineno-0-1048" name="__codelineno-0-1048"></a> <span class="n">through</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">sithfile_id</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">id</span><span class="p">)</span><span class="o">.</span><span class="n">values_list</span><span class="p">(</span>
</span><span id="__span-0-1049"><a id="__codelineno-0-1049" name="__codelineno-0-1049"></a> <span class="s2">&quot;group_id&quot;</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span>
</span><span id="__span-0-1050"><a id="__codelineno-0-1050" name="__codelineno-0-1050"></a> <span class="p">)</span>
</span><span id="__span-0-1051"><a id="__codelineno-0-1051" name="__codelineno-0-1051"></a> <span class="p">)</span>
</span><span id="__span-0-1052"><a id="__codelineno-0-1052" name="__codelineno-0-1052"></a> <span class="c1"># delete previous rights</span>
</span><span id="__span-0-1053"><a id="__codelineno-0-1053" name="__codelineno-0-1053"></a> <span class="n">through</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">sithfile_id__in</span><span class="o">=</span><span class="n">file_ids</span><span class="p">)</span><span class="o">.</span><span class="n">delete</span><span class="p">()</span>
</span><span id="__span-0-1054"><a id="__codelineno-0-1054" name="__codelineno-0-1054"></a> <span class="n">through</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">bulk_create</span><span class="p">(</span> <span class="c1"># create new rights</span>
</span><span id="__span-0-1055"><a id="__codelineno-0-1055" name="__codelineno-0-1055"></a> <span class="p">[</span><span class="n">through</span><span class="p">(</span><span class="n">sithfile_id</span><span class="o">=</span><span class="n">f</span><span class="p">,</span> <span class="n">group_id</span><span class="o">=</span><span class="n">g</span><span class="p">)</span> <span class="k">for</span> <span class="n">f</span> <span class="ow">in</span> <span class="n">file_ids</span> <span class="k">for</span> <span class="n">g</span> <span class="ow">in</span> <span class="n">groups</span><span class="p">]</span>
</span><span id="__span-0-1056"><a id="__codelineno-0-1056" name="__codelineno-0-1056"></a> <span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.SithFile.copy_rights" class="doc doc-heading">
<code class="highlight language-python"><span class="n">copy_rights</span><span class="p">()</span></code>
<a href="#core.views.SithFile.copy_rights" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Copy, if possible, the rights of the parent folder.</p>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-1058">1058</a></span>
<span class="normal"><a href="#__codelineno-0-1059">1059</a></span>
<span class="normal"><a href="#__codelineno-0-1060">1060</a></span>
<span class="normal"><a href="#__codelineno-0-1061">1061</a></span>
<span class="normal"><a href="#__codelineno-0-1062">1062</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-1058"><a id="__codelineno-0-1058" name="__codelineno-0-1058"></a><span class="k">def</span> <span class="nf">copy_rights</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
</span><span id="__span-0-1059"><a id="__codelineno-0-1059" name="__codelineno-0-1059"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Copy, if possible, the rights of the parent folder.&quot;&quot;&quot;</span>
</span><span id="__span-0-1060"><a id="__codelineno-0-1060" name="__codelineno-0-1060"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
</span><span id="__span-0-1061"><a id="__codelineno-0-1061" name="__codelineno-0-1061"></a> <span class="bp">self</span><span class="o">.</span><span class="n">edit_groups</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">edit_groups</span><span class="o">.</span><span class="n">all</span><span class="p">())</span>
</span><span id="__span-0-1062"><a id="__codelineno-0-1062" name="__codelineno-0-1062"></a> <span class="bp">self</span><span class="o">.</span><span class="n">view_groups</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">view_groups</span><span class="o">.</span><span class="n">all</span><span class="p">())</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.SithFile.move_to" class="doc doc-heading">
<code class="highlight language-python"><span class="n">move_to</span><span class="p">(</span><span class="n">parent</span><span class="p">)</span></code>
<a href="#core.views.SithFile.move_to" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Move a file to a new parent.
<code>parent</code> must be a SithFile with the <code>is_folder=True</code> property. Otherwise, this function doesn't change
anything.
This is done only at the DB level, so that it's very fast for the user. Indeed, this function doesn't modify
SithFiles recursively, so it stays efficient even with top-level folders.</p>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-1064">1064</a></span>
<span class="normal"><a href="#__codelineno-0-1065">1065</a></span>
<span class="normal"><a href="#__codelineno-0-1066">1066</a></span>
<span class="normal"><a href="#__codelineno-0-1067">1067</a></span>
<span class="normal"><a href="#__codelineno-0-1068">1068</a></span>
<span class="normal"><a href="#__codelineno-0-1069">1069</a></span>
<span class="normal"><a href="#__codelineno-0-1070">1070</a></span>
<span class="normal"><a href="#__codelineno-0-1071">1071</a></span>
<span class="normal"><a href="#__codelineno-0-1072">1072</a></span>
<span class="normal"><a href="#__codelineno-0-1073">1073</a></span>
<span class="normal"><a href="#__codelineno-0-1074">1074</a></span>
<span class="normal"><a href="#__codelineno-0-1075">1075</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-1064"><a id="__codelineno-0-1064" name="__codelineno-0-1064"></a><span class="k">def</span> <span class="nf">move_to</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="p">):</span>
</span><span id="__span-0-1065"><a id="__codelineno-0-1065" name="__codelineno-0-1065"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Move a file to a new parent.</span>
</span><span id="__span-0-1066"><a id="__codelineno-0-1066" name="__codelineno-0-1066"></a><span class="sd"> `parent` must be a SithFile with the `is_folder=True` property. Otherwise, this function doesn&#39;t change</span>
</span><span id="__span-0-1067"><a id="__codelineno-0-1067" name="__codelineno-0-1067"></a><span class="sd"> anything.</span>
</span><span id="__span-0-1068"><a id="__codelineno-0-1068" name="__codelineno-0-1068"></a><span class="sd"> This is done only at the DB level, so that it&#39;s very fast for the user. Indeed, this function doesn&#39;t modify</span>
</span><span id="__span-0-1069"><a id="__codelineno-0-1069" name="__codelineno-0-1069"></a><span class="sd"> SithFiles recursively, so it stays efficient even with top-level folders.</span>
</span><span id="__span-0-1070"><a id="__codelineno-0-1070" name="__codelineno-0-1070"></a><span class="sd"> &quot;&quot;&quot;</span>
</span><span id="__span-0-1071"><a id="__codelineno-0-1071" name="__codelineno-0-1071"></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">parent</span><span class="o">.</span><span class="n">is_folder</span><span class="p">:</span>
</span><span id="__span-0-1072"><a id="__codelineno-0-1072" name="__codelineno-0-1072"></a> <span class="k">return</span>
</span><span id="__span-0-1073"><a id="__codelineno-0-1073" name="__codelineno-0-1073"></a> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="o">=</span> <span class="n">parent</span>
</span><span id="__span-0-1074"><a id="__codelineno-0-1074" name="__codelineno-0-1074"></a> <span class="bp">self</span><span class="o">.</span><span class="n">clean</span><span class="p">()</span>
</span><span id="__span-0-1075"><a id="__codelineno-0-1075" name="__codelineno-0-1075"></a> <span class="bp">self</span><span class="o">.</span><span class="n">save</span><span class="p">()</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.MultipleFileInput" class="doc doc-heading">
<code>MultipleFileInput</code>
<a href="#core.views.MultipleFileInput" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.forms.ClearableFileInput">ClearableFileInput</span></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.MultipleFileField" class="doc doc-heading">
<code class="highlight language-python"><span class="n">MultipleFileField</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></code>
<a href="#core.views.MultipleFileField" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="core.views.files._MultipleFieldMixin">_MultipleFieldMixin</span></code>, <code><span title="django.forms.FileField">FileField</span></code></p>
<details class="quote">
<summary>Source code in <code>core/views/files.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-98"> 98</a></span>
<span class="normal"><a href="#__codelineno-0-99"> 99</a></span>
<span class="normal"><a href="#__codelineno-0-100">100</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-98"><a id="__codelineno-0-98" name="__codelineno-0-98"></a><span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
</span><span id="__span-0-99"><a id="__codelineno-0-99" name="__codelineno-0-99"></a> <span class="n">kwargs</span><span class="o">.</span><span class="n">setdefault</span><span class="p">(</span><span class="s2">&quot;widget&quot;</span><span class="p">,</span> <span class="n">MultipleFileInput</span><span class="p">())</span>
</span><span id="__span-0-100"><a id="__codelineno-0-100" name="__codelineno-0-100"></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.MultipleImageField" class="doc doc-heading">
<code class="highlight language-python"><span class="n">MultipleImageField</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></code>
<a href="#core.views.MultipleImageField" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="core.views.files._MultipleFieldMixin">_MultipleFieldMixin</span></code>, <code><span title="django.forms.ImageField">ImageField</span></code></p>
<details class="quote">
<summary>Source code in <code>core/views/files.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-98"> 98</a></span>
<span class="normal"><a href="#__codelineno-0-99"> 99</a></span>
<span class="normal"><a href="#__codelineno-0-100">100</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-98"><a id="__codelineno-0-98" name="__codelineno-0-98"></a><span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
</span><span id="__span-0-99"><a id="__codelineno-0-99" name="__codelineno-0-99"></a> <span class="n">kwargs</span><span class="o">.</span><span class="n">setdefault</span><span class="p">(</span><span class="s2">&quot;widget&quot;</span><span class="p">,</span> <span class="n">MultipleFileInput</span><span class="p">())</span>
</span><span id="__span-0-100"><a id="__codelineno-0-100" name="__codelineno-0-100"></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.AddFilesForm" class="doc doc-heading">
<code>AddFilesForm</code>
<a href="#core.views.AddFilesForm" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.forms.Form">Form</span></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.FileListView" class="doc doc-heading">
<code>FileListView</code>
<a href="#core.views.FileListView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.views.generic.ListView">ListView</span></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.FileEditView" class="doc doc-heading">
<code>FileEditView</code>
<a href="#core.views.FileEditView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.CanEditMixin" href="#core.views.CanEditMixin">CanEditMixin</a></code>, <code><span title="django.views.generic.edit.UpdateView">UpdateView</span></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.FileEditPropForm" class="doc doc-heading">
<code>FileEditPropForm</code>
<a href="#core.views.FileEditPropForm" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.forms.ModelForm">ModelForm</span></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.FileEditPropView" class="doc doc-heading">
<code>FileEditPropView</code>
<a href="#core.views.FileEditPropView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.CanEditPropMixin" href="#core.views.CanEditPropMixin">CanEditPropMixin</a></code>, <code><span title="django.views.generic.edit.UpdateView">UpdateView</span></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.FileView" class="doc doc-heading">
<code>FileView</code>
<a href="#core.views.FileView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.CanViewMixin" href="#core.views.CanViewMixin">CanViewMixin</a></code>, <code><span title="django.views.generic.DetailView">DetailView</span></code>, <code><span title="django.views.generic.edit.FormMixin">FormMixin</span></code></p>
<p>Handle the upload of new files into a folder.</p>
<div class="doc doc-children">
<div class="doc doc-object doc-function">
<h3 id="core.views.FileView.handle_clipboard" class="doc doc-heading">
<code class="highlight language-python"><span class="n">handle_clipboard</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">obj</span><span class="p">)</span></code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-staticmethod"><code>staticmethod</code></small>
</span>
<a href="#core.views.FileView.handle_clipboard" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Handle the clipboard in the view.</p>
<p>This method can fail, since it does not catch the exceptions coming from
below, allowing proper handling in the calling view.
Use this method like this:</p>
<div class="language-text highlight"><pre><span></span><code>FileView.handle_clipboard(request, self.object)
</code></pre></div>
<p><code>request</code> is usually the self.request obj in your view
<code>obj</code> is the SithFile object you want to put in the clipboard, or
where you want to paste the clipboard</p>
<details class="quote">
<summary>Source code in <code>core/views/files.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-276">276</a></span>
<span class="normal"><a href="#__codelineno-0-277">277</a></span>
<span class="normal"><a href="#__codelineno-0-278">278</a></span>
<span class="normal"><a href="#__codelineno-0-279">279</a></span>
<span class="normal"><a href="#__codelineno-0-280">280</a></span>
<span class="normal"><a href="#__codelineno-0-281">281</a></span>
<span class="normal"><a href="#__codelineno-0-282">282</a></span>
<span class="normal"><a href="#__codelineno-0-283">283</a></span>
<span class="normal"><a href="#__codelineno-0-284">284</a></span>
<span class="normal"><a href="#__codelineno-0-285">285</a></span>
<span class="normal"><a href="#__codelineno-0-286">286</a></span>
<span class="normal"><a href="#__codelineno-0-287">287</a></span>
<span class="normal"><a href="#__codelineno-0-288">288</a></span>
<span class="normal"><a href="#__codelineno-0-289">289</a></span>
<span class="normal"><a href="#__codelineno-0-290">290</a></span>
<span class="normal"><a href="#__codelineno-0-291">291</a></span>
<span class="normal"><a href="#__codelineno-0-292">292</a></span>
<span class="normal"><a href="#__codelineno-0-293">293</a></span>
<span class="normal"><a href="#__codelineno-0-294">294</a></span>
<span class="normal"><a href="#__codelineno-0-295">295</a></span>
<span class="normal"><a href="#__codelineno-0-296">296</a></span>
<span class="normal"><a href="#__codelineno-0-297">297</a></span>
<span class="normal"><a href="#__codelineno-0-298">298</a></span>
<span class="normal"><a href="#__codelineno-0-299">299</a></span>
<span class="normal"><a href="#__codelineno-0-300">300</a></span>
<span class="normal"><a href="#__codelineno-0-301">301</a></span>
<span class="normal"><a href="#__codelineno-0-302">302</a></span>
<span class="normal"><a href="#__codelineno-0-303">303</a></span>
<span class="normal"><a href="#__codelineno-0-304">304</a></span>
<span class="normal"><a href="#__codelineno-0-305">305</a></span>
<span class="normal"><a href="#__codelineno-0-306">306</a></span>
<span class="normal"><a href="#__codelineno-0-307">307</a></span>
<span class="normal"><a href="#__codelineno-0-308">308</a></span>
<span class="normal"><a href="#__codelineno-0-309">309</a></span>
<span class="normal"><a href="#__codelineno-0-310">310</a></span>
<span class="normal"><a href="#__codelineno-0-311">311</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-276"><a id="__codelineno-0-276" name="__codelineno-0-276"></a><span class="nd">@staticmethod</span>
</span><span id="__span-0-277"><a id="__codelineno-0-277" name="__codelineno-0-277"></a><span class="k">def</span> <span class="nf">handle_clipboard</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">obj</span><span class="p">):</span>
</span><span id="__span-0-278"><a id="__codelineno-0-278" name="__codelineno-0-278"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Handle the clipboard in the view.</span>
</span><span id="__span-0-279"><a id="__codelineno-0-279" name="__codelineno-0-279"></a>
</span><span id="__span-0-280"><a id="__codelineno-0-280" name="__codelineno-0-280"></a><span class="sd"> This method can fail, since it does not catch the exceptions coming from</span>
</span><span id="__span-0-281"><a id="__codelineno-0-281" name="__codelineno-0-281"></a><span class="sd"> below, allowing proper handling in the calling view.</span>
</span><span id="__span-0-282"><a id="__codelineno-0-282" name="__codelineno-0-282"></a><span class="sd"> Use this method like this:</span>
</span><span id="__span-0-283"><a id="__codelineno-0-283" name="__codelineno-0-283"></a>
</span><span id="__span-0-284"><a id="__codelineno-0-284" name="__codelineno-0-284"></a><span class="sd"> FileView.handle_clipboard(request, self.object)</span>
</span><span id="__span-0-285"><a id="__codelineno-0-285" name="__codelineno-0-285"></a>
</span><span id="__span-0-286"><a id="__codelineno-0-286" name="__codelineno-0-286"></a><span class="sd"> `request` is usually the self.request obj in your view</span>
</span><span id="__span-0-287"><a id="__codelineno-0-287" name="__codelineno-0-287"></a><span class="sd"> `obj` is the SithFile object you want to put in the clipboard, or</span>
</span><span id="__span-0-288"><a id="__codelineno-0-288" name="__codelineno-0-288"></a><span class="sd"> where you want to paste the clipboard</span>
</span><span id="__span-0-289"><a id="__codelineno-0-289" name="__codelineno-0-289"></a><span class="sd"> &quot;&quot;&quot;</span>
</span><span id="__span-0-290"><a id="__codelineno-0-290" name="__codelineno-0-290"></a> <span class="k">if</span> <span class="s2">&quot;delete&quot;</span> <span class="ow">in</span> <span class="n">request</span><span class="o">.</span><span class="n">POST</span><span class="p">:</span>
</span><span id="__span-0-291"><a id="__codelineno-0-291" name="__codelineno-0-291"></a> <span class="k">for</span> <span class="n">f_id</span> <span class="ow">in</span> <span class="n">request</span><span class="o">.</span><span class="n">POST</span><span class="o">.</span><span class="n">getlist</span><span class="p">(</span><span class="s2">&quot;file_list&quot;</span><span class="p">):</span>
</span><span id="__span-0-292"><a id="__codelineno-0-292" name="__codelineno-0-292"></a> <span class="n">file</span> <span class="o">=</span> <span class="n">SithFile</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="nb">id</span><span class="o">=</span><span class="n">f_id</span><span class="p">)</span><span class="o">.</span><span class="n">first</span><span class="p">()</span>
</span><span id="__span-0-293"><a id="__codelineno-0-293" name="__codelineno-0-293"></a> <span class="k">if</span> <span class="n">file</span><span class="p">:</span>
</span><span id="__span-0-294"><a id="__codelineno-0-294" name="__codelineno-0-294"></a> <span class="n">file</span><span class="o">.</span><span class="n">delete</span><span class="p">()</span>
</span><span id="__span-0-295"><a id="__codelineno-0-295" name="__codelineno-0-295"></a> <span class="k">if</span> <span class="s2">&quot;clear&quot;</span> <span class="ow">in</span> <span class="n">request</span><span class="o">.</span><span class="n">POST</span><span class="p">:</span>
</span><span id="__span-0-296"><a id="__codelineno-0-296" name="__codelineno-0-296"></a> <span class="n">request</span><span class="o">.</span><span class="n">session</span><span class="p">[</span><span class="s2">&quot;clipboard&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
</span><span id="__span-0-297"><a id="__codelineno-0-297" name="__codelineno-0-297"></a> <span class="k">if</span> <span class="s2">&quot;cut&quot;</span> <span class="ow">in</span> <span class="n">request</span><span class="o">.</span><span class="n">POST</span><span class="p">:</span>
</span><span id="__span-0-298"><a id="__codelineno-0-298" name="__codelineno-0-298"></a> <span class="k">for</span> <span class="n">f_id_str</span> <span class="ow">in</span> <span class="n">request</span><span class="o">.</span><span class="n">POST</span><span class="o">.</span><span class="n">getlist</span><span class="p">(</span><span class="s2">&quot;file_list&quot;</span><span class="p">):</span>
</span><span id="__span-0-299"><a id="__codelineno-0-299" name="__codelineno-0-299"></a> <span class="n">f_id</span> <span class="o">=</span> <span class="nb">int</span><span class="p">(</span><span class="n">f_id_str</span><span class="p">)</span>
</span><span id="__span-0-300"><a id="__codelineno-0-300" name="__codelineno-0-300"></a> <span class="k">if</span> <span class="p">(</span>
</span><span id="__span-0-301"><a id="__codelineno-0-301" name="__codelineno-0-301"></a> <span class="n">f_id</span> <span class="ow">in</span> <span class="p">[</span><span class="n">c</span><span class="o">.</span><span class="n">id</span> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">obj</span><span class="o">.</span><span class="n">children</span><span class="o">.</span><span class="n">all</span><span class="p">()]</span>
</span><span id="__span-0-302"><a id="__codelineno-0-302" name="__codelineno-0-302"></a> <span class="ow">and</span> <span class="n">f_id</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">request</span><span class="o">.</span><span class="n">session</span><span class="p">[</span><span class="s2">&quot;clipboard&quot;</span><span class="p">]</span>
</span><span id="__span-0-303"><a id="__codelineno-0-303" name="__codelineno-0-303"></a> <span class="p">):</span>
</span><span id="__span-0-304"><a id="__codelineno-0-304" name="__codelineno-0-304"></a> <span class="n">request</span><span class="o">.</span><span class="n">session</span><span class="p">[</span><span class="s2">&quot;clipboard&quot;</span><span class="p">]</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">f_id</span><span class="p">)</span>
</span><span id="__span-0-305"><a id="__codelineno-0-305" name="__codelineno-0-305"></a> <span class="k">if</span> <span class="s2">&quot;paste&quot;</span> <span class="ow">in</span> <span class="n">request</span><span class="o">.</span><span class="n">POST</span><span class="p">:</span>
</span><span id="__span-0-306"><a id="__codelineno-0-306" name="__codelineno-0-306"></a> <span class="k">for</span> <span class="n">f_id</span> <span class="ow">in</span> <span class="n">request</span><span class="o">.</span><span class="n">session</span><span class="p">[</span><span class="s2">&quot;clipboard&quot;</span><span class="p">]:</span>
</span><span id="__span-0-307"><a id="__codelineno-0-307" name="__codelineno-0-307"></a> <span class="n">file</span> <span class="o">=</span> <span class="n">SithFile</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="nb">id</span><span class="o">=</span><span class="n">f_id</span><span class="p">)</span><span class="o">.</span><span class="n">first</span><span class="p">()</span>
</span><span id="__span-0-308"><a id="__codelineno-0-308" name="__codelineno-0-308"></a> <span class="k">if</span> <span class="n">file</span><span class="p">:</span>
</span><span id="__span-0-309"><a id="__codelineno-0-309" name="__codelineno-0-309"></a> <span class="n">file</span><span class="o">.</span><span class="n">move_to</span><span class="p">(</span><span class="n">obj</span><span class="p">)</span>
</span><span id="__span-0-310"><a id="__codelineno-0-310" name="__codelineno-0-310"></a> <span class="n">request</span><span class="o">.</span><span class="n">session</span><span class="p">[</span><span class="s2">&quot;clipboard&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="p">[]</span>
</span><span id="__span-0-311"><a id="__codelineno-0-311" name="__codelineno-0-311"></a> <span class="n">request</span><span class="o">.</span><span class="n">session</span><span class="o">.</span><span class="n">modified</span> <span class="o">=</span> <span class="kc">True</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.FileDeleteView" class="doc doc-heading">
<code>FileDeleteView</code>
<a href="#core.views.FileDeleteView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.AllowFragment" href="#core.views.AllowFragment">AllowFragment</a></code>, <code><a class="autorefs autorefs-internal" title="core.views.CanEditPropMixin" href="#core.views.CanEditPropMixin">CanEditPropMixin</a></code>, <code><span title="django.views.generic.edit.DeleteView">DeleteView</span></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.FileModerationView" class="doc doc-heading">
<code>FileModerationView</code>
<a href="#core.views.FileModerationView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.AllowFragment" href="#core.views.AllowFragment">AllowFragment</a></code>, <code><span title="django.views.generic.ListView">ListView</span></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.FileModerateView" class="doc doc-heading">
<code>FileModerateView</code>
<a href="#core.views.FileModerateView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.CanEditPropMixin" href="#core.views.CanEditPropMixin">CanEditPropMixin</a></code>, <code><span title="django.views.generic.detail.SingleObjectMixin">SingleObjectMixin</span></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.RealGroup" class="doc doc-heading">
<code>RealGroup</code>
<a href="#core.views.RealGroup" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.models.Group" href="../models/#core.models.Group">Group</a></code></p>
<p>RealGroups are created by the developer.</p>
<p>Most of the time they match a number in settings to be easily used for permissions.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.EditMembersForm" class="doc doc-heading">
<code class="highlight language-python"><span class="n">EditMembersForm</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></code>
<a href="#core.views.EditMembersForm" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.forms.Form">Form</span></code></p>
<p>Add and remove members from a Group.</p>
<details class="quote">
<summary>Source code in <code>core/views/group.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-34">34</a></span>
<span class="normal"><a href="#__codelineno-0-35">35</a></span>
<span class="normal"><a href="#__codelineno-0-36">36</a></span>
<span class="normal"><a href="#__codelineno-0-37">37</a></span>
<span class="normal"><a href="#__codelineno-0-38">38</a></span>
<span class="normal"><a href="#__codelineno-0-39">39</a></span>
<span class="normal"><a href="#__codelineno-0-40">40</a></span>
<span class="normal"><a href="#__codelineno-0-41">41</a></span>
<span class="normal"><a href="#__codelineno-0-42">42</a></span>
<span class="normal"><a href="#__codelineno-0-43">43</a></span>
<span class="normal"><a href="#__codelineno-0-44">44</a></span>
<span class="normal"><a href="#__codelineno-0-45">45</a></span>
<span class="normal"><a href="#__codelineno-0-46">46</a></span>
<span class="normal"><a href="#__codelineno-0-47">47</a></span>
<span class="normal"><a href="#__codelineno-0-48">48</a></span>
<span class="normal"><a href="#__codelineno-0-49">49</a></span>
<span class="normal"><a href="#__codelineno-0-50">50</a></span>
<span class="normal"><a href="#__codelineno-0-51">51</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-34"><a id="__codelineno-0-34" name="__codelineno-0-34"></a><span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
</span><span id="__span-0-35"><a id="__codelineno-0-35" name="__codelineno-0-35"></a> <span class="bp">self</span><span class="o">.</span><span class="n">current_users</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">&quot;users&quot;</span><span class="p">,</span> <span class="p">[])</span>
</span><span id="__span-0-36"><a id="__codelineno-0-36" name="__codelineno-0-36"></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
</span><span id="__span-0-37"><a id="__codelineno-0-37" name="__codelineno-0-37"></a>
</span><span id="__span-0-38"><a id="__codelineno-0-38" name="__codelineno-0-38"></a> <span class="bp">self</span><span class="o">.</span><span class="n">fields</span><span class="p">[</span><span class="s2">&quot;users_added&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">forms</span><span class="o">.</span><span class="n">ModelMultipleChoiceField</span><span class="p">(</span>
</span><span id="__span-0-39"><a id="__codelineno-0-39" name="__codelineno-0-39"></a> <span class="n">label</span><span class="o">=</span><span class="n">_</span><span class="p">(</span><span class="s2">&quot;Users to add to group&quot;</span><span class="p">),</span>
</span><span id="__span-0-40"><a id="__codelineno-0-40" name="__codelineno-0-40"></a> <span class="n">help_text</span><span class="o">=</span><span class="n">_</span><span class="p">(</span><span class="s2">&quot;Search users to add (one or more).&quot;</span><span class="p">),</span>
</span><span id="__span-0-41"><a id="__codelineno-0-41" name="__codelineno-0-41"></a> <span class="n">required</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
</span><span id="__span-0-42"><a id="__codelineno-0-42" name="__codelineno-0-42"></a> <span class="n">widget</span><span class="o">=</span><span class="n">AutoCompleteSelectMultipleUser</span><span class="p">,</span>
</span><span id="__span-0-43"><a id="__codelineno-0-43" name="__codelineno-0-43"></a> <span class="n">queryset</span><span class="o">=</span><span class="n">User</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">exclude</span><span class="p">(</span><span class="n">id__in</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">current_users</span><span class="p">)</span><span class="o">.</span><span class="n">all</span><span class="p">(),</span>
</span><span id="__span-0-44"><a id="__codelineno-0-44" name="__codelineno-0-44"></a> <span class="p">)</span>
</span><span id="__span-0-45"><a id="__codelineno-0-45" name="__codelineno-0-45"></a>
</span><span id="__span-0-46"><a id="__codelineno-0-46" name="__codelineno-0-46"></a> <span class="bp">self</span><span class="o">.</span><span class="n">fields</span><span class="p">[</span><span class="s2">&quot;users_removed&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">forms</span><span class="o">.</span><span class="n">ModelMultipleChoiceField</span><span class="p">(</span>
</span><span id="__span-0-47"><a id="__codelineno-0-47" name="__codelineno-0-47"></a> <span class="n">User</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">id__in</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">current_users</span><span class="p">)</span><span class="o">.</span><span class="n">all</span><span class="p">(),</span>
</span><span id="__span-0-48"><a id="__codelineno-0-48" name="__codelineno-0-48"></a> <span class="n">label</span><span class="o">=</span><span class="n">_</span><span class="p">(</span><span class="s2">&quot;Users to remove from group&quot;</span><span class="p">),</span>
</span><span id="__span-0-49"><a id="__codelineno-0-49" name="__codelineno-0-49"></a> <span class="n">required</span><span class="o">=</span><span class="kc">False</span><span class="p">,</span>
</span><span id="__span-0-50"><a id="__codelineno-0-50" name="__codelineno-0-50"></a> <span class="n">widget</span><span class="o">=</span><span class="n">forms</span><span class="o">.</span><span class="n">CheckboxSelectMultiple</span><span class="p">,</span>
</span><span id="__span-0-51"><a id="__codelineno-0-51" name="__codelineno-0-51"></a> <span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.GroupListView" class="doc doc-heading">
<code>GroupListView</code>
<a href="#core.views.GroupListView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.CanEditMixin" href="#core.views.CanEditMixin">CanEditMixin</a></code>, <code><span title="django.views.generic.ListView">ListView</span></code></p>
<p>Displays the Group list.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.GroupEditView" class="doc doc-heading">
<code>GroupEditView</code>
<a href="#core.views.GroupEditView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.CanEditMixin" href="#core.views.CanEditMixin">CanEditMixin</a></code>, <code><span title="django.views.generic.edit.UpdateView">UpdateView</span></code></p>
<p>Edit infos of a Group.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.GroupCreateView" class="doc doc-heading">
<code>GroupCreateView</code>
<a href="#core.views.GroupCreateView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.CanCreateMixin" href="#core.views.CanCreateMixin">CanCreateMixin</a></code>, <code><span title="django.views.generic.edit.CreateView">CreateView</span></code></p>
<p>Add a new Group.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.GroupTemplateView" class="doc doc-heading">
<code>GroupTemplateView</code>
<a href="#core.views.GroupTemplateView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.CanEditMixin" href="#core.views.CanEditMixin">CanEditMixin</a></code>, <code><a class="autorefs autorefs-internal" title="core.views.DetailFormView" href="#core.views.DetailFormView">DetailFormView</a></code></p>
<p>Display all users in a given Group
Allow adding and removing users from it.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.GroupDeleteView" class="doc doc-heading">
<code>GroupDeleteView</code>
<a href="#core.views.GroupDeleteView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.CanEditMixin" href="#core.views.CanEditMixin">CanEditMixin</a></code>, <code><span title="django.views.generic.edit.DeleteView">DeleteView</span></code></p>
<p>Delete a Group.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.LockError" class="doc doc-heading">
<code>LockError</code>
<a href="#core.views.LockError" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code>Exception</code></p>
<p>There was a lock error on the object.</p>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.Page" class="doc doc-heading">
<code>Page</code>
<a href="#core.views.Page" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.db.models.Model">Model</span></code></p>
<p>The page class to build a Wiki
Each page may have a parent and it's URL is of the form my.site/page/<grd_pa>/<parent>/<mypage>
It has an ID field, but don't use it, since it's only there for DB part, and because compound primary key is
awkward!
Prefere querying pages with Page.get_page_by_full_name().</p>
<p>Be careful with the _full_name attribute: this field may not be valid until you call save(). It's made for fast
query, but don't rely on it when playing with a Page object, use get_full_name() instead!</p>
<div class="doc doc-children">
<div class="doc doc-object doc-function">
<h3 id="core.views.Page.save" class="doc doc-heading">
<code class="highlight language-python"><span class="n">save</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></code>
<a href="#core.views.Page.save" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Performs some needed actions before and after saving a page in database.</p>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-1267">1267</a></span>
<span class="normal"><a href="#__codelineno-0-1268">1268</a></span>
<span class="normal"><a href="#__codelineno-0-1269">1269</a></span>
<span class="normal"><a href="#__codelineno-0-1270">1270</a></span>
<span class="normal"><a href="#__codelineno-0-1271">1271</a></span>
<span class="normal"><a href="#__codelineno-0-1272">1272</a></span>
<span class="normal"><a href="#__codelineno-0-1273">1273</a></span>
<span class="normal"><a href="#__codelineno-0-1274">1274</a></span>
<span class="normal"><a href="#__codelineno-0-1275">1275</a></span>
<span class="normal"><a href="#__codelineno-0-1276">1276</a></span>
<span class="normal"><a href="#__codelineno-0-1277">1277</a></span>
<span class="normal"><a href="#__codelineno-0-1278">1278</a></span>
<span class="normal"><a href="#__codelineno-0-1279">1279</a></span>
<span class="normal"><a href="#__codelineno-0-1280">1280</a></span>
<span class="normal"><a href="#__codelineno-0-1281">1281</a></span>
<span class="normal"><a href="#__codelineno-0-1282">1282</a></span>
<span class="normal"><a href="#__codelineno-0-1283">1283</a></span>
<span class="normal"><a href="#__codelineno-0-1284">1284</a></span>
<span class="normal"><a href="#__codelineno-0-1285">1285</a></span>
<span class="normal"><a href="#__codelineno-0-1286">1286</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-1267"><a id="__codelineno-0-1267" name="__codelineno-0-1267"></a><span class="k">def</span> <span class="nf">save</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
</span><span id="__span-0-1268"><a id="__codelineno-0-1268" name="__codelineno-0-1268"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Performs some needed actions before and after saving a page in database.&quot;&quot;&quot;</span>
</span><span id="__span-0-1269"><a id="__codelineno-0-1269" name="__codelineno-0-1269"></a> <span class="n">locked</span> <span class="o">=</span> <span class="n">kwargs</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="s2">&quot;force_lock&quot;</span><span class="p">,</span> <span class="kc">False</span><span class="p">)</span>
</span><span id="__span-0-1270"><a id="__codelineno-0-1270" name="__codelineno-0-1270"></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">locked</span><span class="p">:</span>
</span><span id="__span-0-1271"><a id="__codelineno-0-1271" name="__codelineno-0-1271"></a> <span class="n">locked</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_locked</span><span class="p">()</span>
</span><span id="__span-0-1272"><a id="__codelineno-0-1272" name="__codelineno-0-1272"></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">locked</span><span class="p">:</span>
</span><span id="__span-0-1273"><a id="__codelineno-0-1273" name="__codelineno-0-1273"></a> <span class="k">raise</span> <span class="n">NotLocked</span><span class="p">(</span><span class="s2">&quot;The page is not locked and thus can not be saved&quot;</span><span class="p">)</span>
</span><span id="__span-0-1274"><a id="__codelineno-0-1274" name="__codelineno-0-1274"></a> <span class="bp">self</span><span class="o">.</span><span class="n">full_clean</span><span class="p">()</span>
</span><span id="__span-0-1275"><a id="__codelineno-0-1275" name="__codelineno-0-1275"></a> <span class="k">if</span> <span class="ow">not</span> <span class="bp">self</span><span class="o">.</span><span class="n">id</span><span class="p">:</span>
</span><span id="__span-0-1276"><a id="__codelineno-0-1276" name="__codelineno-0-1276"></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">save</span><span class="p">(</span>
</span><span id="__span-0-1277"><a id="__codelineno-0-1277" name="__codelineno-0-1277"></a> <span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span>
</span><span id="__span-0-1278"><a id="__codelineno-0-1278" name="__codelineno-0-1278"></a> <span class="p">)</span> <span class="c1"># Save a first time to correctly set _full_name</span>
</span><span id="__span-0-1279"><a id="__codelineno-0-1279" name="__codelineno-0-1279"></a> <span class="c1"># This reset the _full_name just before saving to maintain a coherent field quicker for queries than the</span>
</span><span id="__span-0-1280"><a id="__codelineno-0-1280" name="__codelineno-0-1280"></a> <span class="c1"># recursive method</span>
</span><span id="__span-0-1281"><a id="__codelineno-0-1281" name="__codelineno-0-1281"></a> <span class="c1"># It also update all the children to maintain correct names</span>
</span><span id="__span-0-1282"><a id="__codelineno-0-1282" name="__codelineno-0-1282"></a> <span class="bp">self</span><span class="o">.</span><span class="n">_full_name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_full_name</span><span class="p">()</span>
</span><span id="__span-0-1283"><a id="__codelineno-0-1283" name="__codelineno-0-1283"></a> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">children</span><span class="o">.</span><span class="n">all</span><span class="p">():</span>
</span><span id="__span-0-1284"><a id="__codelineno-0-1284" name="__codelineno-0-1284"></a> <span class="n">c</span><span class="o">.</span><span class="n">save</span><span class="p">()</span>
</span><span id="__span-0-1285"><a id="__codelineno-0-1285" name="__codelineno-0-1285"></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="o">*</span><span class="n">args</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
</span><span id="__span-0-1286"><a id="__codelineno-0-1286" name="__codelineno-0-1286"></a> <span class="bp">self</span><span class="o">.</span><span class="n">unset_lock</span><span class="p">()</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.Page.get_page_by_full_name" class="doc doc-heading">
<code class="highlight language-python"><span class="n">get_page_by_full_name</span><span class="p">(</span><span class="n">name</span><span class="p">)</span></code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-staticmethod"><code>staticmethod</code></small>
</span>
<a href="#core.views.Page.get_page_by_full_name" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Quicker to get a page with that method rather than building the request every time.</p>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-1291">1291</a></span>
<span class="normal"><a href="#__codelineno-0-1292">1292</a></span>
<span class="normal"><a href="#__codelineno-0-1293">1293</a></span>
<span class="normal"><a href="#__codelineno-0-1294">1294</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-1291"><a id="__codelineno-0-1291" name="__codelineno-0-1291"></a><span class="nd">@staticmethod</span>
</span><span id="__span-0-1292"><a id="__codelineno-0-1292" name="__codelineno-0-1292"></a><span class="k">def</span> <span class="nf">get_page_by_full_name</span><span class="p">(</span><span class="n">name</span><span class="p">):</span>
</span><span id="__span-0-1293"><a id="__codelineno-0-1293" name="__codelineno-0-1293"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Quicker to get a page with that method rather than building the request every time.&quot;&quot;&quot;</span>
</span><span id="__span-0-1294"><a id="__codelineno-0-1294" name="__codelineno-0-1294"></a> <span class="k">return</span> <span class="n">Page</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">_full_name</span><span class="o">=</span><span class="n">name</span><span class="p">)</span><span class="o">.</span><span class="n">first</span><span class="p">()</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.Page.clean" class="doc doc-heading">
<code class="highlight language-python"><span class="n">clean</span><span class="p">()</span></code>
<a href="#core.views.Page.clean" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Cleans up only the name for the moment, but this can be used to make any treatment before saving the object.</p>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-1296">1296</a></span>
<span class="normal"><a href="#__codelineno-0-1297">1297</a></span>
<span class="normal"><a href="#__codelineno-0-1298">1298</a></span>
<span class="normal"><a href="#__codelineno-0-1299">1299</a></span>
<span class="normal"><a href="#__codelineno-0-1300">1300</a></span>
<span class="normal"><a href="#__codelineno-0-1301">1301</a></span>
<span class="normal"><a href="#__codelineno-0-1302">1302</a></span>
<span class="normal"><a href="#__codelineno-0-1303">1303</a></span>
<span class="normal"><a href="#__codelineno-0-1304">1304</a></span>
<span class="normal"><a href="#__codelineno-0-1305">1305</a></span>
<span class="normal"><a href="#__codelineno-0-1306">1306</a></span>
<span class="normal"><a href="#__codelineno-0-1307">1307</a></span>
<span class="normal"><a href="#__codelineno-0-1308">1308</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-1296"><a id="__codelineno-0-1296" name="__codelineno-0-1296"></a><span class="k">def</span> <span class="nf">clean</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
</span><span id="__span-0-1297"><a id="__codelineno-0-1297" name="__codelineno-0-1297"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Cleans up only the name for the moment, but this can be used to make any treatment before saving the object.&quot;&quot;&quot;</span>
</span><span id="__span-0-1298"><a id="__codelineno-0-1298" name="__codelineno-0-1298"></a> <span class="k">if</span> <span class="s2">&quot;/&quot;</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="p">:</span>
</span><span id="__span-0-1299"><a id="__codelineno-0-1299" name="__codelineno-0-1299"></a> <span class="bp">self</span><span class="o">.</span><span class="n">name</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">split</span><span class="p">(</span><span class="s2">&quot;/&quot;</span><span class="p">)[</span><span class="o">-</span><span class="mi">1</span><span class="p">]</span>
</span><span id="__span-0-1300"><a id="__codelineno-0-1300" name="__codelineno-0-1300"></a> <span class="k">if</span> <span class="p">(</span>
</span><span id="__span-0-1301"><a id="__codelineno-0-1301" name="__codelineno-0-1301"></a> <span class="n">Page</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">exclude</span><span class="p">(</span><span class="n">pk</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">pk</span><span class="p">)</span>
</span><span id="__span-0-1302"><a id="__codelineno-0-1302" name="__codelineno-0-1302"></a> <span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">_full_name</span><span class="o">=</span><span class="bp">self</span><span class="o">.</span><span class="n">get_full_name</span><span class="p">())</span>
</span><span id="__span-0-1303"><a id="__codelineno-0-1303" name="__codelineno-0-1303"></a> <span class="o">.</span><span class="n">exists</span><span class="p">()</span>
</span><span id="__span-0-1304"><a id="__codelineno-0-1304" name="__codelineno-0-1304"></a> <span class="p">):</span>
</span><span id="__span-0-1305"><a id="__codelineno-0-1305" name="__codelineno-0-1305"></a> <span class="k">raise</span> <span class="n">ValidationError</span><span class="p">(</span><span class="n">_</span><span class="p">(</span><span class="s2">&quot;Duplicate page&quot;</span><span class="p">),</span> <span class="n">code</span><span class="o">=</span><span class="s2">&quot;duplicate&quot;</span><span class="p">)</span>
</span><span id="__span-0-1306"><a id="__codelineno-0-1306" name="__codelineno-0-1306"></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">clean</span><span class="p">()</span>
</span><span id="__span-0-1307"><a id="__codelineno-0-1307" name="__codelineno-0-1307"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span> <span class="ow">and</span> <span class="bp">self</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_parent_list</span><span class="p">():</span>
</span><span id="__span-0-1308"><a id="__codelineno-0-1308" name="__codelineno-0-1308"></a> <span class="k">raise</span> <span class="n">ValidationError</span><span class="p">(</span><span class="n">_</span><span class="p">(</span><span class="s2">&quot;Loop in page tree&quot;</span><span class="p">),</span> <span class="n">code</span><span class="o">=</span><span class="s2">&quot;loop&quot;</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.Page.is_locked" class="doc doc-heading">
<code class="highlight language-python"><span class="n">is_locked</span><span class="p">()</span></code>
<a href="#core.views.Page.is_locked" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Is True if the page is locked, False otherwise.</p>
<p>This is where the timeout is handled,
so a locked page for which the timeout is reach will be unlocked and this
function will return False.</p>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-1327">1327</a></span>
<span class="normal"><a href="#__codelineno-0-1328">1328</a></span>
<span class="normal"><a href="#__codelineno-0-1329">1329</a></span>
<span class="normal"><a href="#__codelineno-0-1330">1330</a></span>
<span class="normal"><a href="#__codelineno-0-1331">1331</a></span>
<span class="normal"><a href="#__codelineno-0-1332">1332</a></span>
<span class="normal"><a href="#__codelineno-0-1333">1333</a></span>
<span class="normal"><a href="#__codelineno-0-1334">1334</a></span>
<span class="normal"><a href="#__codelineno-0-1335">1335</a></span>
<span class="normal"><a href="#__codelineno-0-1336">1336</a></span>
<span class="normal"><a href="#__codelineno-0-1337">1337</a></span>
<span class="normal"><a href="#__codelineno-0-1338">1338</a></span>
<span class="normal"><a href="#__codelineno-0-1339">1339</a></span>
<span class="normal"><a href="#__codelineno-0-1340">1340</a></span>
<span class="normal"><a href="#__codelineno-0-1341">1341</a></span>
<span class="normal"><a href="#__codelineno-0-1342">1342</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-1327"><a id="__codelineno-0-1327" name="__codelineno-0-1327"></a><span class="k">def</span> <span class="nf">is_locked</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
</span><span id="__span-0-1328"><a id="__codelineno-0-1328" name="__codelineno-0-1328"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Is True if the page is locked, False otherwise.</span>
</span><span id="__span-0-1329"><a id="__codelineno-0-1329" name="__codelineno-0-1329"></a>
</span><span id="__span-0-1330"><a id="__codelineno-0-1330" name="__codelineno-0-1330"></a><span class="sd"> This is where the timeout is handled,</span>
</span><span id="__span-0-1331"><a id="__codelineno-0-1331" name="__codelineno-0-1331"></a><span class="sd"> so a locked page for which the timeout is reach will be unlocked and this</span>
</span><span id="__span-0-1332"><a id="__codelineno-0-1332" name="__codelineno-0-1332"></a><span class="sd"> function will return False.</span>
</span><span id="__span-0-1333"><a id="__codelineno-0-1333" name="__codelineno-0-1333"></a><span class="sd"> &quot;&quot;&quot;</span>
</span><span id="__span-0-1334"><a id="__codelineno-0-1334" name="__codelineno-0-1334"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">lock_timeout</span> <span class="ow">and</span> <span class="p">(</span>
</span><span id="__span-0-1335"><a id="__codelineno-0-1335" name="__codelineno-0-1335"></a> <span class="n">timezone</span><span class="o">.</span><span class="n">now</span><span class="p">()</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">lock_timeout</span> <span class="o">&gt;</span> <span class="n">timedelta</span><span class="p">(</span><span class="n">minutes</span><span class="o">=</span><span class="mi">5</span><span class="p">)</span>
</span><span id="__span-0-1336"><a id="__codelineno-0-1336" name="__codelineno-0-1336"></a> <span class="p">):</span>
</span><span id="__span-0-1337"><a id="__codelineno-0-1337" name="__codelineno-0-1337"></a> <span class="bp">self</span><span class="o">.</span><span class="n">unset_lock</span><span class="p">()</span>
</span><span id="__span-0-1338"><a id="__codelineno-0-1338" name="__codelineno-0-1338"></a> <span class="k">return</span> <span class="p">(</span>
</span><span id="__span-0-1339"><a id="__codelineno-0-1339" name="__codelineno-0-1339"></a> <span class="bp">self</span><span class="o">.</span><span class="n">lock_user</span>
</span><span id="__span-0-1340"><a id="__codelineno-0-1340" name="__codelineno-0-1340"></a> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">lock_timeout</span>
</span><span id="__span-0-1341"><a id="__codelineno-0-1341" name="__codelineno-0-1341"></a> <span class="ow">and</span> <span class="p">(</span><span class="n">timezone</span><span class="o">.</span><span class="n">now</span><span class="p">()</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">lock_timeout</span> <span class="o">&lt;</span> <span class="n">timedelta</span><span class="p">(</span><span class="n">minutes</span><span class="o">=</span><span class="mi">5</span><span class="p">))</span>
</span><span id="__span-0-1342"><a id="__codelineno-0-1342" name="__codelineno-0-1342"></a> <span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.Page.set_lock" class="doc doc-heading">
<code class="highlight language-python"><span class="n">set_lock</span><span class="p">(</span><span class="n">user</span><span class="p">)</span></code>
<a href="#core.views.Page.set_lock" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Sets a lock on the current page or raise an AlreadyLocked exception.</p>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-1344">1344</a></span>
<span class="normal"><a href="#__codelineno-0-1345">1345</a></span>
<span class="normal"><a href="#__codelineno-0-1346">1346</a></span>
<span class="normal"><a href="#__codelineno-0-1347">1347</a></span>
<span class="normal"><a href="#__codelineno-0-1348">1348</a></span>
<span class="normal"><a href="#__codelineno-0-1349">1349</a></span>
<span class="normal"><a href="#__codelineno-0-1350">1350</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-1344"><a id="__codelineno-0-1344" name="__codelineno-0-1344"></a><span class="k">def</span> <span class="nf">set_lock</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">user</span><span class="p">):</span>
</span><span id="__span-0-1345"><a id="__codelineno-0-1345" name="__codelineno-0-1345"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Sets a lock on the current page or raise an AlreadyLocked exception.&quot;&quot;&quot;</span>
</span><span id="__span-0-1346"><a id="__codelineno-0-1346" name="__codelineno-0-1346"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_locked</span><span class="p">()</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_lock</span><span class="p">()</span> <span class="o">!=</span> <span class="n">user</span><span class="p">:</span>
</span><span id="__span-0-1347"><a id="__codelineno-0-1347" name="__codelineno-0-1347"></a> <span class="k">raise</span> <span class="n">AlreadyLocked</span><span class="p">(</span><span class="s2">&quot;The page is already locked by someone else&quot;</span><span class="p">)</span>
</span><span id="__span-0-1348"><a id="__codelineno-0-1348" name="__codelineno-0-1348"></a> <span class="bp">self</span><span class="o">.</span><span class="n">lock_user</span> <span class="o">=</span> <span class="n">user</span>
</span><span id="__span-0-1349"><a id="__codelineno-0-1349" name="__codelineno-0-1349"></a> <span class="bp">self</span><span class="o">.</span><span class="n">lock_timeout</span> <span class="o">=</span> <span class="n">timezone</span><span class="o">.</span><span class="n">now</span><span class="p">()</span>
</span><span id="__span-0-1350"><a id="__codelineno-0-1350" name="__codelineno-0-1350"></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">save</span><span class="p">()</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.Page.set_lock_recursive" class="doc doc-heading">
<code class="highlight language-python"><span class="n">set_lock_recursive</span><span class="p">(</span><span class="n">user</span><span class="p">)</span></code>
<a href="#core.views.Page.set_lock_recursive" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Locks recursively all the child pages for editing properties.</p>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-1352">1352</a></span>
<span class="normal"><a href="#__codelineno-0-1353">1353</a></span>
<span class="normal"><a href="#__codelineno-0-1354">1354</a></span>
<span class="normal"><a href="#__codelineno-0-1355">1355</a></span>
<span class="normal"><a href="#__codelineno-0-1356">1356</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-1352"><a id="__codelineno-0-1352" name="__codelineno-0-1352"></a><span class="k">def</span> <span class="nf">set_lock_recursive</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">user</span><span class="p">):</span>
</span><span id="__span-0-1353"><a id="__codelineno-0-1353" name="__codelineno-0-1353"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Locks recursively all the child pages for editing properties.&quot;&quot;&quot;</span>
</span><span id="__span-0-1354"><a id="__codelineno-0-1354" name="__codelineno-0-1354"></a> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">children</span><span class="o">.</span><span class="n">all</span><span class="p">():</span>
</span><span id="__span-0-1355"><a id="__codelineno-0-1355" name="__codelineno-0-1355"></a> <span class="n">p</span><span class="o">.</span><span class="n">set_lock_recursive</span><span class="p">(</span><span class="n">user</span><span class="p">)</span>
</span><span id="__span-0-1356"><a id="__codelineno-0-1356" name="__codelineno-0-1356"></a> <span class="bp">self</span><span class="o">.</span><span class="n">set_lock</span><span class="p">(</span><span class="n">user</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.Page.unset_lock_recursive" class="doc doc-heading">
<code class="highlight language-python"><span class="n">unset_lock_recursive</span><span class="p">()</span></code>
<a href="#core.views.Page.unset_lock_recursive" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Unlocks recursively all the child pages.</p>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-1358">1358</a></span>
<span class="normal"><a href="#__codelineno-0-1359">1359</a></span>
<span class="normal"><a href="#__codelineno-0-1360">1360</a></span>
<span class="normal"><a href="#__codelineno-0-1361">1361</a></span>
<span class="normal"><a href="#__codelineno-0-1362">1362</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-1358"><a id="__codelineno-0-1358" name="__codelineno-0-1358"></a><span class="k">def</span> <span class="nf">unset_lock_recursive</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
</span><span id="__span-0-1359"><a id="__codelineno-0-1359" name="__codelineno-0-1359"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Unlocks recursively all the child pages.&quot;&quot;&quot;</span>
</span><span id="__span-0-1360"><a id="__codelineno-0-1360" name="__codelineno-0-1360"></a> <span class="k">for</span> <span class="n">p</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">children</span><span class="o">.</span><span class="n">all</span><span class="p">():</span>
</span><span id="__span-0-1361"><a id="__codelineno-0-1361" name="__codelineno-0-1361"></a> <span class="n">p</span><span class="o">.</span><span class="n">unset_lock_recursive</span><span class="p">()</span>
</span><span id="__span-0-1362"><a id="__codelineno-0-1362" name="__codelineno-0-1362"></a> <span class="bp">self</span><span class="o">.</span><span class="n">unset_lock</span><span class="p">()</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.Page.unset_lock" class="doc doc-heading">
<code class="highlight language-python"><span class="n">unset_lock</span><span class="p">()</span></code>
<a href="#core.views.Page.unset_lock" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Always try to unlock, even if there is no lock.</p>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-1364">1364</a></span>
<span class="normal"><a href="#__codelineno-0-1365">1365</a></span>
<span class="normal"><a href="#__codelineno-0-1366">1366</a></span>
<span class="normal"><a href="#__codelineno-0-1367">1367</a></span>
<span class="normal"><a href="#__codelineno-0-1368">1368</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-1364"><a id="__codelineno-0-1364" name="__codelineno-0-1364"></a><span class="k">def</span> <span class="nf">unset_lock</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
</span><span id="__span-0-1365"><a id="__codelineno-0-1365" name="__codelineno-0-1365"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Always try to unlock, even if there is no lock.&quot;&quot;&quot;</span>
</span><span id="__span-0-1366"><a id="__codelineno-0-1366" name="__codelineno-0-1366"></a> <span class="bp">self</span><span class="o">.</span><span class="n">lock_user</span> <span class="o">=</span> <span class="kc">None</span>
</span><span id="__span-0-1367"><a id="__codelineno-0-1367" name="__codelineno-0-1367"></a> <span class="bp">self</span><span class="o">.</span><span class="n">lock_timeout</span> <span class="o">=</span> <span class="kc">None</span>
</span><span id="__span-0-1368"><a id="__codelineno-0-1368" name="__codelineno-0-1368"></a> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="n">save</span><span class="p">()</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.Page.get_lock" class="doc doc-heading">
<code class="highlight language-python"><span class="n">get_lock</span><span class="p">()</span></code>
<a href="#core.views.Page.get_lock" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Returns the page's mutex containing the time and the user in a dict.</p>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-1370">1370</a></span>
<span class="normal"><a href="#__codelineno-0-1371">1371</a></span>
<span class="normal"><a href="#__codelineno-0-1372">1372</a></span>
<span class="normal"><a href="#__codelineno-0-1373">1373</a></span>
<span class="normal"><a href="#__codelineno-0-1374">1374</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-1370"><a id="__codelineno-0-1370" name="__codelineno-0-1370"></a><span class="k">def</span> <span class="nf">get_lock</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
</span><span id="__span-0-1371"><a id="__codelineno-0-1371" name="__codelineno-0-1371"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Returns the page&#39;s mutex containing the time and the user in a dict.&quot;&quot;&quot;</span>
</span><span id="__span-0-1372"><a id="__codelineno-0-1372" name="__codelineno-0-1372"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">lock_user</span><span class="p">:</span>
</span><span id="__span-0-1373"><a id="__codelineno-0-1373" name="__codelineno-0-1373"></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">lock_user</span>
</span><span id="__span-0-1374"><a id="__codelineno-0-1374" name="__codelineno-0-1374"></a> <span class="k">raise</span> <span class="n">NotLocked</span><span class="p">(</span><span class="s2">&quot;The page is not locked and thus can not return its user&quot;</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.Page.get_full_name" class="doc doc-heading">
<code class="highlight language-python"><span class="n">get_full_name</span><span class="p">()</span></code>
<a href="#core.views.Page.get_full_name" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Computes the real full_name of the page based on its name and its parent's name
You can and must rely on this function when working on a page object that is not freshly fetched from the DB
(For example when treating a Page object coming from a form).</p>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-1376">1376</a></span>
<span class="normal"><a href="#__codelineno-0-1377">1377</a></span>
<span class="normal"><a href="#__codelineno-0-1378">1378</a></span>
<span class="normal"><a href="#__codelineno-0-1379">1379</a></span>
<span class="normal"><a href="#__codelineno-0-1380">1380</a></span>
<span class="normal"><a href="#__codelineno-0-1381">1381</a></span>
<span class="normal"><a href="#__codelineno-0-1382">1382</a></span>
<span class="normal"><a href="#__codelineno-0-1383">1383</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-1376"><a id="__codelineno-0-1376" name="__codelineno-0-1376"></a><span class="k">def</span> <span class="nf">get_full_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
</span><span id="__span-0-1377"><a id="__codelineno-0-1377" name="__codelineno-0-1377"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Computes the real full_name of the page based on its name and its parent&#39;s name</span>
</span><span id="__span-0-1378"><a id="__codelineno-0-1378" name="__codelineno-0-1378"></a><span class="sd"> You can and must rely on this function when working on a page object that is not freshly fetched from the DB</span>
</span><span id="__span-0-1379"><a id="__codelineno-0-1379" name="__codelineno-0-1379"></a><span class="sd"> (For example when treating a Page object coming from a form).</span>
</span><span id="__span-0-1380"><a id="__codelineno-0-1380" name="__codelineno-0-1380"></a><span class="sd"> &quot;&quot;&quot;</span>
</span><span id="__span-0-1381"><a id="__codelineno-0-1381" name="__codelineno-0-1381"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">parent</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
</span><span id="__span-0-1382"><a id="__codelineno-0-1382" name="__codelineno-0-1382"></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">name</span>
</span><span id="__span-0-1383"><a id="__codelineno-0-1383" name="__codelineno-0-1383"></a> <span class="k">return</span> <span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">parent</span><span class="o">.</span><span class="n">get_full_name</span><span class="p">()</span><span class="si">}</span><span class="s2">/</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">name</span><span class="si">}</span><span class="s2">&quot;</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.PageRev" class="doc doc-heading">
<code>PageRev</code>
<a href="#core.views.PageRev" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.db.models.Model">Model</span></code></p>
<p>True content of the page.</p>
<p>Each page object has a revisions field that is a list of PageRev, ordered by date.
my_page.revisions.last() gives the PageRev object that is the most up-to-date, and thus,
is the real content of the page.
The content is in PageRev.title and PageRev.content .</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.CanEditPagePropMixin" class="doc doc-heading">
<code>CanEditPagePropMixin</code>
<a href="#core.views.CanEditPagePropMixin" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.CanEditPropMixin" href="#core.views.CanEditPropMixin">CanEditPropMixin</a></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.PageListView" class="doc doc-heading">
<code>PageListView</code>
<a href="#core.views.PageListView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.CanViewMixin" href="#core.views.CanViewMixin">CanViewMixin</a></code>, <code><span title="django.views.generic.ListView">ListView</span></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.PageView" class="doc doc-heading">
<code>PageView</code>
<a href="#core.views.PageView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.CanViewMixin" href="#core.views.CanViewMixin">CanViewMixin</a></code>, <code><span title="django.views.generic.DetailView">DetailView</span></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.PageHistView" class="doc doc-heading">
<code>PageHistView</code>
<a href="#core.views.PageHistView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.CanViewMixin" href="#core.views.CanViewMixin">CanViewMixin</a></code>, <code><span title="django.views.generic.DetailView">DetailView</span></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.PageRevView" class="doc doc-heading">
<code>PageRevView</code>
<a href="#core.views.PageRevView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.CanViewMixin" href="#core.views.CanViewMixin">CanViewMixin</a></code>, <code><span title="django.views.generic.DetailView">DetailView</span></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.PageCreateView" class="doc doc-heading">
<code>PageCreateView</code>
<a href="#core.views.PageCreateView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.CanCreateMixin" href="#core.views.CanCreateMixin">CanCreateMixin</a></code>, <code><span title="django.views.generic.edit.CreateView">CreateView</span></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.PagePropView" class="doc doc-heading">
<code>PagePropView</code>
<a href="#core.views.PagePropView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.page.CanEditPagePropMixin" href="#core.views.CanEditPagePropMixin">CanEditPagePropMixin</a></code>, <code><span title="django.views.generic.edit.UpdateView">UpdateView</span></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.PageEditViewBase" class="doc doc-heading">
<code>PageEditViewBase</code>
<a href="#core.views.PageEditViewBase" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.CanEditMixin" href="#core.views.CanEditMixin">CanEditMixin</a></code>, <code><span title="django.views.generic.edit.UpdateView">UpdateView</span></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.PageEditView" class="doc doc-heading">
<code>PageEditView</code>
<a href="#core.views.PageEditView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.page.PageEditViewBase" href="#core.views.PageEditViewBase">PageEditViewBase</a></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.PageDeleteView" class="doc doc-heading">
<code>PageDeleteView</code>
<a href="#core.views.PageDeleteView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.page.CanEditPagePropMixin" href="#core.views.CanEditPagePropMixin">CanEditPagePropMixin</a></code>, <code><span title="django.views.generic.edit.DeleteView">DeleteView</span></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.Notification" class="doc doc-heading">
<code>Notification</code>
<a href="#core.views.Notification" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.db.models.Model">Model</span></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.Club" class="doc doc-heading">
<code>Club</code>
<a href="#core.views.Club" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.db.models.Model">Model</span></code></p>
<p>The Club class, made as a tree to allow nice tidy organization.</p>
<div class="doc doc-children">
<div class="doc doc-object doc-function">
<h3 id="core.views.Club.check_loop" class="doc doc-heading">
<code class="highlight language-python"><span class="n">check_loop</span><span class="p">()</span></code>
<a href="#core.views.Club.check_loop" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Raise a validation error when a loop is found within the parent list.</p>
<details class="quote">
<summary>Source code in <code>club/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-144">144</a></span>
<span class="normal"><a href="#__codelineno-0-145">145</a></span>
<span class="normal"><a href="#__codelineno-0-146">146</a></span>
<span class="normal"><a href="#__codelineno-0-147">147</a></span>
<span class="normal"><a href="#__codelineno-0-148">148</a></span>
<span class="normal"><a href="#__codelineno-0-149">149</a></span>
<span class="normal"><a href="#__codelineno-0-150">150</a></span>
<span class="normal"><a href="#__codelineno-0-151">151</a></span>
<span class="normal"><a href="#__codelineno-0-152">152</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-144"><a id="__codelineno-0-144" name="__codelineno-0-144"></a><span class="k">def</span> <span class="nf">check_loop</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
</span><span id="__span-0-145"><a id="__codelineno-0-145" name="__codelineno-0-145"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Raise a validation error when a loop is found within the parent list.&quot;&quot;&quot;</span>
</span><span id="__span-0-146"><a id="__codelineno-0-146" name="__codelineno-0-146"></a> <span class="n">objs</span> <span class="o">=</span> <span class="p">[]</span>
</span><span id="__span-0-147"><a id="__codelineno-0-147" name="__codelineno-0-147"></a> <span class="n">cur</span> <span class="o">=</span> <span class="bp">self</span>
</span><span id="__span-0-148"><a id="__codelineno-0-148" name="__codelineno-0-148"></a> <span class="k">while</span> <span class="n">cur</span><span class="o">.</span><span class="n">parent</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
</span><span id="__span-0-149"><a id="__codelineno-0-149" name="__codelineno-0-149"></a> <span class="k">if</span> <span class="n">cur</span> <span class="ow">in</span> <span class="n">objs</span><span class="p">:</span>
</span><span id="__span-0-150"><a id="__codelineno-0-150" name="__codelineno-0-150"></a> <span class="k">raise</span> <span class="n">ValidationError</span><span class="p">(</span><span class="n">_</span><span class="p">(</span><span class="s2">&quot;You can not make loops in clubs&quot;</span><span class="p">))</span>
</span><span id="__span-0-151"><a id="__codelineno-0-151" name="__codelineno-0-151"></a> <span class="n">objs</span><span class="o">.</span><span class="n">append</span><span class="p">(</span><span class="n">cur</span><span class="p">)</span>
</span><span id="__span-0-152"><a id="__codelineno-0-152" name="__codelineno-0-152"></a> <span class="n">cur</span> <span class="o">=</span> <span class="n">cur</span><span class="o">.</span><span class="n">parent</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.Club.is_owned_by" class="doc doc-heading">
<code class="highlight language-python"><span class="n">is_owned_by</span><span class="p">(</span><span class="n">user</span><span class="p">)</span></code>
<a href="#core.views.Club.is_owned_by" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Method to see if that object can be super edited by the given user.</p>
<details class="quote">
<summary>Source code in <code>club/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-226">226</a></span>
<span class="normal"><a href="#__codelineno-0-227">227</a></span>
<span class="normal"><a href="#__codelineno-0-228">228</a></span>
<span class="normal"><a href="#__codelineno-0-229">229</a></span>
<span class="normal"><a href="#__codelineno-0-230">230</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-226"><a id="__codelineno-0-226" name="__codelineno-0-226"></a><span class="k">def</span> <span class="nf">is_owned_by</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">user</span><span class="p">):</span>
</span><span id="__span-0-227"><a id="__codelineno-0-227" name="__codelineno-0-227"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Method to see if that object can be super edited by the given user.&quot;&quot;&quot;</span>
</span><span id="__span-0-228"><a id="__codelineno-0-228" name="__codelineno-0-228"></a> <span class="k">if</span> <span class="n">user</span><span class="o">.</span><span class="n">is_anonymous</span><span class="p">:</span>
</span><span id="__span-0-229"><a id="__codelineno-0-229" name="__codelineno-0-229"></a> <span class="k">return</span> <span class="kc">False</span>
</span><span id="__span-0-230"><a id="__codelineno-0-230" name="__codelineno-0-230"></a> <span class="k">return</span> <span class="n">user</span><span class="o">.</span><span class="n">is_board_member</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.Club.can_be_edited_by" class="doc doc-heading">
<code class="highlight language-python"><span class="n">can_be_edited_by</span><span class="p">(</span><span class="n">user</span><span class="p">)</span></code>
<a href="#core.views.Club.can_be_edited_by" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Method to see if that object can be edited by the given user.</p>
<details class="quote">
<summary>Source code in <code>club/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-235">235</a></span>
<span class="normal"><a href="#__codelineno-0-236">236</a></span>
<span class="normal"><a href="#__codelineno-0-237">237</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-235"><a id="__codelineno-0-235" name="__codelineno-0-235"></a><span class="k">def</span> <span class="nf">can_be_edited_by</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">user</span><span class="p">):</span>
</span><span id="__span-0-236"><a id="__codelineno-0-236" name="__codelineno-0-236"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Method to see if that object can be edited by the given user.&quot;&quot;&quot;</span>
</span><span id="__span-0-237"><a id="__codelineno-0-237" name="__codelineno-0-237"></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">has_rights_in_club</span><span class="p">(</span><span class="n">user</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.Club.can_be_viewed_by" class="doc doc-heading">
<code class="highlight language-python"><span class="n">can_be_viewed_by</span><span class="p">(</span><span class="n">user</span><span class="p">)</span></code>
<a href="#core.views.Club.can_be_viewed_by" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Method to see if that object can be seen by the given user.</p>
<details class="quote">
<summary>Source code in <code>club/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-239">239</a></span>
<span class="normal"><a href="#__codelineno-0-240">240</a></span>
<span class="normal"><a href="#__codelineno-0-241">241</a></span>
<span class="normal"><a href="#__codelineno-0-242">242</a></span>
<span class="normal"><a href="#__codelineno-0-243">243</a></span>
<span class="normal"><a href="#__codelineno-0-244">244</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-239"><a id="__codelineno-0-239" name="__codelineno-0-239"></a><span class="k">def</span> <span class="nf">can_be_viewed_by</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">user</span><span class="p">):</span>
</span><span id="__span-0-240"><a id="__codelineno-0-240" name="__codelineno-0-240"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Method to see if that object can be seen by the given user.&quot;&quot;&quot;</span>
</span><span id="__span-0-241"><a id="__codelineno-0-241" name="__codelineno-0-241"></a> <span class="n">sub</span> <span class="o">=</span> <span class="n">User</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">pk</span><span class="o">=</span><span class="n">user</span><span class="o">.</span><span class="n">pk</span><span class="p">)</span><span class="o">.</span><span class="n">first</span><span class="p">()</span>
</span><span id="__span-0-242"><a id="__codelineno-0-242" name="__codelineno-0-242"></a> <span class="k">if</span> <span class="n">sub</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
</span><span id="__span-0-243"><a id="__codelineno-0-243" name="__codelineno-0-243"></a> <span class="k">return</span> <span class="kc">False</span>
</span><span id="__span-0-244"><a id="__codelineno-0-244" name="__codelineno-0-244"></a> <span class="k">return</span> <span class="n">sub</span><span class="o">.</span><span class="n">was_subscribed</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.Club.get_membership_for" class="doc doc-heading">
<code class="highlight language-python"><span class="n">get_membership_for</span><span class="p">(</span><span class="n">user</span><span class="p">)</span></code>
<a href="#core.views.Club.get_membership_for" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Return the current membership the given user.</p>
<details class="note" open>
<summary>Note</summary>
<p>The result is cached.</p>
</details>
<details class="quote">
<summary>Source code in <code>club/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-246">246</a></span>
<span class="normal"><a href="#__codelineno-0-247">247</a></span>
<span class="normal"><a href="#__codelineno-0-248">248</a></span>
<span class="normal"><a href="#__codelineno-0-249">249</a></span>
<span class="normal"><a href="#__codelineno-0-250">250</a></span>
<span class="normal"><a href="#__codelineno-0-251">251</a></span>
<span class="normal"><a href="#__codelineno-0-252">252</a></span>
<span class="normal"><a href="#__codelineno-0-253">253</a></span>
<span class="normal"><a href="#__codelineno-0-254">254</a></span>
<span class="normal"><a href="#__codelineno-0-255">255</a></span>
<span class="normal"><a href="#__codelineno-0-256">256</a></span>
<span class="normal"><a href="#__codelineno-0-257">257</a></span>
<span class="normal"><a href="#__codelineno-0-258">258</a></span>
<span class="normal"><a href="#__codelineno-0-259">259</a></span>
<span class="normal"><a href="#__codelineno-0-260">260</a></span>
<span class="normal"><a href="#__codelineno-0-261">261</a></span>
<span class="normal"><a href="#__codelineno-0-262">262</a></span>
<span class="normal"><a href="#__codelineno-0-263">263</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-246"><a id="__codelineno-0-246" name="__codelineno-0-246"></a><span class="k">def</span> <span class="nf">get_membership_for</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">user</span><span class="p">:</span> <span class="n">User</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">Membership</span> <span class="o">|</span> <span class="kc">None</span><span class="p">:</span>
</span><span id="__span-0-247"><a id="__codelineno-0-247" name="__codelineno-0-247"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Return the current membership the given user.</span>
</span><span id="__span-0-248"><a id="__codelineno-0-248" name="__codelineno-0-248"></a>
</span><span id="__span-0-249"><a id="__codelineno-0-249" name="__codelineno-0-249"></a><span class="sd"> Note:</span>
</span><span id="__span-0-250"><a id="__codelineno-0-250" name="__codelineno-0-250"></a><span class="sd"> The result is cached.</span>
</span><span id="__span-0-251"><a id="__codelineno-0-251" name="__codelineno-0-251"></a><span class="sd"> &quot;&quot;&quot;</span>
</span><span id="__span-0-252"><a id="__codelineno-0-252" name="__codelineno-0-252"></a> <span class="k">if</span> <span class="n">user</span><span class="o">.</span><span class="n">is_anonymous</span><span class="p">:</span>
</span><span id="__span-0-253"><a id="__codelineno-0-253" name="__codelineno-0-253"></a> <span class="k">return</span> <span class="kc">None</span>
</span><span id="__span-0-254"><a id="__codelineno-0-254" name="__codelineno-0-254"></a> <span class="n">membership</span> <span class="o">=</span> <span class="n">cache</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;membership_</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">id</span><span class="si">}</span><span class="s2">_</span><span class="si">{</span><span class="n">user</span><span class="o">.</span><span class="n">id</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">)</span>
</span><span id="__span-0-255"><a id="__codelineno-0-255" name="__codelineno-0-255"></a> <span class="k">if</span> <span class="n">membership</span> <span class="o">==</span> <span class="s2">&quot;not_member&quot;</span><span class="p">:</span>
</span><span id="__span-0-256"><a id="__codelineno-0-256" name="__codelineno-0-256"></a> <span class="k">return</span> <span class="kc">None</span>
</span><span id="__span-0-257"><a id="__codelineno-0-257" name="__codelineno-0-257"></a> <span class="k">if</span> <span class="n">membership</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
</span><span id="__span-0-258"><a id="__codelineno-0-258" name="__codelineno-0-258"></a> <span class="n">membership</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">members</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">user</span><span class="o">=</span><span class="n">user</span><span class="p">,</span> <span class="n">end_date</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span><span class="o">.</span><span class="n">first</span><span class="p">()</span>
</span><span id="__span-0-259"><a id="__codelineno-0-259" name="__codelineno-0-259"></a> <span class="k">if</span> <span class="n">membership</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
</span><span id="__span-0-260"><a id="__codelineno-0-260" name="__codelineno-0-260"></a> <span class="n">cache</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;membership_</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">id</span><span class="si">}</span><span class="s2">_</span><span class="si">{</span><span class="n">user</span><span class="o">.</span><span class="n">id</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span> <span class="s2">&quot;not_member&quot;</span><span class="p">)</span>
</span><span id="__span-0-261"><a id="__codelineno-0-261" name="__codelineno-0-261"></a> <span class="k">else</span><span class="p">:</span>
</span><span id="__span-0-262"><a id="__codelineno-0-262" name="__codelineno-0-262"></a> <span class="n">cache</span><span class="o">.</span><span class="n">set</span><span class="p">(</span><span class="sa">f</span><span class="s2">&quot;membership_</span><span class="si">{</span><span class="bp">self</span><span class="o">.</span><span class="n">id</span><span class="si">}</span><span class="s2">_</span><span class="si">{</span><span class="n">user</span><span class="o">.</span><span class="n">id</span><span class="si">}</span><span class="s2">&quot;</span><span class="p">,</span> <span class="n">membership</span><span class="p">)</span>
</span><span id="__span-0-263"><a id="__codelineno-0-263" name="__codelineno-0-263"></a> <span class="k">return</span> <span class="n">membership</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.NotificationList" class="doc doc-heading">
<code>NotificationList</code>
<a href="#core.views.NotificationList" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.views.generic.ListView">ListView</span></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.User" class="doc doc-heading">
<code>User</code>
<a href="#core.views.User" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.contrib.auth.models.AbstractUser">AbstractUser</span></code></p>
<p>Defines the base user class, useable in every app.</p>
<p>This is almost the same as the auth module AbstractUser since it inherits from it,
but some fields are required, and the username is generated automatically with the
name of the user (see generate_username()).</p>
<p>Added field: nick_name, date_of_birth
Required fields: email, first_name, last_name, date_of_birth</p>
<div class="doc doc-children">
<div class="doc doc-object doc-attribute">
<h3 id="core.views.User.cached_groups" class="doc doc-heading">
<code class="highlight language-python"><span class="n">cached_groups</span><span class="p">:</span> <span class="nb">list</span><span class="p">[</span><span class="n">Group</span><span class="p">]</span></code>
<span class="doc doc-labels">
<small class="doc doc-label doc-label-property"><code>property</code></small>
</span>
<a href="#core.views.User.cached_groups" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Get the list of groups this user is in.</p>
<p>The result is cached for the default duration (should be 5 minutes)</p>
<p>Returns: A list of all the groups this user is in.</p>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.User.is_in_group" class="doc doc-heading">
<code class="highlight language-python"><span class="n">is_in_group</span><span class="p">(</span><span class="o">*</span><span class="p">,</span> <span class="n">pk</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="n">name</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span></code>
<a href="#core.views.User.is_in_group" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Check if this user is in the given group.
Either a group id or a group name must be provided.
If both are passed, only the id will be considered.</p>
<p>The group will be fetched using the given parameter.
If no group is found, return False.
If a group is found, check if this user is in the latter.</p>
<p><span class="doc-section-title">Returns:</span></p>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code>bool</code>
</td>
<td>
<div class="doc-md-description">
<p>True if the user is the group, else False</p>
</div>
</td>
</tr>
</tbody>
</table>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-413">413</a></span>
<span class="normal"><a href="#__codelineno-0-414">414</a></span>
<span class="normal"><a href="#__codelineno-0-415">415</a></span>
<span class="normal"><a href="#__codelineno-0-416">416</a></span>
<span class="normal"><a href="#__codelineno-0-417">417</a></span>
<span class="normal"><a href="#__codelineno-0-418">418</a></span>
<span class="normal"><a href="#__codelineno-0-419">419</a></span>
<span class="normal"><a href="#__codelineno-0-420">420</a></span>
<span class="normal"><a href="#__codelineno-0-421">421</a></span>
<span class="normal"><a href="#__codelineno-0-422">422</a></span>
<span class="normal"><a href="#__codelineno-0-423">423</a></span>
<span class="normal"><a href="#__codelineno-0-424">424</a></span>
<span class="normal"><a href="#__codelineno-0-425">425</a></span>
<span class="normal"><a href="#__codelineno-0-426">426</a></span>
<span class="normal"><a href="#__codelineno-0-427">427</a></span>
<span class="normal"><a href="#__codelineno-0-428">428</a></span>
<span class="normal"><a href="#__codelineno-0-429">429</a></span>
<span class="normal"><a href="#__codelineno-0-430">430</a></span>
<span class="normal"><a href="#__codelineno-0-431">431</a></span>
<span class="normal"><a href="#__codelineno-0-432">432</a></span>
<span class="normal"><a href="#__codelineno-0-433">433</a></span>
<span class="normal"><a href="#__codelineno-0-434">434</a></span>
<span class="normal"><a href="#__codelineno-0-435">435</a></span>
<span class="normal"><a href="#__codelineno-0-436">436</a></span>
<span class="normal"><a href="#__codelineno-0-437">437</a></span>
<span class="normal"><a href="#__codelineno-0-438">438</a></span>
<span class="normal"><a href="#__codelineno-0-439">439</a></span>
<span class="normal"><a href="#__codelineno-0-440">440</a></span>
<span class="normal"><a href="#__codelineno-0-441">441</a></span>
<span class="normal"><a href="#__codelineno-0-442">442</a></span>
<span class="normal"><a href="#__codelineno-0-443">443</a></span>
<span class="normal"><a href="#__codelineno-0-444">444</a></span>
<span class="normal"><a href="#__codelineno-0-445">445</a></span>
<span class="normal"><a href="#__codelineno-0-446">446</a></span>
<span class="normal"><a href="#__codelineno-0-447">447</a></span>
<span class="normal"><a href="#__codelineno-0-448">448</a></span>
<span class="normal"><a href="#__codelineno-0-449">449</a></span>
<span class="normal"><a href="#__codelineno-0-450">450</a></span>
<span class="normal"><a href="#__codelineno-0-451">451</a></span>
<span class="normal"><a href="#__codelineno-0-452">452</a></span>
<span class="normal"><a href="#__codelineno-0-453">453</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-413"><a id="__codelineno-0-413" name="__codelineno-0-413"></a><span class="k">def</span> <span class="nf">is_in_group</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="o">*</span><span class="p">,</span> <span class="n">pk</span><span class="p">:</span> <span class="nb">int</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">,</span> <span class="n">name</span><span class="p">:</span> <span class="nb">str</span> <span class="o">|</span> <span class="kc">None</span> <span class="o">=</span> <span class="kc">None</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span>
</span><span id="__span-0-414"><a id="__codelineno-0-414" name="__codelineno-0-414"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Check if this user is in the given group.</span>
</span><span id="__span-0-415"><a id="__codelineno-0-415" name="__codelineno-0-415"></a><span class="sd"> Either a group id or a group name must be provided.</span>
</span><span id="__span-0-416"><a id="__codelineno-0-416" name="__codelineno-0-416"></a><span class="sd"> If both are passed, only the id will be considered.</span>
</span><span id="__span-0-417"><a id="__codelineno-0-417" name="__codelineno-0-417"></a>
</span><span id="__span-0-418"><a id="__codelineno-0-418" name="__codelineno-0-418"></a><span class="sd"> The group will be fetched using the given parameter.</span>
</span><span id="__span-0-419"><a id="__codelineno-0-419" name="__codelineno-0-419"></a><span class="sd"> If no group is found, return False.</span>
</span><span id="__span-0-420"><a id="__codelineno-0-420" name="__codelineno-0-420"></a><span class="sd"> If a group is found, check if this user is in the latter.</span>
</span><span id="__span-0-421"><a id="__codelineno-0-421" name="__codelineno-0-421"></a>
</span><span id="__span-0-422"><a id="__codelineno-0-422" name="__codelineno-0-422"></a><span class="sd"> Returns:</span>
</span><span id="__span-0-423"><a id="__codelineno-0-423" name="__codelineno-0-423"></a><span class="sd"> True if the user is the group, else False</span>
</span><span id="__span-0-424"><a id="__codelineno-0-424" name="__codelineno-0-424"></a><span class="sd"> &quot;&quot;&quot;</span>
</span><span id="__span-0-425"><a id="__codelineno-0-425" name="__codelineno-0-425"></a> <span class="k">if</span> <span class="n">pk</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
</span><span id="__span-0-426"><a id="__codelineno-0-426" name="__codelineno-0-426"></a> <span class="n">group</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Group</span><span class="p">]</span> <span class="o">=</span> <span class="n">get_group</span><span class="p">(</span><span class="n">pk</span><span class="o">=</span><span class="n">pk</span><span class="p">)</span>
</span><span id="__span-0-427"><a id="__codelineno-0-427" name="__codelineno-0-427"></a> <span class="k">elif</span> <span class="n">name</span> <span class="ow">is</span> <span class="ow">not</span> <span class="kc">None</span><span class="p">:</span>
</span><span id="__span-0-428"><a id="__codelineno-0-428" name="__codelineno-0-428"></a> <span class="n">group</span><span class="p">:</span> <span class="n">Optional</span><span class="p">[</span><span class="n">Group</span><span class="p">]</span> <span class="o">=</span> <span class="n">get_group</span><span class="p">(</span><span class="n">name</span><span class="o">=</span><span class="n">name</span><span class="p">)</span>
</span><span id="__span-0-429"><a id="__codelineno-0-429" name="__codelineno-0-429"></a> <span class="k">else</span><span class="p">:</span>
</span><span id="__span-0-430"><a id="__codelineno-0-430" name="__codelineno-0-430"></a> <span class="k">raise</span> <span class="ne">ValueError</span><span class="p">(</span><span class="s2">&quot;You must either provide the id or the name of the group&quot;</span><span class="p">)</span>
</span><span id="__span-0-431"><a id="__codelineno-0-431" name="__codelineno-0-431"></a> <span class="k">if</span> <span class="n">group</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
</span><span id="__span-0-432"><a id="__codelineno-0-432" name="__codelineno-0-432"></a> <span class="k">return</span> <span class="kc">False</span>
</span><span id="__span-0-433"><a id="__codelineno-0-433" name="__codelineno-0-433"></a> <span class="k">if</span> <span class="n">group</span><span class="o">.</span><span class="n">id</span> <span class="o">==</span> <span class="n">settings</span><span class="o">.</span><span class="n">SITH_GROUP_PUBLIC_ID</span><span class="p">:</span>
</span><span id="__span-0-434"><a id="__codelineno-0-434" name="__codelineno-0-434"></a> <span class="k">return</span> <span class="kc">True</span>
</span><span id="__span-0-435"><a id="__codelineno-0-435" name="__codelineno-0-435"></a> <span class="k">if</span> <span class="n">group</span><span class="o">.</span><span class="n">id</span> <span class="o">==</span> <span class="n">settings</span><span class="o">.</span><span class="n">SITH_GROUP_SUBSCRIBERS_ID</span><span class="p">:</span>
</span><span id="__span-0-436"><a id="__codelineno-0-436" name="__codelineno-0-436"></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_subscribed</span>
</span><span id="__span-0-437"><a id="__codelineno-0-437" name="__codelineno-0-437"></a> <span class="k">if</span> <span class="n">group</span><span class="o">.</span><span class="n">id</span> <span class="o">==</span> <span class="n">settings</span><span class="o">.</span><span class="n">SITH_GROUP_OLD_SUBSCRIBERS_ID</span><span class="p">:</span>
</span><span id="__span-0-438"><a id="__codelineno-0-438" name="__codelineno-0-438"></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">was_subscribed</span>
</span><span id="__span-0-439"><a id="__codelineno-0-439" name="__codelineno-0-439"></a> <span class="k">if</span> <span class="n">group</span><span class="o">.</span><span class="n">id</span> <span class="o">==</span> <span class="n">settings</span><span class="o">.</span><span class="n">SITH_GROUP_ROOT_ID</span><span class="p">:</span>
</span><span id="__span-0-440"><a id="__codelineno-0-440" name="__codelineno-0-440"></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_root</span>
</span><span id="__span-0-441"><a id="__codelineno-0-441" name="__codelineno-0-441"></a> <span class="k">if</span> <span class="n">group</span><span class="o">.</span><span class="n">is_meta</span><span class="p">:</span>
</span><span id="__span-0-442"><a id="__codelineno-0-442" name="__codelineno-0-442"></a> <span class="c1"># check if this group is associated with a club</span>
</span><span id="__span-0-443"><a id="__codelineno-0-443" name="__codelineno-0-443"></a> <span class="n">group</span><span class="o">.</span><span class="vm">__class__</span> <span class="o">=</span> <span class="n">MetaGroup</span>
</span><span id="__span-0-444"><a id="__codelineno-0-444" name="__codelineno-0-444"></a> <span class="n">club</span> <span class="o">=</span> <span class="n">group</span><span class="o">.</span><span class="n">associated_club</span>
</span><span id="__span-0-445"><a id="__codelineno-0-445" name="__codelineno-0-445"></a> <span class="k">if</span> <span class="n">club</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
</span><span id="__span-0-446"><a id="__codelineno-0-446" name="__codelineno-0-446"></a> <span class="k">return</span> <span class="kc">False</span>
</span><span id="__span-0-447"><a id="__codelineno-0-447" name="__codelineno-0-447"></a> <span class="n">membership</span> <span class="o">=</span> <span class="n">club</span><span class="o">.</span><span class="n">get_membership_for</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span>
</span><span id="__span-0-448"><a id="__codelineno-0-448" name="__codelineno-0-448"></a> <span class="k">if</span> <span class="n">membership</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
</span><span id="__span-0-449"><a id="__codelineno-0-449" name="__codelineno-0-449"></a> <span class="k">return</span> <span class="kc">False</span>
</span><span id="__span-0-450"><a id="__codelineno-0-450" name="__codelineno-0-450"></a> <span class="k">if</span> <span class="n">group</span><span class="o">.</span><span class="n">name</span><span class="o">.</span><span class="n">endswith</span><span class="p">(</span><span class="n">settings</span><span class="o">.</span><span class="n">SITH_MEMBER_SUFFIX</span><span class="p">):</span>
</span><span id="__span-0-451"><a id="__codelineno-0-451" name="__codelineno-0-451"></a> <span class="k">return</span> <span class="kc">True</span>
</span><span id="__span-0-452"><a id="__codelineno-0-452" name="__codelineno-0-452"></a> <span class="k">return</span> <span class="n">membership</span><span class="o">.</span><span class="n">role</span> <span class="o">&gt;</span> <span class="n">settings</span><span class="o">.</span><span class="n">SITH_MAXIMUM_FREE_ROLE</span>
</span><span id="__span-0-453"><a id="__codelineno-0-453" name="__codelineno-0-453"></a> <span class="k">return</span> <span class="n">group</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">cached_groups</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.User.age" class="doc doc-heading">
<code class="highlight language-python"><span class="n">age</span><span class="p">()</span></code>
<a href="#core.views.User.age" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Return the age this user has the day the method is called.
If the user has not filled his age, return 0.</p>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-524">524</a></span>
<span class="normal"><a href="#__codelineno-0-525">525</a></span>
<span class="normal"><a href="#__codelineno-0-526">526</a></span>
<span class="normal"><a href="#__codelineno-0-527">527</a></span>
<span class="normal"><a href="#__codelineno-0-528">528</a></span>
<span class="normal"><a href="#__codelineno-0-529">529</a></span>
<span class="normal"><a href="#__codelineno-0-530">530</a></span>
<span class="normal"><a href="#__codelineno-0-531">531</a></span>
<span class="normal"><a href="#__codelineno-0-532">532</a></span>
<span class="normal"><a href="#__codelineno-0-533">533</a></span>
<span class="normal"><a href="#__codelineno-0-534">534</a></span>
<span class="normal"><a href="#__codelineno-0-535">535</a></span>
<span class="normal"><a href="#__codelineno-0-536">536</a></span>
<span class="normal"><a href="#__codelineno-0-537">537</a></span>
<span class="normal"><a href="#__codelineno-0-538">538</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-524"><a id="__codelineno-0-524" name="__codelineno-0-524"></a><span class="nd">@cached_property</span>
</span><span id="__span-0-525"><a id="__codelineno-0-525" name="__codelineno-0-525"></a><span class="k">def</span> <span class="nf">age</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">int</span><span class="p">:</span>
</span><span id="__span-0-526"><a id="__codelineno-0-526" name="__codelineno-0-526"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Return the age this user has the day the method is called.</span>
</span><span id="__span-0-527"><a id="__codelineno-0-527" name="__codelineno-0-527"></a><span class="sd"> If the user has not filled his age, return 0.</span>
</span><span id="__span-0-528"><a id="__codelineno-0-528" name="__codelineno-0-528"></a><span class="sd"> &quot;&quot;&quot;</span>
</span><span id="__span-0-529"><a id="__codelineno-0-529" name="__codelineno-0-529"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">date_of_birth</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
</span><span id="__span-0-530"><a id="__codelineno-0-530" name="__codelineno-0-530"></a> <span class="k">return</span> <span class="mi">0</span>
</span><span id="__span-0-531"><a id="__codelineno-0-531" name="__codelineno-0-531"></a> <span class="n">today</span> <span class="o">=</span> <span class="n">timezone</span><span class="o">.</span><span class="n">now</span><span class="p">()</span>
</span><span id="__span-0-532"><a id="__codelineno-0-532" name="__codelineno-0-532"></a> <span class="n">age</span> <span class="o">=</span> <span class="n">today</span><span class="o">.</span><span class="n">year</span> <span class="o">-</span> <span class="bp">self</span><span class="o">.</span><span class="n">date_of_birth</span><span class="o">.</span><span class="n">year</span>
</span><span id="__span-0-533"><a id="__codelineno-0-533" name="__codelineno-0-533"></a> <span class="c1"># remove a year if this year&#39;s birthday is yet to come</span>
</span><span id="__span-0-534"><a id="__codelineno-0-534" name="__codelineno-0-534"></a> <span class="n">age</span> <span class="o">-=</span> <span class="p">(</span><span class="n">today</span><span class="o">.</span><span class="n">month</span><span class="p">,</span> <span class="n">today</span><span class="o">.</span><span class="n">day</span><span class="p">)</span> <span class="o">&lt;</span> <span class="p">(</span>
</span><span id="__span-0-535"><a id="__codelineno-0-535" name="__codelineno-0-535"></a> <span class="bp">self</span><span class="o">.</span><span class="n">date_of_birth</span><span class="o">.</span><span class="n">month</span><span class="p">,</span>
</span><span id="__span-0-536"><a id="__codelineno-0-536" name="__codelineno-0-536"></a> <span class="bp">self</span><span class="o">.</span><span class="n">date_of_birth</span><span class="o">.</span><span class="n">day</span><span class="p">,</span>
</span><span id="__span-0-537"><a id="__codelineno-0-537" name="__codelineno-0-537"></a> <span class="p">)</span>
</span><span id="__span-0-538"><a id="__codelineno-0-538" name="__codelineno-0-538"></a> <span class="k">return</span> <span class="n">age</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.User.get_short_name" class="doc doc-heading">
<code class="highlight language-python"><span class="n">get_short_name</span><span class="p">()</span></code>
<a href="#core.views.User.get_short_name" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Returns the short name for the user.</p>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-566">566</a></span>
<span class="normal"><a href="#__codelineno-0-567">567</a></span>
<span class="normal"><a href="#__codelineno-0-568">568</a></span>
<span class="normal"><a href="#__codelineno-0-569">569</a></span>
<span class="normal"><a href="#__codelineno-0-570">570</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-566"><a id="__codelineno-0-566" name="__codelineno-0-566"></a><span class="k">def</span> <span class="nf">get_short_name</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
</span><span id="__span-0-567"><a id="__codelineno-0-567" name="__codelineno-0-567"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Returns the short name for the user.&quot;&quot;&quot;</span>
</span><span id="__span-0-568"><a id="__codelineno-0-568" name="__codelineno-0-568"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">nick_name</span><span class="p">:</span>
</span><span id="__span-0-569"><a id="__codelineno-0-569" name="__codelineno-0-569"></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">nick_name</span>
</span><span id="__span-0-570"><a id="__codelineno-0-570" name="__codelineno-0-570"></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">first_name</span> <span class="o">+</span> <span class="s2">&quot; &quot;</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">last_name</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.User.get_display_name" class="doc doc-heading">
<code class="highlight language-python"><span class="n">get_display_name</span><span class="p">()</span></code>
<a href="#core.views.User.get_display_name" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Returns the display name of the user.</p>
<p>A nickname if possible, otherwise, the full name.</p>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-572">572</a></span>
<span class="normal"><a href="#__codelineno-0-573">573</a></span>
<span class="normal"><a href="#__codelineno-0-574">574</a></span>
<span class="normal"><a href="#__codelineno-0-575">575</a></span>
<span class="normal"><a href="#__codelineno-0-576">576</a></span>
<span class="normal"><a href="#__codelineno-0-577">577</a></span>
<span class="normal"><a href="#__codelineno-0-578">578</a></span>
<span class="normal"><a href="#__codelineno-0-579">579</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-572"><a id="__codelineno-0-572" name="__codelineno-0-572"></a><span class="k">def</span> <span class="nf">get_display_name</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
</span><span id="__span-0-573"><a id="__codelineno-0-573" name="__codelineno-0-573"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Returns the display name of the user.</span>
</span><span id="__span-0-574"><a id="__codelineno-0-574" name="__codelineno-0-574"></a>
</span><span id="__span-0-575"><a id="__codelineno-0-575" name="__codelineno-0-575"></a><span class="sd"> A nickname if possible, otherwise, the full name.</span>
</span><span id="__span-0-576"><a id="__codelineno-0-576" name="__codelineno-0-576"></a><span class="sd"> &quot;&quot;&quot;</span>
</span><span id="__span-0-577"><a id="__codelineno-0-577" name="__codelineno-0-577"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">nick_name</span><span class="p">:</span>
</span><span id="__span-0-578"><a id="__codelineno-0-578" name="__codelineno-0-578"></a> <span class="k">return</span> <span class="s2">&quot;</span><span class="si">%s</span><span class="s2"> (</span><span class="si">%s</span><span class="s2">)&quot;</span> <span class="o">%</span> <span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">get_full_name</span><span class="p">(),</span> <span class="bp">self</span><span class="o">.</span><span class="n">nick_name</span><span class="p">)</span>
</span><span id="__span-0-579"><a id="__codelineno-0-579" name="__codelineno-0-579"></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">get_full_name</span><span class="p">()</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.User.get_age" class="doc doc-heading">
<code class="highlight language-python"><span class="n">get_age</span><span class="p">()</span></code>
<a href="#core.views.User.get_age" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Returns the age.</p>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-581">581</a></span>
<span class="normal"><a href="#__codelineno-0-582">582</a></span>
<span class="normal"><a href="#__codelineno-0-583">583</a></span>
<span class="normal"><a href="#__codelineno-0-584">584</a></span>
<span class="normal"><a href="#__codelineno-0-585">585</a></span>
<span class="normal"><a href="#__codelineno-0-586">586</a></span>
<span class="normal"><a href="#__codelineno-0-587">587</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-581"><a id="__codelineno-0-581" name="__codelineno-0-581"></a><span class="k">def</span> <span class="nf">get_age</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
</span><span id="__span-0-582"><a id="__codelineno-0-582" name="__codelineno-0-582"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Returns the age.&quot;&quot;&quot;</span>
</span><span id="__span-0-583"><a id="__codelineno-0-583" name="__codelineno-0-583"></a> <span class="n">today</span> <span class="o">=</span> <span class="n">timezone</span><span class="o">.</span><span class="n">now</span><span class="p">()</span>
</span><span id="__span-0-584"><a id="__codelineno-0-584" name="__codelineno-0-584"></a> <span class="n">born</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">date_of_birth</span>
</span><span id="__span-0-585"><a id="__codelineno-0-585" name="__codelineno-0-585"></a> <span class="k">return</span> <span class="p">(</span>
</span><span id="__span-0-586"><a id="__codelineno-0-586" name="__codelineno-0-586"></a> <span class="n">today</span><span class="o">.</span><span class="n">year</span> <span class="o">-</span> <span class="n">born</span><span class="o">.</span><span class="n">year</span> <span class="o">-</span> <span class="p">((</span><span class="n">today</span><span class="o">.</span><span class="n">month</span><span class="p">,</span> <span class="n">today</span><span class="o">.</span><span class="n">day</span><span class="p">)</span> <span class="o">&lt;</span> <span class="p">(</span><span class="n">born</span><span class="o">.</span><span class="n">month</span><span class="p">,</span> <span class="n">born</span><span class="o">.</span><span class="n">day</span><span class="p">))</span>
</span><span id="__span-0-587"><a id="__codelineno-0-587" name="__codelineno-0-587"></a> <span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.User.get_family" class="doc doc-heading">
<code class="highlight language-python"><span class="n">get_family</span><span class="p">(</span><span class="n">godfathers_depth</span><span class="o">=</span><span class="mi">4</span><span class="p">,</span> <span class="n">godchildren_depth</span><span class="o">=</span><span class="mi">4</span><span class="p">)</span></code>
<a href="#core.views.User.get_family" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Get the family of the user, with the given depth.</p>
<p><span class="doc-section-title">Parameters:</span></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code>godfathers_depth</code>
</td>
<td>
<code><span title="pydantic.NonNegativeInt">NonNegativeInt</span></code>
</td>
<td>
<div class="doc-md-description">
<p>The number of generations of godfathers to fetch</p>
</div>
</td>
<td>
<code>4</code>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>godchildren_depth</code>
</td>
<td>
<code><span title="pydantic.NonNegativeInt">NonNegativeInt</span></code>
</td>
<td>
<div class="doc-md-description">
<p>The number of generations of godchildren to fetch</p>
</div>
</td>
<td>
<code>4</code>
</td>
</tr>
</tbody>
</table>
<p><span class="doc-section-title">Returns:</span></p>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code>set[<span title="core.models.User.godfathers.through">through</span>]</code>
</td>
<td>
<div class="doc-md-description">
<p>A list of family relationships in this user's family</p>
</div>
</td>
</tr>
</tbody>
</table>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-589">589</a></span>
<span class="normal"><a href="#__codelineno-0-590">590</a></span>
<span class="normal"><a href="#__codelineno-0-591">591</a></span>
<span class="normal"><a href="#__codelineno-0-592">592</a></span>
<span class="normal"><a href="#__codelineno-0-593">593</a></span>
<span class="normal"><a href="#__codelineno-0-594">594</a></span>
<span class="normal"><a href="#__codelineno-0-595">595</a></span>
<span class="normal"><a href="#__codelineno-0-596">596</a></span>
<span class="normal"><a href="#__codelineno-0-597">597</a></span>
<span class="normal"><a href="#__codelineno-0-598">598</a></span>
<span class="normal"><a href="#__codelineno-0-599">599</a></span>
<span class="normal"><a href="#__codelineno-0-600">600</a></span>
<span class="normal"><a href="#__codelineno-0-601">601</a></span>
<span class="normal"><a href="#__codelineno-0-602">602</a></span>
<span class="normal"><a href="#__codelineno-0-603">603</a></span>
<span class="normal"><a href="#__codelineno-0-604">604</a></span>
<span class="normal"><a href="#__codelineno-0-605">605</a></span>
<span class="normal"><a href="#__codelineno-0-606">606</a></span>
<span class="normal"><a href="#__codelineno-0-607">607</a></span>
<span class="normal"><a href="#__codelineno-0-608">608</a></span>
<span class="normal"><a href="#__codelineno-0-609">609</a></span>
<span class="normal"><a href="#__codelineno-0-610">610</a></span>
<span class="normal"><a href="#__codelineno-0-611">611</a></span>
<span class="normal"><a href="#__codelineno-0-612">612</a></span>
<span class="normal"><a href="#__codelineno-0-613">613</a></span>
<span class="normal"><a href="#__codelineno-0-614">614</a></span>
<span class="normal"><a href="#__codelineno-0-615">615</a></span>
<span class="normal"><a href="#__codelineno-0-616">616</a></span>
<span class="normal"><a href="#__codelineno-0-617">617</a></span>
<span class="normal"><a href="#__codelineno-0-618">618</a></span>
<span class="normal"><a href="#__codelineno-0-619">619</a></span>
<span class="normal"><a href="#__codelineno-0-620">620</a></span>
<span class="normal"><a href="#__codelineno-0-621">621</a></span>
<span class="normal"><a href="#__codelineno-0-622">622</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-589"><a id="__codelineno-0-589" name="__codelineno-0-589"></a><span class="k">def</span> <span class="nf">get_family</span><span class="p">(</span>
</span><span id="__span-0-590"><a id="__codelineno-0-590" name="__codelineno-0-590"></a> <span class="bp">self</span><span class="p">,</span>
</span><span id="__span-0-591"><a id="__codelineno-0-591" name="__codelineno-0-591"></a> <span class="n">godfathers_depth</span><span class="p">:</span> <span class="n">NonNegativeInt</span> <span class="o">=</span> <span class="mi">4</span><span class="p">,</span>
</span><span id="__span-0-592"><a id="__codelineno-0-592" name="__codelineno-0-592"></a> <span class="n">godchildren_depth</span><span class="p">:</span> <span class="n">NonNegativeInt</span> <span class="o">=</span> <span class="mi">4</span><span class="p">,</span>
</span><span id="__span-0-593"><a id="__codelineno-0-593" name="__codelineno-0-593"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">set</span><span class="p">[</span><span class="n">User</span><span class="o">.</span><span class="n">godfathers</span><span class="o">.</span><span class="n">through</span><span class="p">]:</span>
</span><span id="__span-0-594"><a id="__codelineno-0-594" name="__codelineno-0-594"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Get the family of the user, with the given depth.</span>
</span><span id="__span-0-595"><a id="__codelineno-0-595" name="__codelineno-0-595"></a>
</span><span id="__span-0-596"><a id="__codelineno-0-596" name="__codelineno-0-596"></a><span class="sd"> Args:</span>
</span><span id="__span-0-597"><a id="__codelineno-0-597" name="__codelineno-0-597"></a><span class="sd"> godfathers_depth: The number of generations of godfathers to fetch</span>
</span><span id="__span-0-598"><a id="__codelineno-0-598" name="__codelineno-0-598"></a><span class="sd"> godchildren_depth: The number of generations of godchildren to fetch</span>
</span><span id="__span-0-599"><a id="__codelineno-0-599" name="__codelineno-0-599"></a>
</span><span id="__span-0-600"><a id="__codelineno-0-600" name="__codelineno-0-600"></a><span class="sd"> Returns:</span>
</span><span id="__span-0-601"><a id="__codelineno-0-601" name="__codelineno-0-601"></a><span class="sd"> A list of family relationships in this user&#39;s family</span>
</span><span id="__span-0-602"><a id="__codelineno-0-602" name="__codelineno-0-602"></a><span class="sd"> &quot;&quot;&quot;</span>
</span><span id="__span-0-603"><a id="__codelineno-0-603" name="__codelineno-0-603"></a> <span class="n">res</span> <span class="o">=</span> <span class="p">[]</span>
</span><span id="__span-0-604"><a id="__codelineno-0-604" name="__codelineno-0-604"></a> <span class="k">for</span> <span class="n">depth</span><span class="p">,</span> <span class="n">key</span><span class="p">,</span> <span class="n">reverse_key</span> <span class="ow">in</span> <span class="p">[</span>
</span><span id="__span-0-605"><a id="__codelineno-0-605" name="__codelineno-0-605"></a> <span class="p">(</span><span class="n">godfathers_depth</span><span class="p">,</span> <span class="s2">&quot;from_user_id&quot;</span><span class="p">,</span> <span class="s2">&quot;to_user_id&quot;</span><span class="p">),</span>
</span><span id="__span-0-606"><a id="__codelineno-0-606" name="__codelineno-0-606"></a> <span class="p">(</span><span class="n">godchildren_depth</span><span class="p">,</span> <span class="s2">&quot;to_user_id&quot;</span><span class="p">,</span> <span class="s2">&quot;from_user_id&quot;</span><span class="p">),</span>
</span><span id="__span-0-607"><a id="__codelineno-0-607" name="__codelineno-0-607"></a> <span class="p">]:</span>
</span><span id="__span-0-608"><a id="__codelineno-0-608" name="__codelineno-0-608"></a> <span class="k">if</span> <span class="n">depth</span> <span class="o">==</span> <span class="mi">0</span><span class="p">:</span>
</span><span id="__span-0-609"><a id="__codelineno-0-609" name="__codelineno-0-609"></a> <span class="k">continue</span>
</span><span id="__span-0-610"><a id="__codelineno-0-610" name="__codelineno-0-610"></a> <span class="n">links</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">User</span><span class="o">.</span><span class="n">godfathers</span><span class="o">.</span><span class="n">through</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="o">**</span><span class="p">{</span><span class="n">key</span><span class="p">:</span> <span class="bp">self</span><span class="o">.</span><span class="n">id</span><span class="p">}))</span>
</span><span id="__span-0-611"><a id="__codelineno-0-611" name="__codelineno-0-611"></a> <span class="n">res</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">links</span><span class="p">)</span>
</span><span id="__span-0-612"><a id="__codelineno-0-612" name="__codelineno-0-612"></a> <span class="k">for</span> <span class="n">_</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">1</span><span class="p">,</span> <span class="n">depth</span><span class="p">):</span> <span class="c1"># noqa: F402 we don&#39;t care about gettext here</span>
</span><span id="__span-0-613"><a id="__codelineno-0-613" name="__codelineno-0-613"></a> <span class="n">ids</span> <span class="o">=</span> <span class="p">[</span><span class="nb">getattr</span><span class="p">(</span><span class="n">c</span><span class="p">,</span> <span class="n">reverse_key</span><span class="p">)</span> <span class="k">for</span> <span class="n">c</span> <span class="ow">in</span> <span class="n">links</span><span class="p">]</span>
</span><span id="__span-0-614"><a id="__codelineno-0-614" name="__codelineno-0-614"></a> <span class="n">links</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span>
</span><span id="__span-0-615"><a id="__codelineno-0-615" name="__codelineno-0-615"></a> <span class="n">User</span><span class="o">.</span><span class="n">godfathers</span><span class="o">.</span><span class="n">through</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span>
</span><span id="__span-0-616"><a id="__codelineno-0-616" name="__codelineno-0-616"></a> <span class="o">**</span><span class="p">{</span><span class="sa">f</span><span class="s2">&quot;</span><span class="si">{</span><span class="n">key</span><span class="si">}</span><span class="s2">__in&quot;</span><span class="p">:</span> <span class="n">ids</span><span class="p">}</span>
</span><span id="__span-0-617"><a id="__codelineno-0-617" name="__codelineno-0-617"></a> <span class="p">)</span><span class="o">.</span><span class="n">exclude</span><span class="p">(</span><span class="n">id__in</span><span class="o">=</span><span class="p">[</span><span class="n">r</span><span class="o">.</span><span class="n">id</span> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">res</span><span class="p">])</span>
</span><span id="__span-0-618"><a id="__codelineno-0-618" name="__codelineno-0-618"></a> <span class="p">)</span>
</span><span id="__span-0-619"><a id="__codelineno-0-619" name="__codelineno-0-619"></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">links</span><span class="p">:</span>
</span><span id="__span-0-620"><a id="__codelineno-0-620" name="__codelineno-0-620"></a> <span class="k">break</span>
</span><span id="__span-0-621"><a id="__codelineno-0-621" name="__codelineno-0-621"></a> <span class="n">res</span><span class="o">.</span><span class="n">extend</span><span class="p">(</span><span class="n">links</span><span class="p">)</span>
</span><span id="__span-0-622"><a id="__codelineno-0-622" name="__codelineno-0-622"></a> <span class="k">return</span> <span class="nb">set</span><span class="p">(</span><span class="n">res</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.User.email_user" class="doc doc-heading">
<code class="highlight language-python"><span class="n">email_user</span><span class="p">(</span><span class="n">subject</span><span class="p">,</span> <span class="n">message</span><span class="p">,</span> <span class="n">from_email</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span></code>
<a href="#core.views.User.email_user" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Sends an email to this User.</p>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-624">624</a></span>
<span class="normal"><a href="#__codelineno-0-625">625</a></span>
<span class="normal"><a href="#__codelineno-0-626">626</a></span>
<span class="normal"><a href="#__codelineno-0-627">627</a></span>
<span class="normal"><a href="#__codelineno-0-628">628</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-624"><a id="__codelineno-0-624" name="__codelineno-0-624"></a><span class="k">def</span> <span class="nf">email_user</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">subject</span><span class="p">,</span> <span class="n">message</span><span class="p">,</span> <span class="n">from_email</span><span class="o">=</span><span class="kc">None</span><span class="p">,</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">):</span>
</span><span id="__span-0-625"><a id="__codelineno-0-625" name="__codelineno-0-625"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Sends an email to this User.&quot;&quot;&quot;</span>
</span><span id="__span-0-626"><a id="__codelineno-0-626" name="__codelineno-0-626"></a> <span class="k">if</span> <span class="n">from_email</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span>
</span><span id="__span-0-627"><a id="__codelineno-0-627" name="__codelineno-0-627"></a> <span class="n">from_email</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">DEFAULT_FROM_EMAIL</span>
</span><span id="__span-0-628"><a id="__codelineno-0-628" name="__codelineno-0-628"></a> <span class="n">send_mail</span><span class="p">(</span><span class="n">subject</span><span class="p">,</span> <span class="n">message</span><span class="p">,</span> <span class="n">from_email</span><span class="p">,</span> <span class="p">[</span><span class="bp">self</span><span class="o">.</span><span class="n">email</span><span class="p">],</span> <span class="o">**</span><span class="n">kwargs</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.User.generate_username" class="doc doc-heading">
<code class="highlight language-python"><span class="n">generate_username</span><span class="p">()</span></code>
<a href="#core.views.User.generate_username" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Generates a unique username based on the first and last names.</p>
<p>For example: Guy Carlier gives gcarlier, and gcarlier1 if the first one exists.</p>
<p><span class="doc-section-title">Returns:</span></p>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code>str</code>
</td>
<td>
<div class="doc-md-description">
<p>The generated username.</p>
</div>
</td>
</tr>
</tbody>
</table>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-630">630</a></span>
<span class="normal"><a href="#__codelineno-0-631">631</a></span>
<span class="normal"><a href="#__codelineno-0-632">632</a></span>
<span class="normal"><a href="#__codelineno-0-633">633</a></span>
<span class="normal"><a href="#__codelineno-0-634">634</a></span>
<span class="normal"><a href="#__codelineno-0-635">635</a></span>
<span class="normal"><a href="#__codelineno-0-636">636</a></span>
<span class="normal"><a href="#__codelineno-0-637">637</a></span>
<span class="normal"><a href="#__codelineno-0-638">638</a></span>
<span class="normal"><a href="#__codelineno-0-639">639</a></span>
<span class="normal"><a href="#__codelineno-0-640">640</a></span>
<span class="normal"><a href="#__codelineno-0-641">641</a></span>
<span class="normal"><a href="#__codelineno-0-642">642</a></span>
<span class="normal"><a href="#__codelineno-0-643">643</a></span>
<span class="normal"><a href="#__codelineno-0-644">644</a></span>
<span class="normal"><a href="#__codelineno-0-645">645</a></span>
<span class="normal"><a href="#__codelineno-0-646">646</a></span>
<span class="normal"><a href="#__codelineno-0-647">647</a></span>
<span class="normal"><a href="#__codelineno-0-648">648</a></span>
<span class="normal"><a href="#__codelineno-0-649">649</a></span>
<span class="normal"><a href="#__codelineno-0-650">650</a></span>
<span class="normal"><a href="#__codelineno-0-651">651</a></span>
<span class="normal"><a href="#__codelineno-0-652">652</a></span>
<span class="normal"><a href="#__codelineno-0-653">653</a></span>
<span class="normal"><a href="#__codelineno-0-654">654</a></span>
<span class="normal"><a href="#__codelineno-0-655">655</a></span>
<span class="normal"><a href="#__codelineno-0-656">656</a></span>
<span class="normal"><a href="#__codelineno-0-657">657</a></span>
<span class="normal"><a href="#__codelineno-0-658">658</a></span>
<span class="normal"><a href="#__codelineno-0-659">659</a></span>
<span class="normal"><a href="#__codelineno-0-660">660</a></span>
<span class="normal"><a href="#__codelineno-0-661">661</a></span>
<span class="normal"><a href="#__codelineno-0-662">662</a></span>
<span class="normal"><a href="#__codelineno-0-663">663</a></span>
<span class="normal"><a href="#__codelineno-0-664">664</a></span>
<span class="normal"><a href="#__codelineno-0-665">665</a></span>
<span class="normal"><a href="#__codelineno-0-666">666</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-630"><a id="__codelineno-0-630" name="__codelineno-0-630"></a><span class="k">def</span> <span class="nf">generate_username</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">str</span><span class="p">:</span>
</span><span id="__span-0-631"><a id="__codelineno-0-631" name="__codelineno-0-631"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Generates a unique username based on the first and last names.</span>
</span><span id="__span-0-632"><a id="__codelineno-0-632" name="__codelineno-0-632"></a>
</span><span id="__span-0-633"><a id="__codelineno-0-633" name="__codelineno-0-633"></a><span class="sd"> For example: Guy Carlier gives gcarlier, and gcarlier1 if the first one exists.</span>
</span><span id="__span-0-634"><a id="__codelineno-0-634" name="__codelineno-0-634"></a>
</span><span id="__span-0-635"><a id="__codelineno-0-635" name="__codelineno-0-635"></a><span class="sd"> Returns:</span>
</span><span id="__span-0-636"><a id="__codelineno-0-636" name="__codelineno-0-636"></a><span class="sd"> The generated username.</span>
</span><span id="__span-0-637"><a id="__codelineno-0-637" name="__codelineno-0-637"></a><span class="sd"> &quot;&quot;&quot;</span>
</span><span id="__span-0-638"><a id="__codelineno-0-638" name="__codelineno-0-638"></a>
</span><span id="__span-0-639"><a id="__codelineno-0-639" name="__codelineno-0-639"></a> <span class="k">def</span> <span class="nf">remove_accents</span><span class="p">(</span><span class="n">data</span><span class="p">):</span>
</span><span id="__span-0-640"><a id="__codelineno-0-640" name="__codelineno-0-640"></a> <span class="k">return</span> <span class="s2">&quot;&quot;</span><span class="o">.</span><span class="n">join</span><span class="p">(</span>
</span><span id="__span-0-641"><a id="__codelineno-0-641" name="__codelineno-0-641"></a> <span class="n">x</span>
</span><span id="__span-0-642"><a id="__codelineno-0-642" name="__codelineno-0-642"></a> <span class="k">for</span> <span class="n">x</span> <span class="ow">in</span> <span class="n">unicodedata</span><span class="o">.</span><span class="n">normalize</span><span class="p">(</span><span class="s2">&quot;NFKD&quot;</span><span class="p">,</span> <span class="n">data</span><span class="p">)</span>
</span><span id="__span-0-643"><a id="__codelineno-0-643" name="__codelineno-0-643"></a> <span class="k">if</span> <span class="n">unicodedata</span><span class="o">.</span><span class="n">category</span><span class="p">(</span><span class="n">x</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span> <span class="o">==</span> <span class="s2">&quot;L&quot;</span>
</span><span id="__span-0-644"><a id="__codelineno-0-644" name="__codelineno-0-644"></a> <span class="p">)</span><span class="o">.</span><span class="n">lower</span><span class="p">()</span>
</span><span id="__span-0-645"><a id="__codelineno-0-645" name="__codelineno-0-645"></a>
</span><span id="__span-0-646"><a id="__codelineno-0-646" name="__codelineno-0-646"></a> <span class="n">user_name</span> <span class="o">=</span> <span class="p">(</span>
</span><span id="__span-0-647"><a id="__codelineno-0-647" name="__codelineno-0-647"></a> <span class="n">remove_accents</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">first_name</span><span class="p">[</span><span class="mi">0</span><span class="p">]</span> <span class="o">+</span> <span class="bp">self</span><span class="o">.</span><span class="n">last_name</span><span class="p">)</span>
</span><span id="__span-0-648"><a id="__codelineno-0-648" name="__codelineno-0-648"></a> <span class="o">.</span><span class="n">encode</span><span class="p">(</span><span class="s2">&quot;ascii&quot;</span><span class="p">,</span> <span class="s2">&quot;ignore&quot;</span><span class="p">)</span>
</span><span id="__span-0-649"><a id="__codelineno-0-649" name="__codelineno-0-649"></a> <span class="o">.</span><span class="n">decode</span><span class="p">(</span><span class="s2">&quot;utf-8&quot;</span><span class="p">)</span>
</span><span id="__span-0-650"><a id="__codelineno-0-650" name="__codelineno-0-650"></a> <span class="p">)</span>
</span><span id="__span-0-651"><a id="__codelineno-0-651" name="__codelineno-0-651"></a> <span class="c1"># load all usernames which could conflict with the new one.</span>
</span><span id="__span-0-652"><a id="__codelineno-0-652" name="__codelineno-0-652"></a> <span class="c1"># we need to actually load them, instead of performing a count,</span>
</span><span id="__span-0-653"><a id="__codelineno-0-653" name="__codelineno-0-653"></a> <span class="c1"># because we cannot be sure that two usernames refer to the</span>
</span><span id="__span-0-654"><a id="__codelineno-0-654" name="__codelineno-0-654"></a> <span class="c1"># actual same word (eg. tmore and tmoreau)</span>
</span><span id="__span-0-655"><a id="__codelineno-0-655" name="__codelineno-0-655"></a> <span class="n">possible_conflicts</span><span class="p">:</span> <span class="nb">list</span><span class="p">[</span><span class="nb">str</span><span class="p">]</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span>
</span><span id="__span-0-656"><a id="__codelineno-0-656" name="__codelineno-0-656"></a> <span class="n">User</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">username__startswith</span><span class="o">=</span><span class="n">user_name</span><span class="p">)</span><span class="o">.</span><span class="n">values_list</span><span class="p">(</span>
</span><span id="__span-0-657"><a id="__codelineno-0-657" name="__codelineno-0-657"></a> <span class="s2">&quot;username&quot;</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span>
</span><span id="__span-0-658"><a id="__codelineno-0-658" name="__codelineno-0-658"></a> <span class="p">)</span>
</span><span id="__span-0-659"><a id="__codelineno-0-659" name="__codelineno-0-659"></a> <span class="p">)</span>
</span><span id="__span-0-660"><a id="__codelineno-0-660" name="__codelineno-0-660"></a> <span class="n">nb_conflicts</span> <span class="o">=</span> <span class="nb">sum</span><span class="p">(</span>
</span><span id="__span-0-661"><a id="__codelineno-0-661" name="__codelineno-0-661"></a> <span class="mi">1</span> <span class="k">for</span> <span class="n">name</span> <span class="ow">in</span> <span class="n">possible_conflicts</span> <span class="k">if</span> <span class="n">name</span><span class="o">.</span><span class="n">rstrip</span><span class="p">(</span><span class="n">string</span><span class="o">.</span><span class="n">digits</span><span class="p">)</span> <span class="o">==</span> <span class="n">user_name</span>
</span><span id="__span-0-662"><a id="__codelineno-0-662" name="__codelineno-0-662"></a> <span class="p">)</span>
</span><span id="__span-0-663"><a id="__codelineno-0-663" name="__codelineno-0-663"></a> <span class="k">if</span> <span class="n">nb_conflicts</span> <span class="o">&gt;</span> <span class="mi">0</span><span class="p">:</span>
</span><span id="__span-0-664"><a id="__codelineno-0-664" name="__codelineno-0-664"></a> <span class="n">user_name</span> <span class="o">+=</span> <span class="nb">str</span><span class="p">(</span><span class="n">nb_conflicts</span><span class="p">)</span> <span class="c1"># exemple =&gt; exemple1</span>
</span><span id="__span-0-665"><a id="__codelineno-0-665" name="__codelineno-0-665"></a> <span class="bp">self</span><span class="o">.</span><span class="n">username</span> <span class="o">=</span> <span class="n">user_name</span>
</span><span id="__span-0-666"><a id="__codelineno-0-666" name="__codelineno-0-666"></a> <span class="k">return</span> <span class="n">user_name</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.User.is_owner" class="doc doc-heading">
<code class="highlight language-python"><span class="n">is_owner</span><span class="p">(</span><span class="n">obj</span><span class="p">)</span></code>
<a href="#core.views.User.is_owner" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Determine if the object is owned by the user.</p>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-668">668</a></span>
<span class="normal"><a href="#__codelineno-0-669">669</a></span>
<span class="normal"><a href="#__codelineno-0-670">670</a></span>
<span class="normal"><a href="#__codelineno-0-671">671</a></span>
<span class="normal"><a href="#__codelineno-0-672">672</a></span>
<span class="normal"><a href="#__codelineno-0-673">673</a></span>
<span class="normal"><a href="#__codelineno-0-674">674</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-668"><a id="__codelineno-0-668" name="__codelineno-0-668"></a><span class="k">def</span> <span class="nf">is_owner</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">obj</span><span class="p">):</span>
</span><span id="__span-0-669"><a id="__codelineno-0-669" name="__codelineno-0-669"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Determine if the object is owned by the user.&quot;&quot;&quot;</span>
</span><span id="__span-0-670"><a id="__codelineno-0-670" name="__codelineno-0-670"></a> <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="s2">&quot;is_owned_by&quot;</span><span class="p">)</span> <span class="ow">and</span> <span class="n">obj</span><span class="o">.</span><span class="n">is_owned_by</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
</span><span id="__span-0-671"><a id="__codelineno-0-671" name="__codelineno-0-671"></a> <span class="k">return</span> <span class="kc">True</span>
</span><span id="__span-0-672"><a id="__codelineno-0-672" name="__codelineno-0-672"></a> <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="s2">&quot;owner_group&quot;</span><span class="p">)</span> <span class="ow">and</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_in_group</span><span class="p">(</span><span class="n">pk</span><span class="o">=</span><span class="n">obj</span><span class="o">.</span><span class="n">owner_group</span><span class="o">.</span><span class="n">id</span><span class="p">):</span>
</span><span id="__span-0-673"><a id="__codelineno-0-673" name="__codelineno-0-673"></a> <span class="k">return</span> <span class="kc">True</span>
</span><span id="__span-0-674"><a id="__codelineno-0-674" name="__codelineno-0-674"></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_root</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.User.can_edit" class="doc doc-heading">
<code class="highlight language-python"><span class="n">can_edit</span><span class="p">(</span><span class="n">obj</span><span class="p">)</span></code>
<a href="#core.views.User.can_edit" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Determine if the object can be edited by the user.</p>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-676">676</a></span>
<span class="normal"><a href="#__codelineno-0-677">677</a></span>
<span class="normal"><a href="#__codelineno-0-678">678</a></span>
<span class="normal"><a href="#__codelineno-0-679">679</a></span>
<span class="normal"><a href="#__codelineno-0-680">680</a></span>
<span class="normal"><a href="#__codelineno-0-681">681</a></span>
<span class="normal"><a href="#__codelineno-0-682">682</a></span>
<span class="normal"><a href="#__codelineno-0-683">683</a></span>
<span class="normal"><a href="#__codelineno-0-684">684</a></span>
<span class="normal"><a href="#__codelineno-0-685">685</a></span>
<span class="normal"><a href="#__codelineno-0-686">686</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-676"><a id="__codelineno-0-676" name="__codelineno-0-676"></a><span class="k">def</span> <span class="nf">can_edit</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">obj</span><span class="p">):</span>
</span><span id="__span-0-677"><a id="__codelineno-0-677" name="__codelineno-0-677"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Determine if the object can be edited by the user.&quot;&quot;&quot;</span>
</span><span id="__span-0-678"><a id="__codelineno-0-678" name="__codelineno-0-678"></a> <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="s2">&quot;can_be_edited_by&quot;</span><span class="p">)</span> <span class="ow">and</span> <span class="n">obj</span><span class="o">.</span><span class="n">can_be_edited_by</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
</span><span id="__span-0-679"><a id="__codelineno-0-679" name="__codelineno-0-679"></a> <span class="k">return</span> <span class="kc">True</span>
</span><span id="__span-0-680"><a id="__codelineno-0-680" name="__codelineno-0-680"></a> <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="s2">&quot;edit_groups&quot;</span><span class="p">):</span>
</span><span id="__span-0-681"><a id="__codelineno-0-681" name="__codelineno-0-681"></a> <span class="k">for</span> <span class="n">pk</span> <span class="ow">in</span> <span class="n">obj</span><span class="o">.</span><span class="n">edit_groups</span><span class="o">.</span><span class="n">values_list</span><span class="p">(</span><span class="s2">&quot;pk&quot;</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
</span><span id="__span-0-682"><a id="__codelineno-0-682" name="__codelineno-0-682"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_in_group</span><span class="p">(</span><span class="n">pk</span><span class="o">=</span><span class="n">pk</span><span class="p">):</span>
</span><span id="__span-0-683"><a id="__codelineno-0-683" name="__codelineno-0-683"></a> <span class="k">return</span> <span class="kc">True</span>
</span><span id="__span-0-684"><a id="__codelineno-0-684" name="__codelineno-0-684"></a> <span class="k">if</span> <span class="nb">isinstance</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="n">User</span><span class="p">)</span> <span class="ow">and</span> <span class="n">obj</span> <span class="o">==</span> <span class="bp">self</span><span class="p">:</span>
</span><span id="__span-0-685"><a id="__codelineno-0-685" name="__codelineno-0-685"></a> <span class="k">return</span> <span class="kc">True</span>
</span><span id="__span-0-686"><a id="__codelineno-0-686" name="__codelineno-0-686"></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_owner</span><span class="p">(</span><span class="n">obj</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.User.can_view" class="doc doc-heading">
<code class="highlight language-python"><span class="n">can_view</span><span class="p">(</span><span class="n">obj</span><span class="p">)</span></code>
<a href="#core.views.User.can_view" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Determine if the object can be viewed by the user.</p>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-688">688</a></span>
<span class="normal"><a href="#__codelineno-0-689">689</a></span>
<span class="normal"><a href="#__codelineno-0-690">690</a></span>
<span class="normal"><a href="#__codelineno-0-691">691</a></span>
<span class="normal"><a href="#__codelineno-0-692">692</a></span>
<span class="normal"><a href="#__codelineno-0-693">693</a></span>
<span class="normal"><a href="#__codelineno-0-694">694</a></span>
<span class="normal"><a href="#__codelineno-0-695">695</a></span>
<span class="normal"><a href="#__codelineno-0-696">696</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-688"><a id="__codelineno-0-688" name="__codelineno-0-688"></a><span class="k">def</span> <span class="nf">can_view</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">obj</span><span class="p">):</span>
</span><span id="__span-0-689"><a id="__codelineno-0-689" name="__codelineno-0-689"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Determine if the object can be viewed by the user.&quot;&quot;&quot;</span>
</span><span id="__span-0-690"><a id="__codelineno-0-690" name="__codelineno-0-690"></a> <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="s2">&quot;can_be_viewed_by&quot;</span><span class="p">)</span> <span class="ow">and</span> <span class="n">obj</span><span class="o">.</span><span class="n">can_be_viewed_by</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span>
</span><span id="__span-0-691"><a id="__codelineno-0-691" name="__codelineno-0-691"></a> <span class="k">return</span> <span class="kc">True</span>
</span><span id="__span-0-692"><a id="__codelineno-0-692" name="__codelineno-0-692"></a> <span class="k">if</span> <span class="nb">hasattr</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="s2">&quot;view_groups&quot;</span><span class="p">):</span>
</span><span id="__span-0-693"><a id="__codelineno-0-693" name="__codelineno-0-693"></a> <span class="k">for</span> <span class="n">pk</span> <span class="ow">in</span> <span class="n">obj</span><span class="o">.</span><span class="n">view_groups</span><span class="o">.</span><span class="n">values_list</span><span class="p">(</span><span class="s2">&quot;pk&quot;</span><span class="p">,</span> <span class="n">flat</span><span class="o">=</span><span class="kc">True</span><span class="p">):</span>
</span><span id="__span-0-694"><a id="__codelineno-0-694" name="__codelineno-0-694"></a> <span class="k">if</span> <span class="bp">self</span><span class="o">.</span><span class="n">is_in_group</span><span class="p">(</span><span class="n">pk</span><span class="o">=</span><span class="n">pk</span><span class="p">):</span>
</span><span id="__span-0-695"><a id="__codelineno-0-695" name="__codelineno-0-695"></a> <span class="k">return</span> <span class="kc">True</span>
</span><span id="__span-0-696"><a id="__codelineno-0-696" name="__codelineno-0-696"></a> <span class="k">return</span> <span class="bp">self</span><span class="o">.</span><span class="n">can_edit</span><span class="p">(</span><span class="n">obj</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h3 id="core.views.User.clubs_with_rights" class="doc doc-heading">
<code class="highlight language-python"><span class="n">clubs_with_rights</span><span class="p">()</span></code>
<a href="#core.views.User.clubs_with_rights" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>The list of clubs where the user has rights</p>
<details class="quote">
<summary>Source code in <code>core/models.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-736">736</a></span>
<span class="normal"><a href="#__codelineno-0-737">737</a></span>
<span class="normal"><a href="#__codelineno-0-738">738</a></span>
<span class="normal"><a href="#__codelineno-0-739">739</a></span>
<span class="normal"><a href="#__codelineno-0-740">740</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-736"><a id="__codelineno-0-736" name="__codelineno-0-736"></a><span class="nd">@cached_property</span>
</span><span id="__span-0-737"><a id="__codelineno-0-737" name="__codelineno-0-737"></a><span class="k">def</span> <span class="nf">clubs_with_rights</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">list</span><span class="p">[</span><span class="n">Club</span><span class="p">]:</span>
</span><span id="__span-0-738"><a id="__codelineno-0-738" name="__codelineno-0-738"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;The list of clubs where the user has rights&quot;&quot;&quot;</span>
</span><span id="__span-0-739"><a id="__codelineno-0-739" name="__codelineno-0-739"></a> <span class="n">memberships</span> <span class="o">=</span> <span class="bp">self</span><span class="o">.</span><span class="n">memberships</span><span class="o">.</span><span class="n">ongoing</span><span class="p">()</span><span class="o">.</span><span class="n">board</span><span class="p">()</span><span class="o">.</span><span class="n">select_related</span><span class="p">(</span><span class="s2">&quot;club&quot;</span><span class="p">)</span>
</span><span id="__span-0-740"><a id="__codelineno-0-740" name="__codelineno-0-740"></a> <span class="k">return</span> <span class="p">[</span><span class="n">m</span><span class="o">.</span><span class="n">club</span> <span class="k">for</span> <span class="n">m</span> <span class="ow">in</span> <span class="n">memberships</span><span class="p">]</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.Gift" class="doc doc-heading">
<code>Gift</code>
<a href="#core.views.Gift" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.db.models.Model">Model</span></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.Preferences" class="doc doc-heading">
<code>Preferences</code>
<a href="#core.views.Preferences" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.db.models.Model">Model</span></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.SithLoginView" class="doc doc-heading">
<code>SithLoginView</code>
<a href="#core.views.SithLoginView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.contrib.auth.views.LoginView">LoginView</span></code></p>
<p>The login View.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.SithPasswordChangeView" class="doc doc-heading">
<code>SithPasswordChangeView</code>
<a href="#core.views.SithPasswordChangeView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.contrib.auth.views.PasswordChangeView">PasswordChangeView</span></code></p>
<p>Allows a user to change its password.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.SithPasswordChangeDoneView" class="doc doc-heading">
<code>SithPasswordChangeDoneView</code>
<a href="#core.views.SithPasswordChangeDoneView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.contrib.auth.views.PasswordChangeDoneView">PasswordChangeDoneView</span></code></p>
<p>Allows a user to change its password.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.SithPasswordResetView" class="doc doc-heading">
<code>SithPasswordResetView</code>
<a href="#core.views.SithPasswordResetView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.contrib.auth.views.PasswordResetView">PasswordResetView</span></code></p>
<p>Allows someone to enter an email address for resetting password.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.SithPasswordResetDoneView" class="doc doc-heading">
<code>SithPasswordResetDoneView</code>
<a href="#core.views.SithPasswordResetDoneView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.contrib.auth.views.PasswordResetDoneView">PasswordResetDoneView</span></code></p>
<p>Confirm that the reset email has been sent.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.SithPasswordResetConfirmView" class="doc doc-heading">
<code>SithPasswordResetConfirmView</code>
<a href="#core.views.SithPasswordResetConfirmView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.contrib.auth.views.PasswordResetConfirmView">PasswordResetConfirmView</span></code></p>
<p>Provide a reset password form.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.SithPasswordResetCompleteView" class="doc doc-heading">
<code>SithPasswordResetCompleteView</code>
<a href="#core.views.SithPasswordResetCompleteView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.contrib.auth.views.PasswordResetCompleteView">PasswordResetCompleteView</span></code></p>
<p>Confirm the password has successfully been reset.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.UserCreationView" class="doc doc-heading">
<code>UserCreationView</code>
<a href="#core.views.UserCreationView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.views.generic.edit.FormView">FormView</span></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.UserTabsMixin" class="doc doc-heading">
<code>UserTabsMixin</code>
<a href="#core.views.UserTabsMixin" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.TabedViewMixin" href="#core.views.TabedViewMixin">TabedViewMixin</a></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.UserView" class="doc doc-heading">
<code>UserView</code>
<a href="#core.views.UserView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.user.UserTabsMixin" href="#core.views.UserTabsMixin">UserTabsMixin</a></code>, <code><a class="autorefs autorefs-internal" title="core.views.CanViewMixin" href="#core.views.CanViewMixin">CanViewMixin</a></code>, <code><span title="django.views.generic.DetailView">DetailView</span></code></p>
<p>Display a user's profile.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.UserPicturesView" class="doc doc-heading">
<code>UserPicturesView</code>
<a href="#core.views.UserPicturesView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.user.UserTabsMixin" href="#core.views.UserTabsMixin">UserTabsMixin</a></code>, <code><a class="autorefs autorefs-internal" title="core.views.CanViewMixin" href="#core.views.CanViewMixin">CanViewMixin</a></code>, <code><span title="django.views.generic.DetailView">DetailView</span></code></p>
<p>Display a user's pictures.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.UserGodfathersView" class="doc doc-heading">
<code>UserGodfathersView</code>
<a href="#core.views.UserGodfathersView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.user.UserTabsMixin" href="#core.views.UserTabsMixin">UserTabsMixin</a></code>, <code><a class="autorefs autorefs-internal" title="core.views.CanViewMixin" href="#core.views.CanViewMixin">CanViewMixin</a></code>, <code><span title="django.views.generic.DetailView">DetailView</span></code>, <code><span title="django.views.generic.edit.FormView">FormView</span></code></p>
<p>Display a user's godfathers.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.UserGodfathersTreeView" class="doc doc-heading">
<code>UserGodfathersTreeView</code>
<a href="#core.views.UserGodfathersTreeView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.user.UserTabsMixin" href="#core.views.UserTabsMixin">UserTabsMixin</a></code>, <code><a class="autorefs autorefs-internal" title="core.views.CanViewMixin" href="#core.views.CanViewMixin">CanViewMixin</a></code>, <code><span title="django.views.generic.DetailView">DetailView</span></code></p>
<p>Display a user's family tree.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.UserStatsView" class="doc doc-heading">
<code>UserStatsView</code>
<a href="#core.views.UserStatsView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.user.UserTabsMixin" href="#core.views.UserTabsMixin">UserTabsMixin</a></code>, <code><a class="autorefs autorefs-internal" title="core.views.CanViewMixin" href="#core.views.CanViewMixin">CanViewMixin</a></code>, <code><span title="django.views.generic.DetailView">DetailView</span></code></p>
<p>Display a user's stats.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.UserMiniView" class="doc doc-heading">
<code>UserMiniView</code>
<a href="#core.views.UserMiniView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.CanViewMixin" href="#core.views.CanViewMixin">CanViewMixin</a></code>, <code><span title="django.views.generic.DetailView">DetailView</span></code></p>
<p>Display a user's profile.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.UserListView" class="doc doc-heading">
<code>UserListView</code>
<a href="#core.views.UserListView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.views.generic.ListView">ListView</span></code>, <code><a class="autorefs autorefs-internal" title="core.views.CanEditPropMixin" href="#core.views.CanEditPropMixin">CanEditPropMixin</a></code></p>
<p>Displays the user list.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.UserUpdateProfileView" class="doc doc-heading">
<code>UserUpdateProfileView</code>
<a href="#core.views.UserUpdateProfileView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.user.UserTabsMixin" href="#core.views.UserTabsMixin">UserTabsMixin</a></code>, <code><a class="autorefs autorefs-internal" title="core.views.CanEditMixin" href="#core.views.CanEditMixin">CanEditMixin</a></code>, <code><span title="django.views.generic.edit.UpdateView">UpdateView</span></code></p>
<p>Edit a user's profile.</p>
<div class="doc doc-children">
<div class="doc doc-object doc-function">
<h3 id="core.views.UserUpdateProfileView.remove_restricted_fields" class="doc doc-heading">
<code class="highlight language-python"><span class="n">remove_restricted_fields</span><span class="p">(</span><span class="n">request</span><span class="p">)</span></code>
<a href="#core.views.UserUpdateProfileView.remove_restricted_fields" class="headerlink" title="Permanent link">&para;</a></h3>
<div class="doc doc-contents ">
<p>Removes edit_once and board_only fields.</p>
<details class="quote">
<summary>Source code in <code>core/views/user.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-502">502</a></span>
<span class="normal"><a href="#__codelineno-0-503">503</a></span>
<span class="normal"><a href="#__codelineno-0-504">504</a></span>
<span class="normal"><a href="#__codelineno-0-505">505</a></span>
<span class="normal"><a href="#__codelineno-0-506">506</a></span>
<span class="normal"><a href="#__codelineno-0-507">507</a></span>
<span class="normal"><a href="#__codelineno-0-508">508</a></span>
<span class="normal"><a href="#__codelineno-0-509">509</a></span>
<span class="normal"><a href="#__codelineno-0-510">510</a></span>
<span class="normal"><a href="#__codelineno-0-511">511</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-502"><a id="__codelineno-0-502" name="__codelineno-0-502"></a><span class="k">def</span> <span class="nf">remove_restricted_fields</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">request</span><span class="p">):</span>
</span><span id="__span-0-503"><a id="__codelineno-0-503" name="__codelineno-0-503"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Removes edit_once and board_only fields.&quot;&quot;&quot;</span>
</span><span id="__span-0-504"><a id="__codelineno-0-504" name="__codelineno-0-504"></a> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">edit_once</span><span class="p">:</span>
</span><span id="__span-0-505"><a id="__codelineno-0-505" name="__codelineno-0-505"></a> <span class="k">if</span> <span class="nb">getattr</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">form</span><span class="o">.</span><span class="n">instance</span><span class="p">,</span> <span class="n">i</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="p">(</span>
</span><span id="__span-0-506"><a id="__codelineno-0-506" name="__codelineno-0-506"></a> <span class="n">request</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">is_board_member</span> <span class="ow">or</span> <span class="n">request</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">is_root</span>
</span><span id="__span-0-507"><a id="__codelineno-0-507" name="__codelineno-0-507"></a> <span class="p">):</span>
</span><span id="__span-0-508"><a id="__codelineno-0-508" name="__codelineno-0-508"></a> <span class="bp">self</span><span class="o">.</span><span class="n">form</span><span class="o">.</span><span class="n">fields</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
</span><span id="__span-0-509"><a id="__codelineno-0-509" name="__codelineno-0-509"></a> <span class="k">for</span> <span class="n">i</span> <span class="ow">in</span> <span class="bp">self</span><span class="o">.</span><span class="n">board_only</span><span class="p">:</span>
</span><span id="__span-0-510"><a id="__codelineno-0-510" name="__codelineno-0-510"></a> <span class="k">if</span> <span class="ow">not</span> <span class="p">(</span><span class="n">request</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">is_board_member</span> <span class="ow">or</span> <span class="n">request</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">is_root</span><span class="p">):</span>
</span><span id="__span-0-511"><a id="__codelineno-0-511" name="__codelineno-0-511"></a> <span class="bp">self</span><span class="o">.</span><span class="n">form</span><span class="o">.</span><span class="n">fields</span><span class="o">.</span><span class="n">pop</span><span class="p">(</span><span class="n">i</span><span class="p">,</span> <span class="kc">None</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.UserClubView" class="doc doc-heading">
<code>UserClubView</code>
<a href="#core.views.UserClubView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.user.UserTabsMixin" href="#core.views.UserTabsMixin">UserTabsMixin</a></code>, <code><a class="autorefs autorefs-internal" title="core.views.CanViewMixin" href="#core.views.CanViewMixin">CanViewMixin</a></code>, <code><span title="django.views.generic.DetailView">DetailView</span></code></p>
<p>Display the user's club(s).</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.UserPreferencesView" class="doc doc-heading">
<code>UserPreferencesView</code>
<a href="#core.views.UserPreferencesView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.user.UserTabsMixin" href="#core.views.UserTabsMixin">UserTabsMixin</a></code>, <code><a class="autorefs autorefs-internal" title="core.views.CanEditMixin" href="#core.views.CanEditMixin">CanEditMixin</a></code>, <code><span title="django.views.generic.edit.UpdateView">UpdateView</span></code></p>
<p>Edit a user's preferences.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.UserUpdateGroupView" class="doc doc-heading">
<code>UserUpdateGroupView</code>
<a href="#core.views.UserUpdateGroupView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.user.UserTabsMixin" href="#core.views.UserTabsMixin">UserTabsMixin</a></code>, <code><a class="autorefs autorefs-internal" title="core.views.CanEditPropMixin" href="#core.views.CanEditPropMixin">CanEditPropMixin</a></code>, <code><span title="django.views.generic.edit.UpdateView">UpdateView</span></code></p>
<p>Edit a user's groups.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.UserToolsView" class="doc doc-heading">
<code>UserToolsView</code>
<a href="#core.views.UserToolsView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.contrib.auth.mixins.LoginRequiredMixin">LoginRequiredMixin</span></code>, <code><a class="autorefs autorefs-internal" title="core.views.QuickNotifMixin" href="#core.views.QuickNotifMixin">QuickNotifMixin</a></code>, <code><a class="autorefs autorefs-internal" title="core.views.user.UserTabsMixin" href="#core.views.UserTabsMixin">UserTabsMixin</a></code>, <code><span title="django.views.generic.TemplateView">TemplateView</span></code></p>
<p>Displays the logged user's tools.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.UserAccountBase" class="doc doc-heading">
<code>UserAccountBase</code>
<a href="#core.views.UserAccountBase" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.user.UserTabsMixin" href="#core.views.UserTabsMixin">UserTabsMixin</a></code>, <code><span title="django.views.generic.DetailView">DetailView</span></code></p>
<p>Base class for UserAccount.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.UserAccountView" class="doc doc-heading">
<code>UserAccountView</code>
<a href="#core.views.UserAccountView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.user.UserAccountBase" href="#core.views.UserAccountBase">UserAccountBase</a></code></p>
<p>Display a user's account.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.UserAccountDetailView" class="doc doc-heading">
<code>UserAccountDetailView</code>
<a href="#core.views.UserAccountDetailView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.user.UserAccountBase" href="#core.views.UserAccountBase">UserAccountBase</a></code>, <code><span title="django.views.generic.dates.YearMixin">YearMixin</span></code>, <code><span title="django.views.generic.dates.MonthMixin">MonthMixin</span></code></p>
<p>Display a user's account for month.</p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.GiftCreateView" class="doc doc-heading">
<code>GiftCreateView</code>
<a href="#core.views.GiftCreateView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><span title="django.views.generic.CreateView">CreateView</span></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-class">
<h2 id="core.views.GiftDeleteView" class="doc doc-heading">
<code>GiftDeleteView</code>
<a href="#core.views.GiftDeleteView" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p class="doc doc-class-bases">
Bases: <code><a class="autorefs autorefs-internal" title="core.views.CanEditPropMixin" href="#core.views.CanEditPropMixin">CanEditPropMixin</a></code>, <code><span title="django.views.generic.DeleteView">DeleteView</span></code></p>
<div class="doc doc-children">
</div>
</div>
</div>
<div class="doc doc-object doc-function">
<h2 id="core.views.forbidden" class="doc doc-heading">
<code class="highlight language-python"><span class="n">forbidden</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">exception</span><span class="p">)</span></code>
<a href="#core.views.forbidden" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<details class="quote">
<summary>Source code in <code>core/views/__init__.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-50">50</a></span>
<span class="normal"><a href="#__codelineno-0-51">51</a></span>
<span class="normal"><a href="#__codelineno-0-52">52</a></span>
<span class="normal"><a href="#__codelineno-0-53">53</a></span>
<span class="normal"><a href="#__codelineno-0-54">54</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-50"><a id="__codelineno-0-50" name="__codelineno-0-50"></a><span class="k">def</span> <span class="nf">forbidden</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">exception</span><span class="p">):</span>
</span><span id="__span-0-51"><a id="__codelineno-0-51" name="__codelineno-0-51"></a> <span class="n">context</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;next&quot;</span><span class="p">:</span> <span class="n">request</span><span class="o">.</span><span class="n">path</span><span class="p">,</span> <span class="s2">&quot;form&quot;</span><span class="p">:</span> <span class="n">LoginForm</span><span class="p">()}</span>
</span><span id="__span-0-52"><a id="__codelineno-0-52" name="__codelineno-0-52"></a> <span class="k">if</span> <span class="n">popup</span> <span class="o">:=</span> <span class="n">request</span><span class="o">.</span><span class="n">resolver_match</span><span class="o">.</span><span class="n">kwargs</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;popup&quot;</span><span class="p">):</span>
</span><span id="__span-0-53"><a id="__codelineno-0-53" name="__codelineno-0-53"></a> <span class="n">context</span><span class="p">[</span><span class="s2">&quot;popup&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">popup</span>
</span><span id="__span-0-54"><a id="__codelineno-0-54" name="__codelineno-0-54"></a> <span class="k">return</span> <span class="n">HttpResponseForbidden</span><span class="p">(</span><span class="n">render</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="s2">&quot;core/403.jinja&quot;</span><span class="p">,</span> <span class="n">context</span><span class="o">=</span><span class="n">context</span><span class="p">))</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h2 id="core.views.not_found" class="doc doc-heading">
<code class="highlight language-python"><span class="n">not_found</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">exception</span><span class="p">)</span></code>
<a href="#core.views.not_found" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<details class="quote">
<summary>Source code in <code>core/views/__init__.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-57">57</a></span>
<span class="normal"><a href="#__codelineno-0-58">58</a></span>
<span class="normal"><a href="#__codelineno-0-59">59</a></span>
<span class="normal"><a href="#__codelineno-0-60">60</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-57"><a id="__codelineno-0-57" name="__codelineno-0-57"></a><span class="k">def</span> <span class="nf">not_found</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">exception</span><span class="p">):</span>
</span><span id="__span-0-58"><a id="__codelineno-0-58" name="__codelineno-0-58"></a> <span class="k">return</span> <span class="n">HttpResponseNotFound</span><span class="p">(</span>
</span><span id="__span-0-59"><a id="__codelineno-0-59" name="__codelineno-0-59"></a> <span class="n">render</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="s2">&quot;core/404.jinja&quot;</span><span class="p">,</span> <span class="n">context</span><span class="o">=</span><span class="p">{</span><span class="s2">&quot;exception&quot;</span><span class="p">:</span> <span class="n">exception</span><span class="p">})</span>
</span><span id="__span-0-60"><a id="__codelineno-0-60" name="__codelineno-0-60"></a> <span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h2 id="core.views.internal_servor_error" class="doc doc-heading">
<code class="highlight language-python"><span class="n">internal_servor_error</span><span class="p">(</span><span class="n">request</span><span class="p">)</span></code>
<a href="#core.views.internal_servor_error" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<details class="quote">
<summary>Source code in <code>core/views/__init__.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-63">63</a></span>
<span class="normal"><a href="#__codelineno-0-64">64</a></span>
<span class="normal"><a href="#__codelineno-0-65">65</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-63"><a id="__codelineno-0-63" name="__codelineno-0-63"></a><span class="k">def</span> <span class="nf">internal_servor_error</span><span class="p">(</span><span class="n">request</span><span class="p">):</span>
</span><span id="__span-0-64"><a id="__codelineno-0-64" name="__codelineno-0-64"></a> <span class="n">request</span><span class="o">.</span><span class="n">sentry_last_event_id</span> <span class="o">=</span> <span class="n">last_event_id</span>
</span><span id="__span-0-65"><a id="__codelineno-0-65" name="__codelineno-0-65"></a> <span class="k">return</span> <span class="n">HttpResponseServerError</span><span class="p">(</span><span class="n">render</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="s2">&quot;core/500.jinja&quot;</span><span class="p">))</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h2 id="core.views.can_edit_prop" class="doc doc-heading">
<code class="highlight language-python"><span class="n">can_edit_prop</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="n">user</span><span class="p">)</span></code>
<a href="#core.views.can_edit_prop" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p>Can the user edit the properties of the object.</p>
<p><span class="doc-section-title">Parameters:</span></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code>obj</code>
</td>
<td>
<code><span title="typing.Any">Any</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Object to test for permission</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>user</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title="core.views.user.User" href="../models/#core.models.User">User</a></code>
</td>
<td>
<div class="doc-md-description">
<p>core.models.User to test permissions against</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
</tbody>
</table>
<p><span class="doc-section-title">Returns:</span></p>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code>bool</code>
</td>
<td>
<div class="doc-md-description">
<p>True if user is authorized to edit object properties else False</p>
</div>
</td>
</tr>
</tbody>
</table>
<p><span class="doc-section-title">Examples:</span></p>
<div class="language-python highlight"><pre><span></span><code><span id="__span-0-1"><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="k">if</span> <span class="ow">not</span> <span class="n">can_edit_prop</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">object</span> <span class="p">,</span><span class="n">request</span><span class="o">.</span><span class="n">user</span><span class="p">):</span>
</span><span id="__span-0-2"><a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="k">raise</span> <span class="n">PermissionDenied</span>
</span></code></pre></div>
<details class="quote">
<summary>Source code in <code>core/views/__init__.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-68">68</a></span>
<span class="normal"><a href="#__codelineno-0-69">69</a></span>
<span class="normal"><a href="#__codelineno-0-70">70</a></span>
<span class="normal"><a href="#__codelineno-0-71">71</a></span>
<span class="normal"><a href="#__codelineno-0-72">72</a></span>
<span class="normal"><a href="#__codelineno-0-73">73</a></span>
<span class="normal"><a href="#__codelineno-0-74">74</a></span>
<span class="normal"><a href="#__codelineno-0-75">75</a></span>
<span class="normal"><a href="#__codelineno-0-76">76</a></span>
<span class="normal"><a href="#__codelineno-0-77">77</a></span>
<span class="normal"><a href="#__codelineno-0-78">78</a></span>
<span class="normal"><a href="#__codelineno-0-79">79</a></span>
<span class="normal"><a href="#__codelineno-0-80">80</a></span>
<span class="normal"><a href="#__codelineno-0-81">81</a></span>
<span class="normal"><a href="#__codelineno-0-82">82</a></span>
<span class="normal"><a href="#__codelineno-0-83">83</a></span>
<span class="normal"><a href="#__codelineno-0-84">84</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-68"><a id="__codelineno-0-68" name="__codelineno-0-68"></a><span class="k">def</span> <span class="nf">can_edit_prop</span><span class="p">(</span><span class="n">obj</span><span class="p">:</span> <span class="n">Any</span><span class="p">,</span> <span class="n">user</span><span class="p">:</span> <span class="n">User</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span>
</span><span id="__span-0-69"><a id="__codelineno-0-69" name="__codelineno-0-69"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Can the user edit the properties of the object.</span>
</span><span id="__span-0-70"><a id="__codelineno-0-70" name="__codelineno-0-70"></a>
</span><span id="__span-0-71"><a id="__codelineno-0-71" name="__codelineno-0-71"></a><span class="sd"> Args:</span>
</span><span id="__span-0-72"><a id="__codelineno-0-72" name="__codelineno-0-72"></a><span class="sd"> obj: Object to test for permission</span>
</span><span id="__span-0-73"><a id="__codelineno-0-73" name="__codelineno-0-73"></a><span class="sd"> user: core.models.User to test permissions against</span>
</span><span id="__span-0-74"><a id="__codelineno-0-74" name="__codelineno-0-74"></a>
</span><span id="__span-0-75"><a id="__codelineno-0-75" name="__codelineno-0-75"></a><span class="sd"> Returns:</span>
</span><span id="__span-0-76"><a id="__codelineno-0-76" name="__codelineno-0-76"></a><span class="sd"> True if user is authorized to edit object properties else False</span>
</span><span id="__span-0-77"><a id="__codelineno-0-77" name="__codelineno-0-77"></a>
</span><span id="__span-0-78"><a id="__codelineno-0-78" name="__codelineno-0-78"></a><span class="sd"> Examples:</span>
</span><span id="__span-0-79"><a id="__codelineno-0-79" name="__codelineno-0-79"></a><span class="sd"> ```python</span>
</span><span id="__span-0-80"><a id="__codelineno-0-80" name="__codelineno-0-80"></a><span class="sd"> if not can_edit_prop(self.object ,request.user):</span>
</span><span id="__span-0-81"><a id="__codelineno-0-81" name="__codelineno-0-81"></a><span class="sd"> raise PermissionDenied</span>
</span><span id="__span-0-82"><a id="__codelineno-0-82" name="__codelineno-0-82"></a><span class="sd"> ```</span>
</span><span id="__span-0-83"><a id="__codelineno-0-83" name="__codelineno-0-83"></a><span class="sd"> &quot;&quot;&quot;</span>
</span><span id="__span-0-84"><a id="__codelineno-0-84" name="__codelineno-0-84"></a> <span class="k">return</span> <span class="n">obj</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="n">user</span><span class="o">.</span><span class="n">is_owner</span><span class="p">(</span><span class="n">obj</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h2 id="core.views.can_edit" class="doc doc-heading">
<code class="highlight language-python"><span class="n">can_edit</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="n">user</span><span class="p">)</span></code>
<a href="#core.views.can_edit" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p>Can the user edit the object.</p>
<p><span class="doc-section-title">Parameters:</span></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code>obj</code>
</td>
<td>
<code><span title="typing.Any">Any</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Object to test for permission</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>user</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title="core.views.user.User" href="../models/#core.models.User">User</a></code>
</td>
<td>
<div class="doc-md-description">
<p>core.models.User to test permissions against</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
</tbody>
</table>
<p><span class="doc-section-title">Returns:</span></p>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code>bool</code>
</td>
<td>
<div class="doc-md-description">
<p>True if user is authorized to edit object else False</p>
</div>
</td>
</tr>
</tbody>
</table>
<p><span class="doc-section-title">Examples:</span></p>
<div class="language-python highlight"><pre><span></span><code><span id="__span-0-1"><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="k">if</span> <span class="ow">not</span> <span class="n">can_edit</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">object</span><span class="p">,</span> <span class="n">request</span><span class="o">.</span><span class="n">user</span><span class="p">):</span>
</span><span id="__span-0-2"><a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="k">raise</span> <span class="n">PermissionDenied</span>
</span></code></pre></div>
<details class="quote">
<summary>Source code in <code>core/views/__init__.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-87"> 87</a></span>
<span class="normal"><a href="#__codelineno-0-88"> 88</a></span>
<span class="normal"><a href="#__codelineno-0-89"> 89</a></span>
<span class="normal"><a href="#__codelineno-0-90"> 90</a></span>
<span class="normal"><a href="#__codelineno-0-91"> 91</a></span>
<span class="normal"><a href="#__codelineno-0-92"> 92</a></span>
<span class="normal"><a href="#__codelineno-0-93"> 93</a></span>
<span class="normal"><a href="#__codelineno-0-94"> 94</a></span>
<span class="normal"><a href="#__codelineno-0-95"> 95</a></span>
<span class="normal"><a href="#__codelineno-0-96"> 96</a></span>
<span class="normal"><a href="#__codelineno-0-97"> 97</a></span>
<span class="normal"><a href="#__codelineno-0-98"> 98</a></span>
<span class="normal"><a href="#__codelineno-0-99"> 99</a></span>
<span class="normal"><a href="#__codelineno-0-100">100</a></span>
<span class="normal"><a href="#__codelineno-0-101">101</a></span>
<span class="normal"><a href="#__codelineno-0-102">102</a></span>
<span class="normal"><a href="#__codelineno-0-103">103</a></span>
<span class="normal"><a href="#__codelineno-0-104">104</a></span>
<span class="normal"><a href="#__codelineno-0-105">105</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-87"><a id="__codelineno-0-87" name="__codelineno-0-87"></a><span class="k">def</span> <span class="nf">can_edit</span><span class="p">(</span><span class="n">obj</span><span class="p">:</span> <span class="n">Any</span><span class="p">,</span> <span class="n">user</span><span class="p">:</span> <span class="n">User</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span>
</span><span id="__span-0-88"><a id="__codelineno-0-88" name="__codelineno-0-88"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Can the user edit the object.</span>
</span><span id="__span-0-89"><a id="__codelineno-0-89" name="__codelineno-0-89"></a>
</span><span id="__span-0-90"><a id="__codelineno-0-90" name="__codelineno-0-90"></a><span class="sd"> Args:</span>
</span><span id="__span-0-91"><a id="__codelineno-0-91" name="__codelineno-0-91"></a><span class="sd"> obj: Object to test for permission</span>
</span><span id="__span-0-92"><a id="__codelineno-0-92" name="__codelineno-0-92"></a><span class="sd"> user: core.models.User to test permissions against</span>
</span><span id="__span-0-93"><a id="__codelineno-0-93" name="__codelineno-0-93"></a>
</span><span id="__span-0-94"><a id="__codelineno-0-94" name="__codelineno-0-94"></a><span class="sd"> Returns:</span>
</span><span id="__span-0-95"><a id="__codelineno-0-95" name="__codelineno-0-95"></a><span class="sd"> True if user is authorized to edit object else False</span>
</span><span id="__span-0-96"><a id="__codelineno-0-96" name="__codelineno-0-96"></a>
</span><span id="__span-0-97"><a id="__codelineno-0-97" name="__codelineno-0-97"></a><span class="sd"> Examples:</span>
</span><span id="__span-0-98"><a id="__codelineno-0-98" name="__codelineno-0-98"></a><span class="sd"> ```python</span>
</span><span id="__span-0-99"><a id="__codelineno-0-99" name="__codelineno-0-99"></a><span class="sd"> if not can_edit(self.object, request.user):</span>
</span><span id="__span-0-100"><a id="__codelineno-0-100" name="__codelineno-0-100"></a><span class="sd"> raise PermissionDenied</span>
</span><span id="__span-0-101"><a id="__codelineno-0-101" name="__codelineno-0-101"></a><span class="sd"> ```</span>
</span><span id="__span-0-102"><a id="__codelineno-0-102" name="__codelineno-0-102"></a><span class="sd"> &quot;&quot;&quot;</span>
</span><span id="__span-0-103"><a id="__codelineno-0-103" name="__codelineno-0-103"></a> <span class="k">if</span> <span class="n">obj</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="n">user</span><span class="o">.</span><span class="n">can_edit</span><span class="p">(</span><span class="n">obj</span><span class="p">):</span>
</span><span id="__span-0-104"><a id="__codelineno-0-104" name="__codelineno-0-104"></a> <span class="k">return</span> <span class="kc">True</span>
</span><span id="__span-0-105"><a id="__codelineno-0-105" name="__codelineno-0-105"></a> <span class="k">return</span> <span class="n">can_edit_prop</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="n">user</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h2 id="core.views.can_view" class="doc doc-heading">
<code class="highlight language-python"><span class="n">can_view</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="n">user</span><span class="p">)</span></code>
<a href="#core.views.can_view" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p>Can the user see the object.</p>
<p><span class="doc-section-title">Parameters:</span></p>
<table>
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Description</th>
<th>Default</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code>obj</code>
</td>
<td>
<code><span title="typing.Any">Any</span></code>
</td>
<td>
<div class="doc-md-description">
<p>Object to test for permission</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
<tr class="doc-section-item">
<td>
<code>user</code>
</td>
<td>
<code><a class="autorefs autorefs-internal" title="core.views.user.User" href="../models/#core.models.User">User</a></code>
</td>
<td>
<div class="doc-md-description">
<p>core.models.User to test permissions against</p>
</div>
</td>
<td>
<em>required</em>
</td>
</tr>
</tbody>
</table>
<p><span class="doc-section-title">Returns:</span></p>
<table>
<thead>
<tr>
<th>Type</th>
<th>Description</th>
</tr>
</thead>
<tbody>
<tr class="doc-section-item">
<td>
<code>bool</code>
</td>
<td>
<div class="doc-md-description">
<p>True if user is authorized to see object else False</p>
</div>
</td>
</tr>
</tbody>
</table>
<p><span class="doc-section-title">Examples:</span></p>
<div class="language-python highlight"><pre><span></span><code><span id="__span-0-1"><a id="__codelineno-0-1" name="__codelineno-0-1" href="#__codelineno-0-1"></a><span class="k">if</span> <span class="ow">not</span> <span class="n">can_view</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">object</span> <span class="p">,</span><span class="n">request</span><span class="o">.</span><span class="n">user</span><span class="p">):</span>
</span><span id="__span-0-2"><a id="__codelineno-0-2" name="__codelineno-0-2" href="#__codelineno-0-2"></a> <span class="k">raise</span> <span class="n">PermissionDenied</span>
</span></code></pre></div>
<details class="quote">
<summary>Source code in <code>core/views/__init__.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-108">108</a></span>
<span class="normal"><a href="#__codelineno-0-109">109</a></span>
<span class="normal"><a href="#__codelineno-0-110">110</a></span>
<span class="normal"><a href="#__codelineno-0-111">111</a></span>
<span class="normal"><a href="#__codelineno-0-112">112</a></span>
<span class="normal"><a href="#__codelineno-0-113">113</a></span>
<span class="normal"><a href="#__codelineno-0-114">114</a></span>
<span class="normal"><a href="#__codelineno-0-115">115</a></span>
<span class="normal"><a href="#__codelineno-0-116">116</a></span>
<span class="normal"><a href="#__codelineno-0-117">117</a></span>
<span class="normal"><a href="#__codelineno-0-118">118</a></span>
<span class="normal"><a href="#__codelineno-0-119">119</a></span>
<span class="normal"><a href="#__codelineno-0-120">120</a></span>
<span class="normal"><a href="#__codelineno-0-121">121</a></span>
<span class="normal"><a href="#__codelineno-0-122">122</a></span>
<span class="normal"><a href="#__codelineno-0-123">123</a></span>
<span class="normal"><a href="#__codelineno-0-124">124</a></span>
<span class="normal"><a href="#__codelineno-0-125">125</a></span>
<span class="normal"><a href="#__codelineno-0-126">126</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-108"><a id="__codelineno-0-108" name="__codelineno-0-108"></a><span class="k">def</span> <span class="nf">can_view</span><span class="p">(</span><span class="n">obj</span><span class="p">:</span> <span class="n">Any</span><span class="p">,</span> <span class="n">user</span><span class="p">:</span> <span class="n">User</span><span class="p">)</span> <span class="o">-&gt;</span> <span class="nb">bool</span><span class="p">:</span>
</span><span id="__span-0-109"><a id="__codelineno-0-109" name="__codelineno-0-109"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Can the user see the object.</span>
</span><span id="__span-0-110"><a id="__codelineno-0-110" name="__codelineno-0-110"></a>
</span><span id="__span-0-111"><a id="__codelineno-0-111" name="__codelineno-0-111"></a><span class="sd"> Args:</span>
</span><span id="__span-0-112"><a id="__codelineno-0-112" name="__codelineno-0-112"></a><span class="sd"> obj: Object to test for permission</span>
</span><span id="__span-0-113"><a id="__codelineno-0-113" name="__codelineno-0-113"></a><span class="sd"> user: core.models.User to test permissions against</span>
</span><span id="__span-0-114"><a id="__codelineno-0-114" name="__codelineno-0-114"></a>
</span><span id="__span-0-115"><a id="__codelineno-0-115" name="__codelineno-0-115"></a><span class="sd"> Returns:</span>
</span><span id="__span-0-116"><a id="__codelineno-0-116" name="__codelineno-0-116"></a><span class="sd"> True if user is authorized to see object else False</span>
</span><span id="__span-0-117"><a id="__codelineno-0-117" name="__codelineno-0-117"></a>
</span><span id="__span-0-118"><a id="__codelineno-0-118" name="__codelineno-0-118"></a><span class="sd"> Examples:</span>
</span><span id="__span-0-119"><a id="__codelineno-0-119" name="__codelineno-0-119"></a><span class="sd"> ```python</span>
</span><span id="__span-0-120"><a id="__codelineno-0-120" name="__codelineno-0-120"></a><span class="sd"> if not can_view(self.object ,request.user):</span>
</span><span id="__span-0-121"><a id="__codelineno-0-121" name="__codelineno-0-121"></a><span class="sd"> raise PermissionDenied</span>
</span><span id="__span-0-122"><a id="__codelineno-0-122" name="__codelineno-0-122"></a><span class="sd"> ```</span>
</span><span id="__span-0-123"><a id="__codelineno-0-123" name="__codelineno-0-123"></a><span class="sd"> &quot;&quot;&quot;</span>
</span><span id="__span-0-124"><a id="__codelineno-0-124" name="__codelineno-0-124"></a> <span class="k">if</span> <span class="n">obj</span> <span class="ow">is</span> <span class="kc">None</span> <span class="ow">or</span> <span class="n">user</span><span class="o">.</span><span class="n">can_view</span><span class="p">(</span><span class="n">obj</span><span class="p">):</span>
</span><span id="__span-0-125"><a id="__codelineno-0-125" name="__codelineno-0-125"></a> <span class="k">return</span> <span class="kc">True</span>
</span><span id="__span-0-126"><a id="__codelineno-0-126" name="__codelineno-0-126"></a> <span class="k">return</span> <span class="n">can_edit</span><span class="p">(</span><span class="n">obj</span><span class="p">,</span> <span class="n">user</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h2 id="core.views.send_file" class="doc doc-heading">
<code class="highlight language-python"><span class="n">send_file</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">file_id</span><span class="p">,</span> <span class="n">file_class</span><span class="o">=</span><span class="n">SithFile</span><span class="p">,</span> <span class="n">file_attr</span><span class="o">=</span><span class="s1">&#39;file&#39;</span><span class="p">)</span></code>
<a href="#core.views.send_file" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p>Send a protected file, if the user can see it.</p>
<p>In prod, the server won't handle the download itself,
but set the appropriate headers in the response to make the reverse-proxy
deal with it.
In debug mode, the server will directly send the file.</p>
<details class="quote">
<summary>Source code in <code>core/views/files.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-51">51</a></span>
<span class="normal"><a href="#__codelineno-0-52">52</a></span>
<span class="normal"><a href="#__codelineno-0-53">53</a></span>
<span class="normal"><a href="#__codelineno-0-54">54</a></span>
<span class="normal"><a href="#__codelineno-0-55">55</a></span>
<span class="normal"><a href="#__codelineno-0-56">56</a></span>
<span class="normal"><a href="#__codelineno-0-57">57</a></span>
<span class="normal"><a href="#__codelineno-0-58">58</a></span>
<span class="normal"><a href="#__codelineno-0-59">59</a></span>
<span class="normal"><a href="#__codelineno-0-60">60</a></span>
<span class="normal"><a href="#__codelineno-0-61">61</a></span>
<span class="normal"><a href="#__codelineno-0-62">62</a></span>
<span class="normal"><a href="#__codelineno-0-63">63</a></span>
<span class="normal"><a href="#__codelineno-0-64">64</a></span>
<span class="normal"><a href="#__codelineno-0-65">65</a></span>
<span class="normal"><a href="#__codelineno-0-66">66</a></span>
<span class="normal"><a href="#__codelineno-0-67">67</a></span>
<span class="normal"><a href="#__codelineno-0-68">68</a></span>
<span class="normal"><a href="#__codelineno-0-69">69</a></span>
<span class="normal"><a href="#__codelineno-0-70">70</a></span>
<span class="normal"><a href="#__codelineno-0-71">71</a></span>
<span class="normal"><a href="#__codelineno-0-72">72</a></span>
<span class="normal"><a href="#__codelineno-0-73">73</a></span>
<span class="normal"><a href="#__codelineno-0-74">74</a></span>
<span class="normal"><a href="#__codelineno-0-75">75</a></span>
<span class="normal"><a href="#__codelineno-0-76">76</a></span>
<span class="normal"><a href="#__codelineno-0-77">77</a></span>
<span class="normal"><a href="#__codelineno-0-78">78</a></span>
<span class="normal"><a href="#__codelineno-0-79">79</a></span>
<span class="normal"><a href="#__codelineno-0-80">80</a></span>
<span class="normal"><a href="#__codelineno-0-81">81</a></span>
<span class="normal"><a href="#__codelineno-0-82">82</a></span>
<span class="normal"><a href="#__codelineno-0-83">83</a></span>
<span class="normal"><a href="#__codelineno-0-84">84</a></span>
<span class="normal"><a href="#__codelineno-0-85">85</a></span>
<span class="normal"><a href="#__codelineno-0-86">86</a></span>
<span class="normal"><a href="#__codelineno-0-87">87</a></span>
<span class="normal"><a href="#__codelineno-0-88">88</a></span>
<span class="normal"><a href="#__codelineno-0-89">89</a></span>
<span class="normal"><a href="#__codelineno-0-90">90</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-51"><a id="__codelineno-0-51" name="__codelineno-0-51"></a><span class="k">def</span> <span class="nf">send_file</span><span class="p">(</span>
</span><span id="__span-0-52"><a id="__codelineno-0-52" name="__codelineno-0-52"></a> <span class="n">request</span><span class="p">:</span> <span class="n">HttpRequest</span><span class="p">,</span>
</span><span id="__span-0-53"><a id="__codelineno-0-53" name="__codelineno-0-53"></a> <span class="n">file_id</span><span class="p">:</span> <span class="nb">int</span><span class="p">,</span>
</span><span id="__span-0-54"><a id="__codelineno-0-54" name="__codelineno-0-54"></a> <span class="n">file_class</span><span class="p">:</span> <span class="nb">type</span><span class="p">[</span><span class="n">SithFile</span><span class="p">]</span> <span class="o">=</span> <span class="n">SithFile</span><span class="p">,</span>
</span><span id="__span-0-55"><a id="__codelineno-0-55" name="__codelineno-0-55"></a> <span class="n">file_attr</span><span class="p">:</span> <span class="nb">str</span> <span class="o">=</span> <span class="s2">&quot;file&quot;</span><span class="p">,</span>
</span><span id="__span-0-56"><a id="__codelineno-0-56" name="__codelineno-0-56"></a><span class="p">)</span> <span class="o">-&gt;</span> <span class="n">HttpResponse</span><span class="p">:</span>
</span><span id="__span-0-57"><a id="__codelineno-0-57" name="__codelineno-0-57"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Send a protected file, if the user can see it.</span>
</span><span id="__span-0-58"><a id="__codelineno-0-58" name="__codelineno-0-58"></a>
</span><span id="__span-0-59"><a id="__codelineno-0-59" name="__codelineno-0-59"></a><span class="sd"> In prod, the server won&#39;t handle the download itself,</span>
</span><span id="__span-0-60"><a id="__codelineno-0-60" name="__codelineno-0-60"></a><span class="sd"> but set the appropriate headers in the response to make the reverse-proxy</span>
</span><span id="__span-0-61"><a id="__codelineno-0-61" name="__codelineno-0-61"></a><span class="sd"> deal with it.</span>
</span><span id="__span-0-62"><a id="__codelineno-0-62" name="__codelineno-0-62"></a><span class="sd"> In debug mode, the server will directly send the file.</span>
</span><span id="__span-0-63"><a id="__codelineno-0-63" name="__codelineno-0-63"></a><span class="sd"> &quot;&quot;&quot;</span>
</span><span id="__span-0-64"><a id="__codelineno-0-64" name="__codelineno-0-64"></a> <span class="n">f</span> <span class="o">=</span> <span class="n">get_object_or_404</span><span class="p">(</span><span class="n">file_class</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">file_id</span><span class="p">)</span>
</span><span id="__span-0-65"><a id="__codelineno-0-65" name="__codelineno-0-65"></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">can_view</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="n">request</span><span class="o">.</span><span class="n">user</span><span class="p">)</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">is_logged_in_counter</span><span class="p">(</span><span class="n">request</span><span class="p">):</span>
</span><span id="__span-0-66"><a id="__codelineno-0-66" name="__codelineno-0-66"></a> <span class="k">raise</span> <span class="n">PermissionDenied</span>
</span><span id="__span-0-67"><a id="__codelineno-0-67" name="__codelineno-0-67"></a> <span class="n">name</span> <span class="o">=</span> <span class="nb">getattr</span><span class="p">(</span><span class="n">f</span><span class="p">,</span> <span class="n">file_attr</span><span class="p">)</span><span class="o">.</span><span class="n">name</span>
</span><span id="__span-0-68"><a id="__codelineno-0-68" name="__codelineno-0-68"></a>
</span><span id="__span-0-69"><a id="__codelineno-0-69" name="__codelineno-0-69"></a> <span class="n">response</span> <span class="o">=</span> <span class="n">HttpResponse</span><span class="p">(</span>
</span><span id="__span-0-70"><a id="__codelineno-0-70" name="__codelineno-0-70"></a> <span class="n">headers</span><span class="o">=</span><span class="p">{</span><span class="s2">&quot;Content-Disposition&quot;</span><span class="p">:</span> <span class="sa">f</span><span class="s1">&#39;inline; filename=&quot;</span><span class="si">{</span><span class="n">quote</span><span class="p">(</span><span class="n">name</span><span class="p">)</span><span class="si">}</span><span class="s1">&quot;&#39;</span><span class="p">}</span>
</span><span id="__span-0-71"><a id="__codelineno-0-71" name="__codelineno-0-71"></a> <span class="p">)</span>
</span><span id="__span-0-72"><a id="__codelineno-0-72" name="__codelineno-0-72"></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">settings</span><span class="o">.</span><span class="n">DEBUG</span><span class="p">:</span>
</span><span id="__span-0-73"><a id="__codelineno-0-73" name="__codelineno-0-73"></a> <span class="c1"># When receiving a response with the Accel-Redirect header,</span>
</span><span id="__span-0-74"><a id="__codelineno-0-74" name="__codelineno-0-74"></a> <span class="c1"># the reverse proxy will automatically handle the file sending.</span>
</span><span id="__span-0-75"><a id="__codelineno-0-75" name="__codelineno-0-75"></a> <span class="c1"># This is really hard to test (thus isn&#39;t tested)</span>
</span><span id="__span-0-76"><a id="__codelineno-0-76" name="__codelineno-0-76"></a> <span class="c1"># so please do not mess with this.</span>
</span><span id="__span-0-77"><a id="__codelineno-0-77" name="__codelineno-0-77"></a> <span class="n">response</span><span class="p">[</span><span class="s2">&quot;Content-Type&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="s2">&quot;&quot;</span> <span class="c1"># automatically set by nginx</span>
</span><span id="__span-0-78"><a id="__codelineno-0-78" name="__codelineno-0-78"></a> <span class="n">response</span><span class="p">[</span><span class="s2">&quot;X-Accel-Redirect&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">quote</span><span class="p">(</span><span class="n">urljoin</span><span class="p">(</span><span class="n">settings</span><span class="o">.</span><span class="n">MEDIA_URL</span><span class="p">,</span> <span class="n">name</span><span class="p">))</span>
</span><span id="__span-0-79"><a id="__codelineno-0-79" name="__codelineno-0-79"></a> <span class="k">return</span> <span class="n">response</span>
</span><span id="__span-0-80"><a id="__codelineno-0-80" name="__codelineno-0-80"></a>
</span><span id="__span-0-81"><a id="__codelineno-0-81" name="__codelineno-0-81"></a> <span class="n">filepath</span> <span class="o">=</span> <span class="n">settings</span><span class="o">.</span><span class="n">MEDIA_ROOT</span> <span class="o">/</span> <span class="n">name</span>
</span><span id="__span-0-82"><a id="__codelineno-0-82" name="__codelineno-0-82"></a> <span class="c1"># check if file exists on disk</span>
</span><span id="__span-0-83"><a id="__codelineno-0-83" name="__codelineno-0-83"></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">filepath</span><span class="o">.</span><span class="n">exists</span><span class="p">():</span>
</span><span id="__span-0-84"><a id="__codelineno-0-84" name="__codelineno-0-84"></a> <span class="k">raise</span> <span class="n">Http404</span>
</span><span id="__span-0-85"><a id="__codelineno-0-85" name="__codelineno-0-85"></a> <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="n">filepath</span><span class="p">,</span> <span class="s2">&quot;rb&quot;</span><span class="p">)</span> <span class="k">as</span> <span class="n">filename</span><span class="p">:</span>
</span><span id="__span-0-86"><a id="__codelineno-0-86" name="__codelineno-0-86"></a> <span class="n">response</span><span class="o">.</span><span class="n">content</span> <span class="o">=</span> <span class="n">FileWrapper</span><span class="p">(</span><span class="n">filename</span><span class="p">)</span>
</span><span id="__span-0-87"><a id="__codelineno-0-87" name="__codelineno-0-87"></a> <span class="n">response</span><span class="p">[</span><span class="s2">&quot;Content-Type&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">mimetypes</span><span class="o">.</span><span class="n">guess_type</span><span class="p">(</span><span class="n">filepath</span><span class="p">)[</span><span class="mi">0</span><span class="p">]</span>
</span><span id="__span-0-88"><a id="__codelineno-0-88" name="__codelineno-0-88"></a> <span class="n">response</span><span class="p">[</span><span class="s2">&quot;Last-Modified&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">http_date</span><span class="p">(</span><span class="n">f</span><span class="o">.</span><span class="n">date</span><span class="o">.</span><span class="n">timestamp</span><span class="p">())</span>
</span><span id="__span-0-89"><a id="__codelineno-0-89" name="__codelineno-0-89"></a> <span class="n">response</span><span class="p">[</span><span class="s2">&quot;Content-Length&quot;</span><span class="p">]</span> <span class="o">=</span> <span class="n">filepath</span><span class="o">.</span><span class="n">stat</span><span class="p">()</span><span class="o">.</span><span class="n">st_size</span>
</span><span id="__span-0-90"><a id="__codelineno-0-90" name="__codelineno-0-90"></a> <span class="k">return</span> <span class="n">response</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h2 id="core.views.index" class="doc doc-heading">
<code class="highlight language-python"><span class="n">index</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">context</span><span class="o">=</span><span class="kc">None</span><span class="p">)</span></code>
<a href="#core.views.index" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<details class="quote">
<summary>Source code in <code>core/views/site.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-42">42</a></span>
<span class="normal"><a href="#__codelineno-0-43">43</a></span>
<span class="normal"><a href="#__codelineno-0-44">44</a></span>
<span class="normal"><a href="#__codelineno-0-45">45</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-42"><a id="__codelineno-0-42" name="__codelineno-0-42"></a><span class="k">def</span> <span class="nf">index</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">context</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span>
</span><span id="__span-0-43"><a id="__codelineno-0-43" name="__codelineno-0-43"></a> <span class="kn">from</span> <span class="nn">com.views</span> <span class="kn">import</span> <span class="n">NewsListView</span>
</span><span id="__span-0-44"><a id="__codelineno-0-44" name="__codelineno-0-44"></a>
</span><span id="__span-0-45"><a id="__codelineno-0-45" name="__codelineno-0-45"></a> <span class="k">return</span> <span class="n">NewsListView</span><span class="o">.</span><span class="n">as_view</span><span class="p">()(</span><span class="n">request</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h2 id="core.views.notification" class="doc doc-heading">
<code class="highlight language-python"><span class="n">notification</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">notif_id</span><span class="p">)</span></code>
<a href="#core.views.notification" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<details class="quote">
<summary>Source code in <code>core/views/site.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-61">61</a></span>
<span class="normal"><a href="#__codelineno-0-62">62</a></span>
<span class="normal"><a href="#__codelineno-0-63">63</a></span>
<span class="normal"><a href="#__codelineno-0-64">64</a></span>
<span class="normal"><a href="#__codelineno-0-65">65</a></span>
<span class="normal"><a href="#__codelineno-0-66">66</a></span>
<span class="normal"><a href="#__codelineno-0-67">67</a></span>
<span class="normal"><a href="#__codelineno-0-68">68</a></span>
<span class="normal"><a href="#__codelineno-0-69">69</a></span>
<span class="normal"><a href="#__codelineno-0-70">70</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-61"><a id="__codelineno-0-61" name="__codelineno-0-61"></a><span class="k">def</span> <span class="nf">notification</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">notif_id</span><span class="p">):</span>
</span><span id="__span-0-62"><a id="__codelineno-0-62" name="__codelineno-0-62"></a> <span class="n">notif</span> <span class="o">=</span> <span class="n">Notification</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="nb">id</span><span class="o">=</span><span class="n">notif_id</span><span class="p">)</span><span class="o">.</span><span class="n">first</span><span class="p">()</span>
</span><span id="__span-0-63"><a id="__codelineno-0-63" name="__codelineno-0-63"></a> <span class="k">if</span> <span class="n">notif</span><span class="p">:</span>
</span><span id="__span-0-64"><a id="__codelineno-0-64" name="__codelineno-0-64"></a> <span class="k">if</span> <span class="n">notif</span><span class="o">.</span><span class="n">type</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">settings</span><span class="o">.</span><span class="n">SITH_PERMANENT_NOTIFICATIONS</span><span class="p">:</span>
</span><span id="__span-0-65"><a id="__codelineno-0-65" name="__codelineno-0-65"></a> <span class="n">notif</span><span class="o">.</span><span class="n">viewed</span> <span class="o">=</span> <span class="kc">True</span>
</span><span id="__span-0-66"><a id="__codelineno-0-66" name="__codelineno-0-66"></a> <span class="k">else</span><span class="p">:</span>
</span><span id="__span-0-67"><a id="__codelineno-0-67" name="__codelineno-0-67"></a> <span class="n">notif</span><span class="o">.</span><span class="n">callback</span><span class="p">()</span>
</span><span id="__span-0-68"><a id="__codelineno-0-68" name="__codelineno-0-68"></a> <span class="n">notif</span><span class="o">.</span><span class="n">save</span><span class="p">()</span>
</span><span id="__span-0-69"><a id="__codelineno-0-69" name="__codelineno-0-69"></a> <span class="k">return</span> <span class="n">redirect</span><span class="p">(</span><span class="n">notif</span><span class="o">.</span><span class="n">url</span><span class="p">)</span>
</span><span id="__span-0-70"><a id="__codelineno-0-70" name="__codelineno-0-70"></a> <span class="k">return</span> <span class="n">redirect</span><span class="p">(</span><span class="s2">&quot;/&quot;</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h2 id="core.views.search_user" class="doc doc-heading">
<code class="highlight language-python"><span class="n">search_user</span><span class="p">(</span><span class="n">query</span><span class="p">)</span></code>
<a href="#core.views.search_user" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<details class="quote">
<summary>Source code in <code>core/views/site.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-73">73</a></span>
<span class="normal"><a href="#__codelineno-0-74">74</a></span>
<span class="normal"><a href="#__codelineno-0-75">75</a></span>
<span class="normal"><a href="#__codelineno-0-76">76</a></span>
<span class="normal"><a href="#__codelineno-0-77">77</a></span>
<span class="normal"><a href="#__codelineno-0-78">78</a></span>
<span class="normal"><a href="#__codelineno-0-79">79</a></span>
<span class="normal"><a href="#__codelineno-0-80">80</a></span>
<span class="normal"><a href="#__codelineno-0-81">81</a></span>
<span class="normal"><a href="#__codelineno-0-82">82</a></span>
<span class="normal"><a href="#__codelineno-0-83">83</a></span>
<span class="normal"><a href="#__codelineno-0-84">84</a></span>
<span class="normal"><a href="#__codelineno-0-85">85</a></span>
<span class="normal"><a href="#__codelineno-0-86">86</a></span>
<span class="normal"><a href="#__codelineno-0-87">87</a></span>
<span class="normal"><a href="#__codelineno-0-88">88</a></span>
<span class="normal"><a href="#__codelineno-0-89">89</a></span>
<span class="normal"><a href="#__codelineno-0-90">90</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-73"><a id="__codelineno-0-73" name="__codelineno-0-73"></a><span class="k">def</span> <span class="nf">search_user</span><span class="p">(</span><span class="n">query</span><span class="p">):</span>
</span><span id="__span-0-74"><a id="__codelineno-0-74" name="__codelineno-0-74"></a> <span class="k">try</span><span class="p">:</span>
</span><span id="__span-0-75"><a id="__codelineno-0-75" name="__codelineno-0-75"></a> <span class="c1"># slugify turns everything into ascii and every whitespace into -</span>
</span><span id="__span-0-76"><a id="__codelineno-0-76" name="__codelineno-0-76"></a> <span class="c1"># it ends by removing duplicate - (so &#39; - &#39; will turn into &#39;-&#39;)</span>
</span><span id="__span-0-77"><a id="__codelineno-0-77" name="__codelineno-0-77"></a> <span class="c1"># replace(&#39;-&#39;, &#39; &#39;) because search is whitespace based</span>
</span><span id="__span-0-78"><a id="__codelineno-0-78" name="__codelineno-0-78"></a> <span class="n">query</span> <span class="o">=</span> <span class="n">slugify</span><span class="p">(</span><span class="n">query</span><span class="p">)</span><span class="o">.</span><span class="n">replace</span><span class="p">(</span><span class="s2">&quot;-&quot;</span><span class="p">,</span> <span class="s2">&quot; &quot;</span><span class="p">)</span>
</span><span id="__span-0-79"><a id="__codelineno-0-79" name="__codelineno-0-79"></a> <span class="c1"># TODO: is this necessary?</span>
</span><span id="__span-0-80"><a id="__codelineno-0-80" name="__codelineno-0-80"></a> <span class="n">query</span> <span class="o">=</span> <span class="n">html</span><span class="o">.</span><span class="n">escape</span><span class="p">(</span><span class="n">query</span><span class="p">)</span>
</span><span id="__span-0-81"><a id="__codelineno-0-81" name="__codelineno-0-81"></a> <span class="n">res</span> <span class="o">=</span> <span class="p">(</span>
</span><span id="__span-0-82"><a id="__codelineno-0-82" name="__codelineno-0-82"></a> <span class="n">SearchQuerySet</span><span class="p">()</span>
</span><span id="__span-0-83"><a id="__codelineno-0-83" name="__codelineno-0-83"></a> <span class="o">.</span><span class="n">models</span><span class="p">(</span><span class="n">User</span><span class="p">)</span>
</span><span id="__span-0-84"><a id="__codelineno-0-84" name="__codelineno-0-84"></a> <span class="o">.</span><span class="n">autocomplete</span><span class="p">(</span><span class="n">auto</span><span class="o">=</span><span class="n">query</span><span class="p">)</span>
</span><span id="__span-0-85"><a id="__codelineno-0-85" name="__codelineno-0-85"></a> <span class="o">.</span><span class="n">order_by</span><span class="p">(</span><span class="s2">&quot;-last_login&quot;</span><span class="p">)</span>
</span><span id="__span-0-86"><a id="__codelineno-0-86" name="__codelineno-0-86"></a> <span class="o">.</span><span class="n">load_all</span><span class="p">()[:</span><span class="mi">20</span><span class="p">]</span>
</span><span id="__span-0-87"><a id="__codelineno-0-87" name="__codelineno-0-87"></a> <span class="p">)</span>
</span><span id="__span-0-88"><a id="__codelineno-0-88" name="__codelineno-0-88"></a> <span class="k">return</span> <span class="p">[</span><span class="n">r</span><span class="o">.</span><span class="n">object</span> <span class="k">for</span> <span class="n">r</span> <span class="ow">in</span> <span class="n">res</span><span class="p">]</span>
</span><span id="__span-0-89"><a id="__codelineno-0-89" name="__codelineno-0-89"></a> <span class="k">except</span> <span class="ne">TypeError</span><span class="p">:</span>
</span><span id="__span-0-90"><a id="__codelineno-0-90" name="__codelineno-0-90"></a> <span class="k">return</span> <span class="p">[]</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h2 id="core.views.search_club" class="doc doc-heading">
<code class="highlight language-python"><span class="n">search_club</span><span class="p">(</span><span class="n">query</span><span class="p">,</span> <span class="o">*</span><span class="p">,</span> <span class="n">as_json</span><span class="o">=</span><span class="kc">False</span><span class="p">)</span></code>
<a href="#core.views.search_club" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<details class="quote">
<summary>Source code in <code>core/views/site.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-93"> 93</a></span>
<span class="normal"><a href="#__codelineno-0-94"> 94</a></span>
<span class="normal"><a href="#__codelineno-0-95"> 95</a></span>
<span class="normal"><a href="#__codelineno-0-96"> 96</a></span>
<span class="normal"><a href="#__codelineno-0-97"> 97</a></span>
<span class="normal"><a href="#__codelineno-0-98"> 98</a></span>
<span class="normal"><a href="#__codelineno-0-99"> 99</a></span>
<span class="normal"><a href="#__codelineno-0-100">100</a></span>
<span class="normal"><a href="#__codelineno-0-101">101</a></span>
<span class="normal"><a href="#__codelineno-0-102">102</a></span>
<span class="normal"><a href="#__codelineno-0-103">103</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-93"><a id="__codelineno-0-93" name="__codelineno-0-93"></a><span class="k">def</span> <span class="nf">search_club</span><span class="p">(</span><span class="n">query</span><span class="p">,</span> <span class="o">*</span><span class="p">,</span> <span class="n">as_json</span><span class="o">=</span><span class="kc">False</span><span class="p">):</span>
</span><span id="__span-0-94"><a id="__codelineno-0-94" name="__codelineno-0-94"></a> <span class="n">clubs</span> <span class="o">=</span> <span class="p">[]</span>
</span><span id="__span-0-95"><a id="__codelineno-0-95" name="__codelineno-0-95"></a> <span class="k">if</span> <span class="n">query</span><span class="p">:</span>
</span><span id="__span-0-96"><a id="__codelineno-0-96" name="__codelineno-0-96"></a> <span class="n">clubs</span> <span class="o">=</span> <span class="n">Club</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="n">name__icontains</span><span class="o">=</span><span class="n">query</span><span class="p">)</span><span class="o">.</span><span class="n">all</span><span class="p">()</span>
</span><span id="__span-0-97"><a id="__codelineno-0-97" name="__codelineno-0-97"></a> <span class="n">clubs</span> <span class="o">=</span> <span class="n">clubs</span><span class="p">[:</span><span class="mi">5</span><span class="p">]</span>
</span><span id="__span-0-98"><a id="__codelineno-0-98" name="__codelineno-0-98"></a> <span class="k">if</span> <span class="n">as_json</span><span class="p">:</span>
</span><span id="__span-0-99"><a id="__codelineno-0-99" name="__codelineno-0-99"></a> <span class="c1"># Re-loads json to avoid double encoding by JsonResponse, but still benefit from serializers</span>
</span><span id="__span-0-100"><a id="__codelineno-0-100" name="__codelineno-0-100"></a> <span class="n">clubs</span> <span class="o">=</span> <span class="n">json</span><span class="o">.</span><span class="n">loads</span><span class="p">(</span><span class="n">serializers</span><span class="o">.</span><span class="n">serialize</span><span class="p">(</span><span class="s2">&quot;json&quot;</span><span class="p">,</span> <span class="n">clubs</span><span class="p">,</span> <span class="n">fields</span><span class="o">=</span><span class="p">(</span><span class="s2">&quot;name&quot;</span><span class="p">)))</span>
</span><span id="__span-0-101"><a id="__codelineno-0-101" name="__codelineno-0-101"></a> <span class="k">else</span><span class="p">:</span>
</span><span id="__span-0-102"><a id="__codelineno-0-102" name="__codelineno-0-102"></a> <span class="n">clubs</span> <span class="o">=</span> <span class="nb">list</span><span class="p">(</span><span class="n">clubs</span><span class="p">)</span>
</span><span id="__span-0-103"><a id="__codelineno-0-103" name="__codelineno-0-103"></a> <span class="k">return</span> <span class="n">clubs</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h2 id="core.views.search_view" class="doc doc-heading">
<code class="highlight language-python"><span class="n">search_view</span><span class="p">(</span><span class="n">request</span><span class="p">)</span></code>
<a href="#core.views.search_view" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<details class="quote">
<summary>Source code in <code>core/views/site.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-106">106</a></span>
<span class="normal"><a href="#__codelineno-0-107">107</a></span>
<span class="normal"><a href="#__codelineno-0-108">108</a></span>
<span class="normal"><a href="#__codelineno-0-109">109</a></span>
<span class="normal"><a href="#__codelineno-0-110">110</a></span>
<span class="normal"><a href="#__codelineno-0-111">111</a></span>
<span class="normal"><a href="#__codelineno-0-112">112</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-106"><a id="__codelineno-0-106" name="__codelineno-0-106"></a><span class="nd">@login_required</span>
</span><span id="__span-0-107"><a id="__codelineno-0-107" name="__codelineno-0-107"></a><span class="k">def</span> <span class="nf">search_view</span><span class="p">(</span><span class="n">request</span><span class="p">):</span>
</span><span id="__span-0-108"><a id="__codelineno-0-108" name="__codelineno-0-108"></a> <span class="n">result</span> <span class="o">=</span> <span class="p">{</span>
</span><span id="__span-0-109"><a id="__codelineno-0-109" name="__codelineno-0-109"></a> <span class="s2">&quot;users&quot;</span><span class="p">:</span> <span class="n">search_user</span><span class="p">(</span><span class="n">request</span><span class="o">.</span><span class="n">GET</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;query&quot;</span><span class="p">,</span> <span class="s2">&quot;&quot;</span><span class="p">)),</span>
</span><span id="__span-0-110"><a id="__codelineno-0-110" name="__codelineno-0-110"></a> <span class="s2">&quot;clubs&quot;</span><span class="p">:</span> <span class="n">search_club</span><span class="p">(</span><span class="n">request</span><span class="o">.</span><span class="n">GET</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;query&quot;</span><span class="p">,</span> <span class="s2">&quot;&quot;</span><span class="p">)),</span>
</span><span id="__span-0-111"><a id="__codelineno-0-111" name="__codelineno-0-111"></a> <span class="p">}</span>
</span><span id="__span-0-112"><a id="__codelineno-0-112" name="__codelineno-0-112"></a> <span class="k">return</span> <span class="n">render</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="s2">&quot;core/search.jinja&quot;</span><span class="p">,</span> <span class="n">context</span><span class="o">=</span><span class="p">{</span><span class="s2">&quot;result&quot;</span><span class="p">:</span> <span class="n">result</span><span class="p">})</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h2 id="core.views.search_user_json" class="doc doc-heading">
<code class="highlight language-python"><span class="n">search_user_json</span><span class="p">(</span><span class="n">request</span><span class="p">)</span></code>
<a href="#core.views.search_user_json" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<details class="quote">
<summary>Source code in <code>core/views/site.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-115">115</a></span>
<span class="normal"><a href="#__codelineno-0-116">116</a></span>
<span class="normal"><a href="#__codelineno-0-117">117</a></span>
<span class="normal"><a href="#__codelineno-0-118">118</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-115"><a id="__codelineno-0-115" name="__codelineno-0-115"></a><span class="nd">@login_required</span>
</span><span id="__span-0-116"><a id="__codelineno-0-116" name="__codelineno-0-116"></a><span class="k">def</span> <span class="nf">search_user_json</span><span class="p">(</span><span class="n">request</span><span class="p">):</span>
</span><span id="__span-0-117"><a id="__codelineno-0-117" name="__codelineno-0-117"></a> <span class="n">result</span> <span class="o">=</span> <span class="p">{</span><span class="s2">&quot;users&quot;</span><span class="p">:</span> <span class="n">search_user</span><span class="p">(</span><span class="n">request</span><span class="o">.</span><span class="n">GET</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;query&quot;</span><span class="p">,</span> <span class="s2">&quot;&quot;</span><span class="p">))}</span>
</span><span id="__span-0-118"><a id="__codelineno-0-118" name="__codelineno-0-118"></a> <span class="k">return</span> <span class="n">JsonResponse</span><span class="p">(</span><span class="n">result</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h2 id="core.views.search_json" class="doc doc-heading">
<code class="highlight language-python"><span class="n">search_json</span><span class="p">(</span><span class="n">request</span><span class="p">)</span></code>
<a href="#core.views.search_json" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<details class="quote">
<summary>Source code in <code>core/views/site.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-121">121</a></span>
<span class="normal"><a href="#__codelineno-0-122">122</a></span>
<span class="normal"><a href="#__codelineno-0-123">123</a></span>
<span class="normal"><a href="#__codelineno-0-124">124</a></span>
<span class="normal"><a href="#__codelineno-0-125">125</a></span>
<span class="normal"><a href="#__codelineno-0-126">126</a></span>
<span class="normal"><a href="#__codelineno-0-127">127</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-121"><a id="__codelineno-0-121" name="__codelineno-0-121"></a><span class="nd">@login_required</span>
</span><span id="__span-0-122"><a id="__codelineno-0-122" name="__codelineno-0-122"></a><span class="k">def</span> <span class="nf">search_json</span><span class="p">(</span><span class="n">request</span><span class="p">):</span>
</span><span id="__span-0-123"><a id="__codelineno-0-123" name="__codelineno-0-123"></a> <span class="n">result</span> <span class="o">=</span> <span class="p">{</span>
</span><span id="__span-0-124"><a id="__codelineno-0-124" name="__codelineno-0-124"></a> <span class="s2">&quot;users&quot;</span><span class="p">:</span> <span class="n">search_user</span><span class="p">(</span><span class="n">request</span><span class="o">.</span><span class="n">GET</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;query&quot;</span><span class="p">,</span> <span class="s2">&quot;&quot;</span><span class="p">)),</span>
</span><span id="__span-0-125"><a id="__codelineno-0-125" name="__codelineno-0-125"></a> <span class="s2">&quot;clubs&quot;</span><span class="p">:</span> <span class="n">search_club</span><span class="p">(</span><span class="n">request</span><span class="o">.</span><span class="n">GET</span><span class="o">.</span><span class="n">get</span><span class="p">(</span><span class="s2">&quot;query&quot;</span><span class="p">,</span> <span class="s2">&quot;&quot;</span><span class="p">),</span> <span class="n">as_json</span><span class="o">=</span><span class="kc">True</span><span class="p">),</span>
</span><span id="__span-0-126"><a id="__codelineno-0-126" name="__codelineno-0-126"></a> <span class="p">}</span>
</span><span id="__span-0-127"><a id="__codelineno-0-127" name="__codelineno-0-127"></a> <span class="k">return</span> <span class="n">JsonResponse</span><span class="p">(</span><span class="n">result</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h2 id="core.views.logout" class="doc doc-heading">
<code class="highlight language-python"><span class="n">logout</span><span class="p">(</span><span class="n">request</span><span class="p">)</span></code>
<a href="#core.views.logout" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p>The logout view.</p>
<details class="quote">
<summary>Source code in <code>core/views/user.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-102">102</a></span>
<span class="normal"><a href="#__codelineno-0-103">103</a></span>
<span class="normal"><a href="#__codelineno-0-104">104</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-102"><a id="__codelineno-0-102" name="__codelineno-0-102"></a><span class="k">def</span> <span class="nf">logout</span><span class="p">(</span><span class="n">request</span><span class="p">):</span>
</span><span id="__span-0-103"><a id="__codelineno-0-103" name="__codelineno-0-103"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;The logout view.&quot;&quot;&quot;</span>
</span><span id="__span-0-104"><a id="__codelineno-0-104" name="__codelineno-0-104"></a> <span class="k">return</span> <span class="n">views</span><span class="o">.</span><span class="n">logout_then_login</span><span class="p">(</span><span class="n">request</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h2 id="core.views.password_root_change" class="doc doc-heading">
<code class="highlight language-python"><span class="n">password_root_change</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">user_id</span><span class="p">)</span></code>
<a href="#core.views.password_root_change" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<p>Allows a root user to change someone's password.</p>
<details class="quote">
<summary>Source code in <code>core/views/user.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-107">107</a></span>
<span class="normal"><a href="#__codelineno-0-108">108</a></span>
<span class="normal"><a href="#__codelineno-0-109">109</a></span>
<span class="normal"><a href="#__codelineno-0-110">110</a></span>
<span class="normal"><a href="#__codelineno-0-111">111</a></span>
<span class="normal"><a href="#__codelineno-0-112">112</a></span>
<span class="normal"><a href="#__codelineno-0-113">113</a></span>
<span class="normal"><a href="#__codelineno-0-114">114</a></span>
<span class="normal"><a href="#__codelineno-0-115">115</a></span>
<span class="normal"><a href="#__codelineno-0-116">116</a></span>
<span class="normal"><a href="#__codelineno-0-117">117</a></span>
<span class="normal"><a href="#__codelineno-0-118">118</a></span>
<span class="normal"><a href="#__codelineno-0-119">119</a></span>
<span class="normal"><a href="#__codelineno-0-120">120</a></span>
<span class="normal"><a href="#__codelineno-0-121">121</a></span>
<span class="normal"><a href="#__codelineno-0-122">122</a></span>
<span class="normal"><a href="#__codelineno-0-123">123</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-107"><a id="__codelineno-0-107" name="__codelineno-0-107"></a><span class="k">def</span> <span class="nf">password_root_change</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">user_id</span><span class="p">):</span>
</span><span id="__span-0-108"><a id="__codelineno-0-108" name="__codelineno-0-108"></a><span class="w"> </span><span class="sd">&quot;&quot;&quot;Allows a root user to change someone&#39;s password.&quot;&quot;&quot;</span>
</span><span id="__span-0-109"><a id="__codelineno-0-109" name="__codelineno-0-109"></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">request</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">is_root</span><span class="p">:</span>
</span><span id="__span-0-110"><a id="__codelineno-0-110" name="__codelineno-0-110"></a> <span class="k">raise</span> <span class="n">PermissionDenied</span>
</span><span id="__span-0-111"><a id="__codelineno-0-111" name="__codelineno-0-111"></a> <span class="n">user</span> <span class="o">=</span> <span class="n">User</span><span class="o">.</span><span class="n">objects</span><span class="o">.</span><span class="n">filter</span><span class="p">(</span><span class="nb">id</span><span class="o">=</span><span class="n">user_id</span><span class="p">)</span><span class="o">.</span><span class="n">first</span><span class="p">()</span>
</span><span id="__span-0-112"><a id="__codelineno-0-112" name="__codelineno-0-112"></a> <span class="k">if</span> <span class="ow">not</span> <span class="n">user</span><span class="p">:</span>
</span><span id="__span-0-113"><a id="__codelineno-0-113" name="__codelineno-0-113"></a> <span class="k">raise</span> <span class="n">Http404</span><span class="p">(</span><span class="s2">&quot;User not found&quot;</span><span class="p">)</span>
</span><span id="__span-0-114"><a id="__codelineno-0-114" name="__codelineno-0-114"></a> <span class="k">if</span> <span class="n">request</span><span class="o">.</span><span class="n">method</span> <span class="o">==</span> <span class="s2">&quot;POST&quot;</span><span class="p">:</span>
</span><span id="__span-0-115"><a id="__codelineno-0-115" name="__codelineno-0-115"></a> <span class="n">form</span> <span class="o">=</span> <span class="n">views</span><span class="o">.</span><span class="n">SetPasswordForm</span><span class="p">(</span><span class="n">user</span><span class="o">=</span><span class="n">user</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="n">request</span><span class="o">.</span><span class="n">POST</span><span class="p">)</span>
</span><span id="__span-0-116"><a id="__codelineno-0-116" name="__codelineno-0-116"></a> <span class="k">if</span> <span class="n">form</span><span class="o">.</span><span class="n">is_valid</span><span class="p">():</span>
</span><span id="__span-0-117"><a id="__codelineno-0-117" name="__codelineno-0-117"></a> <span class="n">form</span><span class="o">.</span><span class="n">save</span><span class="p">()</span>
</span><span id="__span-0-118"><a id="__codelineno-0-118" name="__codelineno-0-118"></a> <span class="k">return</span> <span class="n">redirect</span><span class="p">(</span><span class="s2">&quot;core:password_change_done&quot;</span><span class="p">)</span>
</span><span id="__span-0-119"><a id="__codelineno-0-119" name="__codelineno-0-119"></a> <span class="k">else</span><span class="p">:</span>
</span><span id="__span-0-120"><a id="__codelineno-0-120" name="__codelineno-0-120"></a> <span class="n">form</span> <span class="o">=</span> <span class="n">views</span><span class="o">.</span><span class="n">SetPasswordForm</span><span class="p">(</span><span class="n">user</span><span class="o">=</span><span class="n">user</span><span class="p">)</span>
</span><span id="__span-0-121"><a id="__codelineno-0-121" name="__codelineno-0-121"></a> <span class="k">return</span> <span class="n">TemplateResponse</span><span class="p">(</span>
</span><span id="__span-0-122"><a id="__codelineno-0-122" name="__codelineno-0-122"></a> <span class="n">request</span><span class="p">,</span> <span class="s2">&quot;core/password_change.jinja&quot;</span><span class="p">,</span> <span class="p">{</span><span class="s2">&quot;form&quot;</span><span class="p">:</span> <span class="n">form</span><span class="p">,</span> <span class="s2">&quot;target&quot;</span><span class="p">:</span> <span class="n">user</span><span class="p">}</span>
</span><span id="__span-0-123"><a id="__codelineno-0-123" name="__codelineno-0-123"></a> <span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
<div class="doc doc-object doc-function">
<h2 id="core.views.delete_user_godfather" class="doc doc-heading">
<code class="highlight language-python"><span class="n">delete_user_godfather</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">user_id</span><span class="p">,</span> <span class="n">godfather_id</span><span class="p">,</span> <span class="n">is_father</span><span class="p">)</span></code>
<a href="#core.views.delete_user_godfather" class="headerlink" title="Permanent link">&para;</a></h2>
<div class="doc doc-contents ">
<details class="quote">
<summary>Source code in <code>core/views/user.py</code></summary>
<div class="language-python highlight"><table class="highlighttable"><tr><td class="linenos"><div class="linenodiv"><pre><span></span><span class="normal"><a href="#__codelineno-0-316">316</a></span>
<span class="normal"><a href="#__codelineno-0-317">317</a></span>
<span class="normal"><a href="#__codelineno-0-318">318</a></span>
<span class="normal"><a href="#__codelineno-0-319">319</a></span>
<span class="normal"><a href="#__codelineno-0-320">320</a></span>
<span class="normal"><a href="#__codelineno-0-321">321</a></span>
<span class="normal"><a href="#__codelineno-0-322">322</a></span>
<span class="normal"><a href="#__codelineno-0-323">323</a></span>
<span class="normal"><a href="#__codelineno-0-324">324</a></span>
<span class="normal"><a href="#__codelineno-0-325">325</a></span>
<span class="normal"><a href="#__codelineno-0-326">326</a></span></pre></div></td><td class="code"><div><pre><span></span><code><span id="__span-0-316"><a id="__codelineno-0-316" name="__codelineno-0-316"></a><span class="k">def</span> <span class="nf">delete_user_godfather</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">user_id</span><span class="p">,</span> <span class="n">godfather_id</span><span class="p">,</span> <span class="n">is_father</span><span class="p">):</span>
</span><span id="__span-0-317"><a id="__codelineno-0-317" name="__codelineno-0-317"></a> <span class="n">user_is_admin</span> <span class="o">=</span> <span class="n">request</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">is_root</span> <span class="ow">or</span> <span class="n">request</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">is_board_member</span>
</span><span id="__span-0-318"><a id="__codelineno-0-318" name="__codelineno-0-318"></a> <span class="k">if</span> <span class="n">user_id</span> <span class="o">!=</span> <span class="n">request</span><span class="o">.</span><span class="n">user</span><span class="o">.</span><span class="n">id</span> <span class="ow">and</span> <span class="ow">not</span> <span class="n">user_is_admin</span><span class="p">:</span>
</span><span id="__span-0-319"><a id="__codelineno-0-319" name="__codelineno-0-319"></a> <span class="k">raise</span> <span class="n">PermissionDenied</span><span class="p">()</span>
</span><span id="__span-0-320"><a id="__codelineno-0-320" name="__codelineno-0-320"></a> <span class="n">user</span> <span class="o">=</span> <span class="n">get_object_or_404</span><span class="p">(</span><span class="n">User</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">user_id</span><span class="p">)</span>
</span><span id="__span-0-321"><a id="__codelineno-0-321" name="__codelineno-0-321"></a> <span class="n">to_remove</span> <span class="o">=</span> <span class="n">get_object_or_404</span><span class="p">(</span><span class="n">User</span><span class="p">,</span> <span class="nb">id</span><span class="o">=</span><span class="n">godfather_id</span><span class="p">)</span>
</span><span id="__span-0-322"><a id="__codelineno-0-322" name="__codelineno-0-322"></a> <span class="k">if</span> <span class="n">is_father</span><span class="p">:</span>
</span><span id="__span-0-323"><a id="__codelineno-0-323" name="__codelineno-0-323"></a> <span class="n">user</span><span class="o">.</span><span class="n">godfathers</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">to_remove</span><span class="p">)</span>
</span><span id="__span-0-324"><a id="__codelineno-0-324" name="__codelineno-0-324"></a> <span class="k">else</span><span class="p">:</span>
</span><span id="__span-0-325"><a id="__codelineno-0-325" name="__codelineno-0-325"></a> <span class="n">user</span><span class="o">.</span><span class="n">godchildren</span><span class="o">.</span><span class="n">remove</span><span class="p">(</span><span class="n">to_remove</span><span class="p">)</span>
</span><span id="__span-0-326"><a id="__codelineno-0-326" name="__codelineno-0-326"></a> <span class="k">return</span> <span class="n">redirect</span><span class="p">(</span><span class="s2">&quot;core:user_godfathers&quot;</span><span class="p">,</span> <span class="n">user_id</span><span class="o">=</span><span class="n">user_id</span><span class="p">)</span>
</span></code></pre></div></td></tr></table></div>
</details>
</div>
</div>
</div>
</div>
</div>
</article>
</div>
<script>var tabs=__md_get("__tabs");if(Array.isArray(tabs))e:for(var set of document.querySelectorAll(".tabbed-set")){var labels=set.querySelector(".tabbed-labels");for(var tab of tabs)for(var label of labels.getElementsByTagName("label"))if(label.innerText.trim()===tab){var input=document.getElementById(label.htmlFor);input.checked=!0;continue e}}</script>
<script>var target=document.getElementById(location.hash.slice(1));target&&target.name&&(target.checked=target.name.startsWith("__tabbed_"))</script>
</div>
</main>
<footer class="md-footer">
<nav class="md-footer__inner md-grid" aria-label="Pied de page" >
<a href="../model_fields/" class="md-footer__link md-footer__link--prev" aria-label="Précédent: Champs de modèle">
<div class="md-footer__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M20 11v2H8l5.5 5.5-1.42 1.42L4.16 12l7.92-7.92L13.5 5.5 8 11z"/></svg>
</div>
<div class="md-footer__title">
<span class="md-footer__direction">
Précédent
</span>
<div class="md-ellipsis">
Champs de modèle
</div>
</div>
</a>
<a href="../schemas/" class="md-footer__link md-footer__link--next" aria-label="Suivant: Schemas">
<div class="md-footer__title">
<span class="md-footer__direction">
Suivant
</span>
<div class="md-ellipsis">
Schemas
</div>
</div>
<div class="md-footer__button md-icon">
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24"><path d="M4 11v2h12l-5.5 5.5 1.42 1.42L19.84 12l-7.92-7.92L10.5 5.5 16 11z"/></svg>
</div>
</a>
</nav>
<div class="md-footer-meta md-typeset">
<div class="md-footer-meta__inner md-grid">
<div class="md-copyright">
Made with
<a href="https://squidfunk.github.io/mkdocs-material/" target="_blank" rel="noopener">
Material for MkDocs
</a>
</div>
</div>
</div>
</footer>
</div>
<div class="md-dialog" data-md-component="dialog">
<div class="md-dialog__inner md-typeset"></div>
</div>
<script id="__config" type="application/json">{"base": "../../..", "features": ["navigation.footer", "content.code.annotate", "content.code.copy", "content.tabs.link"], "search": "../../../assets/javascripts/workers/search.6ce7567c.min.js", "translations": {"clipboard.copied": "Copi\u00e9 dans le presse-papier", "clipboard.copy": "Copier dans le presse-papier", "search.result.more.one": "1 de plus sur cette page", "search.result.more.other": "# de plus sur cette page", "search.result.none": "Aucun document trouv\u00e9", "search.result.one": "1 document trouv\u00e9", "search.result.other": "# documents trouv\u00e9s", "search.result.placeholder": "Taper pour d\u00e9marrer la recherche", "search.result.term.missing": "Non trouv\u00e9", "select.version": "S\u00e9lectionner la version"}}</script>
<script src="../../../assets/javascripts/bundle.83f73b43.min.js"></script>
</body>
</html>