basic UI!
parent
04a1da355c
commit
ca3c0e4fe5
|
@ -0,0 +1,27 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>DOAB Hosts</title>
|
||||
</head>
|
||||
<body>
|
||||
<h2>
|
||||
Linkchecking for
|
||||
{{provider.provider}} ({{provider.link_count}})
|
||||
</h2>
|
||||
<ul>
|
||||
{% for link in links %}
|
||||
<li>
|
||||
<a href="{{link.url}}">{{link.url}}</a>
|
||||
<table>
|
||||
{% for check in link.checks.all %}
|
||||
<tr>
|
||||
<td>{{ check.created }}</td>
|
||||
<td {% if check.return_code != 200 %} style="color:red"{% endif %}>{{ check.return_code }}</td>
|
||||
<td>{{check.content_type}}</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</table>
|
||||
</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,12 @@
|
|||
<html>
|
||||
<head>
|
||||
<title>DOAB Hosts</title>
|
||||
</head>
|
||||
<body>
|
||||
<ul>
|
||||
{% for provider in provider_list %}
|
||||
<li><a href="{% url 'provider' provider.provider %}">{{provider.provider}}</a> ({{provider.link_count}})</li>
|
||||
{% endfor %}
|
||||
</ul>
|
||||
</body>
|
||||
</html>
|
|
@ -1,21 +1,12 @@
|
|||
"""doab_check URL Configuration
|
||||
|
||||
The `urlpatterns` list routes URLs to views. For more information please see:
|
||||
https://docs.djangoproject.com/en/4.1/topics/http/urls/
|
||||
Examples:
|
||||
Function views
|
||||
1. Add an import: from my_app import views
|
||||
2. Add a URL to urlpatterns: path('', views.home, name='home')
|
||||
Class-based views
|
||||
1. Add an import: from other_app.views import Home
|
||||
2. Add a URL to urlpatterns: path('', Home.as_view(), name='home')
|
||||
Including another URLconf
|
||||
1. Import the include() function: from django.urls import include, path
|
||||
2. Add a URL to urlpatterns: path('blog/', include('blog.urls'))
|
||||
"""
|
||||
from django.contrib import admin
|
||||
from django.urls import path
|
||||
|
||||
from . import views
|
||||
|
||||
urlpatterns = [
|
||||
path('admin/', admin.site.urls),
|
||||
path('providers/', views.ProvidersView.as_view(), name='providers'),
|
||||
path('providers/<str:provider>/', views.ProviderView.as_view(), name='provider'),
|
||||
]
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
"""doab_check views
|
||||
"""
|
||||
|
||||
from django.http import HttpResponseRedirect
|
||||
from django.shortcuts import get_object_or_404, render
|
||||
from django.urls import reverse
|
||||
from django.views import generic
|
||||
|
||||
from .models import Link
|
||||
|
||||
|
||||
class ProvidersView(generic.TemplateView):
|
||||
template_name = 'providers.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
providers = Link.objects.order_by('provider').values('provider').distinct()
|
||||
for provider in providers:
|
||||
provider['link_count'] = Link.objects.filter(provider=provider['provider']).count()
|
||||
return {'provider_list': providers}
|
||||
|
||||
|
||||
class ProviderView(generic.TemplateView):
|
||||
template_name = 'provider.html'
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
prov = kwargs['provider']
|
||||
provider = {'provider': prov}
|
||||
provider_links = Link.objects.filter(provider=prov)
|
||||
provider['link_count'] = provider_links.count()
|
||||
|
||||
return {'provider': provider, 'links': provider_links}
|
Loading…
Reference in New Issue