mirror of
https://github.com/DarrenOfficial/dpaste.git
synced 2024-11-15 08:02:54 +11:00
Now that there is no admin anymore I need a quick way to check the total snippet count, to see if something goes wrong or I'm DOSed.
This commit is contained in:
parent
cad4589b0a
commit
368c8101ce
3 changed files with 52 additions and 21 deletions
|
@ -1,10 +1,13 @@
|
||||||
{% extends "dpaste/base.html" %}
|
{% extends "dpaste/base.html" %}
|
||||||
|
|
||||||
|
{% load i18n %}
|
||||||
|
|
||||||
{% block title %}About dpaste.de{% endblock %}
|
{% block title %}About dpaste.de{% endblock %}
|
||||||
{% block headline %}About dpaste.de{% endblock %}
|
{% block headline %}About dpaste.de{% endblock %}
|
||||||
{% block dpaste_nav_about %}active{% endblock %}
|
{% block dpaste_nav_about %}active{% endblock %}
|
||||||
|
|
||||||
{% block page %}
|
{% block page %}
|
||||||
|
|
||||||
<h3>API</h3>
|
<h3>API</h3>
|
||||||
|
|
||||||
{# Just put the script in dpaste and copy the source node #}
|
{# Just put the script in dpaste and copy the source node #}
|
||||||
|
@ -16,30 +19,43 @@
|
||||||
<p>Or you could use <code>curl</code>:
|
<p>Or you could use <code>curl</code>:
|
||||||
<code>alias dpaste="curl -F 'content=<-' http://dpaste.de/api/"</code></p>
|
<code>alias dpaste="curl -F 'content=<-' http://dpaste.de/api/"</code></p>
|
||||||
|
|
||||||
<hr>
|
|
||||||
|
|
||||||
<h3>Applications using the API:</h3>
|
<div class="row-fluid">
|
||||||
|
<div class="span5">
|
||||||
|
<h3>Applications using the API:</h3>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
<li><a href="https://github.com/bartTC/dpasteGUI/wiki">dpasteGUI</a>, a OS X interface</li>
|
<li><a href="https://github.com/bartTC/dpasteGUI/wiki">dpasteGUI</a>, a OS X interface</li>
|
||||||
<li><a href="https://github.com/bartTC/SubDpaste">a dpaste Sublime 2 plugin</a></li>
|
<li><a href="https://github.com/bartTC/SubDpaste">a dpaste Sublime 2 plugin</a></li>
|
||||||
<li><a href="http://marmalade-repo.org/packages/dpaste_de">Marmalade</a>, a Emacs plugin</li>
|
<li><a href="http://marmalade-repo.org/packages/dpaste_de">Marmalade</a>, a Emacs plugin</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
</div>
|
||||||
|
<div class="span4">
|
||||||
|
<p>{% blocktrans %}There are {{ total }} snippets in the database. The most popular languages are:{% endblocktrans %}</p>
|
||||||
|
<table class="table">
|
||||||
|
{% for s in stats %}
|
||||||
|
<tr>
|
||||||
|
<th>{{ s.lexer|upper }}</th>
|
||||||
|
<td>{{ s.count }}</th>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="span3">
|
||||||
|
<h3>Imprint</h3>
|
||||||
|
|
||||||
<hr/>
|
<p><strong>Address:</strong></p>
|
||||||
|
<p>
|
||||||
|
Martin Mahner<br/>
|
||||||
|
Lauterbacher Str. 4<br/>
|
||||||
|
DE-18581 Putbus<br/>
|
||||||
|
Germany
|
||||||
|
</p>
|
||||||
|
|
||||||
<h3>Imprint</h3>
|
<p><strong>Jabber/E-Mail:</strong></p>
|
||||||
|
<p><a href="mailto:martin@mahner.org">martin@mahner.org</a></p>
|
||||||
<p><strong>Address:</strong></p>
|
</div>
|
||||||
<p>
|
</div>
|
||||||
Martin Mahner<br/>
|
|
||||||
Lauterbacher Str. 4<br/>
|
|
||||||
DE-18581 Putbus<br/>
|
|
||||||
Germany
|
|
||||||
</p>
|
|
||||||
|
|
||||||
<p><strong>Jabber/E-Mail:</strong></p>
|
|
||||||
<p><a href="mailto:martin@mahner.org">martin@mahner.org</a></p>
|
|
||||||
|
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
|
@ -3,7 +3,7 @@ from django.views.generic import TemplateView
|
||||||
|
|
||||||
urlpatterns = patterns(
|
urlpatterns = patterns(
|
||||||
'',
|
'',
|
||||||
url(r'^about/$', TemplateView.as_view(template_name='dpaste/about.html'), name='about'),
|
url(r'^about/$', 'dpaste.views.about', name='about'),
|
||||||
url(r'^', include('dpaste.urls.dpaste_api')),
|
url(r'^', include('dpaste.urls.dpaste_api')),
|
||||||
url(r'^', include('dpaste.urls.dpaste')),
|
url(r'^', include('dpaste.urls.dpaste')),
|
||||||
)
|
)
|
||||||
|
|
|
@ -7,6 +7,7 @@ from django.core.exceptions import ObjectDoesNotExist, MultipleObjectsReturned
|
||||||
from django.utils.translation import ugettext_lazy as _
|
from django.utils.translation import ugettext_lazy as _
|
||||||
from django.core.urlresolvers import reverse
|
from django.core.urlresolvers import reverse
|
||||||
from django.utils import simplejson
|
from django.utils import simplejson
|
||||||
|
from django.db.models import Count
|
||||||
from django.views.defaults import page_not_found as django_page_not_found, \
|
from django.views.defaults import page_not_found as django_page_not_found, \
|
||||||
server_error as django_server_error
|
server_error as django_server_error
|
||||||
|
|
||||||
|
@ -17,6 +18,19 @@ from dpaste.highlight import guess_code_lexer, \
|
||||||
|
|
||||||
import difflib
|
import difflib
|
||||||
|
|
||||||
|
def about(request, template_name='dpaste/about.html'):
|
||||||
|
template_context = {
|
||||||
|
'total': Snippet.objects.count(),
|
||||||
|
'stats': Snippet.objects.values('lexer').annotate(
|
||||||
|
count=Count('lexer')).order_by('-count')[:5],
|
||||||
|
}
|
||||||
|
|
||||||
|
return render_to_response(
|
||||||
|
template_name,
|
||||||
|
template_context,
|
||||||
|
RequestContext(request)
|
||||||
|
)
|
||||||
|
|
||||||
def snippet_new(request, template_name='dpaste/snippet_new.html'):
|
def snippet_new(request, template_name='dpaste/snippet_new.html'):
|
||||||
|
|
||||||
if request.method == "POST":
|
if request.method == "POST":
|
||||||
|
@ -169,6 +183,7 @@ def guess_lexer(request):
|
||||||
return HttpResponse(response)
|
return HttpResponse(response)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def page_not_found(request, template_name='dpaste/404.html'):
|
def page_not_found(request, template_name='dpaste/404.html'):
|
||||||
return django_page_not_found(request, template_name)
|
return django_page_not_found(request, template_name)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue