-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Remove inject - TODO: Add as a management command - N+1 fix for / - Update config for isort
- Loading branch information
Showing
9 changed files
with
41 additions
and
17 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
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
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 |
---|---|---|
|
@@ -4,5 +4,4 @@ | |
|
||
urlpatterns = [ | ||
path('', views.index, name='index'), | ||
path('inject/', views.inject, name='inject'), | ||
] |
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,23 @@ | ||
from django.db import models | ||
from django.http import HttpResponse | ||
from django.template import loader | ||
|
||
from apps.cap_feed.tasks import inject_data | ||
|
||
from .models import Alert | ||
|
||
|
||
def index(request): | ||
latest_alert_list = Alert.objects.order_by("-sent")[:10] | ||
latest_alert_list = Alert.objects.order_by("-sent").values( | ||
'identifier', | ||
'sender', | ||
'sent', | ||
'status', | ||
'msg_type', | ||
country_name=models.F('country__name'), | ||
country_iso3=models.F('country__iso3'), | ||
feed_url=models.F('feed__url'), | ||
)[:10] | ||
template = loader.get_template("cap_feed/index.html") | ||
context = { | ||
"latest_alert_list": latest_alert_list, | ||
} | ||
return HttpResponse(template.render(context, request)) | ||
|
||
|
||
def inject(request): | ||
try: | ||
inject_data.apply_async(args=(), kwargs={}, queue='inject') | ||
except Exception: | ||
print('Celery not running') | ||
return HttpResponse("Done") |
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