mirror of
https://github.com/TandoorRecipes/recipes.git
synced 2025-12-24 02:39:20 -05:00
added some stats
This commit is contained in:
@@ -97,6 +97,8 @@
|
||||
class="fas fa-sync-alt"></i> {% trans 'Configure Sync' %}</a>
|
||||
<a class="dropdown-item" href="{% url 'data_batch_edit' %}"><i
|
||||
class="fas fa-edit"></i> {% trans 'Batch Edit' %}</a>
|
||||
<a class="dropdown-item" href="{% url 'data_stats' %}"><i
|
||||
class="fas fa-chart-line"></i> {% trans 'Statistics' %}</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
@@ -10,5 +10,37 @@
|
||||
{% trans 'Statistics' %}
|
||||
</h3>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
{% trans 'Number of Objects' %}
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item">{% trans 'Recipes' %} : <span
|
||||
class="badge badge-pill badge-info">{{ counts.recipes }}</span></li>
|
||||
<li class="list-group-item">{% trans 'Categories' %} : <span
|
||||
class="badge badge-pill badge-info">{{ counts.categories }}</span></li>
|
||||
<li class="list-group-item">{% trans 'Keywords' %} : <span
|
||||
class="badge badge-pill badge-info">{{ counts.keywords }}</span></li>
|
||||
<li class="list-group-item">{% trans 'Recipe Imports' %} : <span
|
||||
class="badge badge-pill badge-info">{{ counts.recipe_import }}</span></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
{% trans 'Number of Objects' %}
|
||||
</div>
|
||||
<ul class="list-group list-group-flush">
|
||||
<li class="list-group-item">{% trans 'Recipes without Category' %} : <span
|
||||
class="badge badge-pill badge-info">{{ counts.recipes_no_category }}</span></li>
|
||||
<li class="list-group-item">{% trans 'Recipes without Keywords' %} : <span
|
||||
class="badge badge-pill badge-info">{{ counts.recipes_no_keyword}}</span></li>
|
||||
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
@@ -6,8 +6,8 @@ from django.shortcuts import redirect, render
|
||||
from django.utils.translation import ngettext
|
||||
from django_tables2 import RequestConfig
|
||||
|
||||
from cookbook.forms import SyncForm, BatchEditForm, RecipeImport
|
||||
from cookbook.models import Recipe, Sync
|
||||
from cookbook.forms import SyncForm, BatchEditForm
|
||||
from cookbook.models import *
|
||||
from cookbook.tables import SyncTable
|
||||
|
||||
|
||||
@@ -86,6 +86,19 @@ def batch_edit(request):
|
||||
return render(request, 'batch/edit.html', {'form': form})
|
||||
|
||||
|
||||
class Object(object):
|
||||
pass
|
||||
|
||||
|
||||
@login_required
|
||||
def statistics(request):
|
||||
return render(request, 'index.html')
|
||||
counts = Object()
|
||||
counts.recipes = Recipe.objects.count()
|
||||
counts.categories = Category.objects.count()
|
||||
counts.keywords = Keyword.objects.count()
|
||||
counts.recipe_import = RecipeImport.objects.count()
|
||||
|
||||
counts.recipes_no_category = Recipe.objects.filter(category__isnull=True).count()
|
||||
counts.recipes_no_keyword = Recipe.objects.filter(keywords=None).count()
|
||||
|
||||
return render(request, 'stats.html', {'counts': counts})
|
||||
|
||||
Reference in New Issue
Block a user