tab for selected users
This commit is contained in:
19
.idea/workspace.xml
generated
19
.idea/workspace.xml
generated
@@ -2,22 +2,15 @@
|
|||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="15f590a5-5017-44f1-a85e-17dfe3fc5379" name="Default Changelist" comment="">
|
<list default="true" id="15f590a5-5017-44f1-a85e-17dfe3fc5379" name="Default Changelist" comment="">
|
||||||
<change afterPath="$PROJECT_DIR$/templates/inputhours.html" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/templatetags/__init__.py" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/work/__init__.py" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/templatetags/auth_extras.py" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/work/admin.py" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/work/templatetags/__init__.py" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/work/apps.py" afterDir="false" />
|
<change afterPath="$PROJECT_DIR$/work/templatetags/auth_extras.py" afterDir="false" />
|
||||||
<change afterPath="$PROJECT_DIR$/work/forms.py" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/work/migrations/__init__.py" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/work/models.py" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/work/tests.py" afterDir="false" />
|
|
||||||
<change afterPath="$PROJECT_DIR$/work/views.py" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/config/urls.py" beforeDir="false" afterPath="$PROJECT_DIR$/config/urls.py" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/config/settings.py" beforeDir="false" afterPath="$PROJECT_DIR$/config/settings.py" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/db.sqlite3" beforeDir="false" afterPath="$PROJECT_DIR$/db.sqlite3" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/db.sqlite3" beforeDir="false" afterPath="$PROJECT_DIR$/db.sqlite3" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/static/css/main.css" beforeDir="false" afterPath="$PROJECT_DIR$/static/css/main.css" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/templates/base.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/base.html" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/templates/base.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/base.html" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/templates/home.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/home.html" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/work/migrations/__init__.py" beforeDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/templates/registration/login.html" beforeDir="false" afterPath="$PROJECT_DIR$/templates/registration/login.html" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
<option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -65,6 +65,9 @@ TEMPLATES = [
|
|||||||
'django.contrib.auth.context_processors.auth',
|
'django.contrib.auth.context_processors.auth',
|
||||||
'django.contrib.messages.context_processors.messages',
|
'django.contrib.messages.context_processors.messages',
|
||||||
],
|
],
|
||||||
|
'libraries': {
|
||||||
|
'auth_extras': 'templatetags.auth_extras',
|
||||||
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
]
|
]
|
||||||
|
|||||||
BIN
db.sqlite3
BIN
db.sqlite3
Binary file not shown.
@@ -15,41 +15,57 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
</head>
|
</head>
|
||||||
<body class="text-center">
|
<body class="text-center">
|
||||||
<div class="navbar-wrapper">
|
<div class="navbar-wrapper">
|
||||||
<header>
|
<header>
|
||||||
<nav class="navbar fixed-top navbar-light bg-nav navbar-expand-md">
|
<nav class="navbar fixed-top navbar-light bg-nav navbar-expand-md">
|
||||||
<!--Logo-->
|
<!--Logo-->
|
||||||
{% load static %}
|
{% load static %}
|
||||||
<a class="navbar-brand" href="#"><img src="{% static 'img/logo.png' %}" width="150" alt="logo"
|
<a class="navbar-brand" href="#"><img src="{% static 'img/logo.png' %}" width="150" alt="logo"
|
||||||
class="d-inline-block mr-1 align-center"></a>
|
class="d-inline-block mr-1 align-center"></a>
|
||||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#mainmenu">
|
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#mainmenu">
|
||||||
<span class="navbar-toggler-icon"></span>
|
<span class="navbar-toggler-icon"></span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div class="collapse navbar-collapse" id="mainmenu">
|
<div class="collapse navbar-collapse" id="mainmenu">
|
||||||
<ul class="navbar-nav">
|
<ul class="navbar-nav">
|
||||||
<!--Start-->
|
<!--Start-->
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="#">Start</a>
|
<a class="nav-link" href="#">Start</a>
|
||||||
</li>
|
</li>
|
||||||
<!--Start-->
|
<!--Dodaj godziny-->
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="#">Dodaj godziny</a>
|
<a class="nav-link" href="#">Dodaj godziny</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
|
{% load auth_extras %}
|
||||||
|
{% if request.user|has_group:"moderators" %}
|
||||||
|
<!--Dodaj pracownika-->
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="#">Dodaj pracownika</a>
|
||||||
|
</li>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
</ul>
|
|
||||||
|
|
||||||
|
</ul>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</nav>
|
||||||
|
</header>
|
||||||
|
</div>
|
||||||
|
<div class = "container">
|
||||||
|
<div class="row">
|
||||||
|
{% block content %}
|
||||||
|
{% endblock %}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="row">
|
||||||
|
<footer><p class="mt-5 mb-3 text-muted">
|
||||||
|
© Alicja Cięciwa</p></footer>
|
||||||
|
</div>
|
||||||
|
|
||||||
</nav>
|
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
|
||||||
</header>
|
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script>
|
||||||
</div>
|
</div>
|
||||||
{% block content %}
|
|
||||||
{% endblock %}
|
|
||||||
|
|
||||||
|
|
||||||
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" integrity="sha384-DfXdz2htPH0lsSSs5nCTpuj/zy4C+OGpamoFVy38MVBnE+IbbVYUew+OrCXaRkfj" crossorigin="anonymous"></script>
|
|
||||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ho+j7jyWK8fNQe+A12Hb8AhRq26LrZ/JpcUGGOn+Y7RsweNrtN/tE3MoK7ZeZDyx" crossorigin="anonymous"></script>
|
|
||||||
|
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
BIN
templatetags/__pycache__/__init__.cpython-38.pyc
Normal file
BIN
templatetags/__pycache__/__init__.cpython-38.pyc
Normal file
Binary file not shown.
BIN
templatetags/__pycache__/auth_extras.cpython-38.pyc
Normal file
BIN
templatetags/__pycache__/auth_extras.cpython-38.pyc
Normal file
Binary file not shown.
9
templatetags/auth_extras.py
Normal file
9
templatetags/auth_extras.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
from django import template
|
||||||
|
from django.contrib.auth.models import Group
|
||||||
|
|
||||||
|
register = template.Library()
|
||||||
|
|
||||||
|
@register.filter(name='has_group')
|
||||||
|
def has_group(user, group_name):
|
||||||
|
group = Group.objects.get(name=group_name)
|
||||||
|
return True if group in user.groups.all() else False
|
||||||
Binary file not shown.
Reference in New Issue
Block a user