-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
style: add bootstrap styling to tagging app (#4551)
- Loading branch information
1 parent
d502b8c
commit 2884cc5
Showing
19 changed files
with
283 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
from django.conf import settings | ||
|
||
|
||
def tagging(request): | ||
""" | ||
Add some constants to the context. | ||
""" | ||
return { | ||
'HEADER_LOGO_URL': settings.HEADER_LOGO_URL, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,18 @@ | ||
from django.conf import settings | ||
from django.contrib.auth.mixins import LoginRequiredMixin | ||
from django.core.exceptions import PermissionDenied | ||
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin | ||
|
||
|
||
class VerticalTaggingAdministratorPermissionRequiredMixin(LoginRequiredMixin): | ||
class VerticalTaggingAdministratorPermissionRequiredMixin( | ||
LoginRequiredMixin, UserPassesTestMixin | ||
): | ||
""" | ||
A mixin to enforce permission on VERTICALS_MANAGEMENT_GROUPS for class-based views. | ||
""" | ||
|
||
def dispatch(self, request, *args, **kwargs): | ||
response = super().dispatch(request, *args, **kwargs) | ||
if response.status_code == 403: | ||
return response | ||
|
||
in_vertical_management_group = request.user.groups.filter( | ||
def test_func(self): | ||
""" | ||
Check if the user is in the VERTICALS_MANAGEMENT_GROUPS group or is a superuser. | ||
""" | ||
return self.request.user.is_superuser or self.request.user.groups.filter( | ||
name__in=settings.VERTICALS_MANAGEMENT_GROUPS | ||
).exists() | ||
|
||
if not request.user.is_superuser and not in_vertical_management_group: | ||
raise PermissionDenied("You do not have permission to access this page.") | ||
|
||
return response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
course_discovery/apps/tagging/templates/tagging/course_list.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
33 changes: 22 additions & 11 deletions
33
course_discovery/apps/tagging/templates/tagging/sub_vertical_detail.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.