Skip to content

Commit

Permalink
feat: landing page
Browse files Browse the repository at this point in the history
  • Loading branch information
b1rger committed Oct 3, 2023
1 parent 45e031e commit bf75f13
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
7 changes: 7 additions & 0 deletions apis_core/apis_entities/templatetags/apis_templatetags.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django import template
from apis_core.utils import caching

register = template.Library()

Expand All @@ -15,3 +16,9 @@ def url_replace(request, field, value):
dict_[field] = value

return dict_.urlencode()


@register.simple_tag
def entities():
ent = caching.get_all_entity_classes() or []
return {entity._meta.label: entity.objects.count() for entity in ent}
25 changes: 25 additions & 0 deletions apis_core/core/templates/landing.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{% extends basetemplate %}
{% load apis_templatetags %}

{% block content %}

{% entities as entities %}

<div class="container">
<div class="row">
{% for e, l in entities.items %}
{% if forloop.counter|divisibleby:"3" %}
</div><div class="row">
{% else %}
<div class="col">
<div class="alert alert-dark" role="alert">
<h4 class="alert-heading">{{ e }}</h4>
<p>{{ l }}</p>
</div>
</div>
{% endif %}
{% endfor %}
</div>
</div>

{% endblock content %}
2 changes: 1 addition & 1 deletion apis_core/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def build_apis_mock_request(method, path, view, original_request, **kwargs):


urlpatterns = [
path("", TemplateView.as_view(template_name="base.html"), name="apis_index"),
path("", TemplateView.as_view(template_name="landing.html"), name="apis_index"),
path("admin/", admin.site.urls),
# url(r'^swagger(?P<format>\.json|\.yaml)$', SchemaViewSwagger.without_ui(cache_timeout=-1), name='schema-json'),
# url(r'^swagger/$', SchemaViewSwagger.with_ui('swagger', cache_timeout=-1), name='schema-swagger-ui'),
Expand Down

0 comments on commit bf75f13

Please sign in to comment.