GitLab is used only for code review, issue tracking and project management. Canonical locations for source code are still https://gitweb.torproject.org/ https://git.torproject.org/ and git-rw.torproject.org.

Commit e23049c6 authored by MariaV's avatar MariaV
Browse files

Merge branch 'add_json_endpoint' into 'master'

Add json endpoint

See merge request !94
parents 3bb84946 37747451
from django.contrib import admin
# Register your models here.
from anonticket.models import Issue, Note, GitlabAccountRequest
from django.apps import AppConfig
class IrcbotConfig(AppConfig):
name = 'ircbot'
from django.db import models
# Create your models here.
from django.test import TestCase
# Create your tests here.
from django.urls import path
from .views import list_irc_pending
urlpatterns = [
path('', list_irc_pending, name="irc-pending")
]
\ No newline at end of file
from rest_framework.decorators import api_view
from rest_framework.response import Response
from anonticket.models import Issue, Note, GitlabAccountRequest
#Function based view iwth Api-view decorator
@api_view()
def list_irc_pending(request):
"""View to list Pending API totals. GET-only accepted."""
issue_total = Issue.objects.filter(reviewer_status='P').count()
note_total = Note.objects.filter(reviewer_status='P').count()
gitlab_account_request_total = GitlabAccountRequest.objects.filter(reviewer_status='P').count()
build_dictionary = {
"pending_issues": issue_total,
"pending_notes": note_total,
"pending_gitlab_account_requests": gitlab_account_request_total,
}
return Response(build_dictionary)
Django~=3.1.5
python-decouple~=3.3
python-gitlab~=2.5.0
django-test-plus~=1.3
django-markdownify~=0.8.1
coverage~=5.3.1
django-ratelimit~=3.0.1
gunicorn~=20.0.4
asgiref==3.3.1
bleach==3.3.0
certifi==2020.12.5
chardet==4.0.0
coverage==5.3.1
Django==3.1.6
django-markdownify==0.8.2
django-ratelimit==3.0.1
django-rest-framework==0.1.0
django-test-plus==1.4.0
djangorestframework==3.12.4
gunicorn==20.0.4
idna==2.10
Markdown==3.3.3
packaging==20.9
pyparsing==2.4.7
python-decouple==3.4
python-gitlab==2.5.0
pytz==2021.1
requests==2.25.1
six==1.15.0
sqlparse==0.4.1
urllib3==1.26.3
webencodings==0.5.1
......@@ -41,8 +41,10 @@ INSTALLED_APPS = [
'django.contrib.messages',
'django.contrib.staticfiles',
'markdownify',
'rest_framework',
'shared.apps.SharedConfig',
'anonticket.apps.AnonticketConfig',
'ircbot',
]
MIDDLEWARE = [
......
......@@ -30,6 +30,7 @@ def handler403(request, exception=None):
urlpatterns = [
path('tor_admin/', admin.site.urls),
path('', include('anonticket.urls'))
path('irc_bot/', include('ircbot.urls')),
path('', include('anonticket.urls')),
]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment