-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved internalportal to separate app
- Loading branch information
1 parent
51cf831
commit 329648d
Showing
10 changed files
with
52 additions
and
56 deletions.
There are no files selected for viewing
Empty file.
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,6 @@ | ||
from django.apps import AppConfig | ||
|
||
|
||
class InternalportalConfig(AppConfig): | ||
default_auto_field = "django.db.models.BigAutoField" | ||
name = "internalportal" |
Empty file.
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 |
---|---|---|
@@ -0,0 +1,9 @@ | ||
from django.urls import path | ||
|
||
from . import views | ||
|
||
app_name = "internalportal" | ||
|
||
urlpatterns = [ | ||
path("", views.InternalPortalView.as_view(), name="internalportal"), | ||
] |
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,33 @@ | ||
from datetime import datetime | ||
|
||
from django.contrib.auth.mixins import PermissionRequiredMixin | ||
from django.views.generic import TemplateView | ||
|
||
from inventory.models.item_loan import ItemLoan | ||
from news.models import Article, Event | ||
|
||
|
||
class InternalPortalView(PermissionRequiredMixin, TemplateView): | ||
template_name = "internalportal/internalportal.html" | ||
permission_required = "userprofile.is_active_member" | ||
|
||
def get_context_data(self, *args, **kwargs): | ||
context = super().get_context_data(*args, **kwargs) | ||
|
||
context["current_date"] = datetime.now() | ||
|
||
# Find the 5 loan apps that have gone unapproved the longest | ||
context["loan_app_list"] = ItemLoan.objects.filter( | ||
approver__isnull=True, | ||
).order_by("-loan_from")[:5] | ||
|
||
# Same as in the index view | ||
context["event_list"] = Event.objects.filter(internal=True).order_by( | ||
"-time_start" | ||
)[:5] | ||
|
||
context["article_list"] = Article.objects.filter( | ||
internal=True, draft=False | ||
).order_by("-pub_date")[:5] | ||
|
||
return context |
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
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