diff options
-rw-r--r-- | app/sightings/admin.py | 13 | ||||
-rw-r--r-- | app/sightings/urls.py | 19 | ||||
-rw-r--r-- | app/sightings/views.py | 8 | ||||
-rw-r--r-- | design/sass/_birds.scss | 26 | ||||
-rw-r--r-- | design/templates/archives/life-list.html | 27 |
5 files changed, 83 insertions, 10 deletions
diff --git a/app/sightings/admin.py b/app/sightings/admin.py index a90cf95..d6ac5d4 100644 --- a/app/sightings/admin.py +++ b/app/sightings/admin.py @@ -24,15 +24,22 @@ class APClassAdmin(admin.ModelAdmin): list_filter = ('kind',) +class SightingInline(admin.TabularInline): + model = Sighting + + @admin.register(AP) class APAdmin(admin.ModelAdmin): form = LGEntryForm + inlines = [ + SightingInline, + ] list_display = ('pk', 'common_name', 'scientific_name', 'kind', 'code', 'apclass') - list_filter = ('apclass__kind','apclass') + list_filter = ('apclass__kind', 'apclass') search_fields = ['common_name', 'scientific_name'] - + class Media: - js = ('image-loader.js','next-prev-links.js') + js = ('image-loader.js', 'next-prev-links.js') @admin.register(Sighting) diff --git a/app/sightings/urls.py b/app/sightings/urls.py index 76a952e..7aa6ace 100644 --- a/app/sightings/urls.py +++ b/app/sightings/urls.py @@ -5,12 +5,17 @@ app_name = "sightings" urlpatterns = [ path( - r'', + r'', views.SightingListView.as_view(), - {'page':1}, + {'page': 1}, name="list" ), re_path( + r'life-list$', + views.LifeListView.as_view(), + name='life-list' + ), + re_path( r'(?P<page>\d+)/$', views.SightingListView.as_view(), name="list" @@ -20,15 +25,15 @@ urlpatterns = [ views.SightingDetailView.as_view(), name='detail' ), - #path( - # r'<str:user>/', + # path( + # r'<str:user>/', # views.SightingListUserView.as_view(), # {'page':1}, # name='list_by_person' - #), - #path( + # ), + # path( # r'<str:user>/<int:page>/', # views.SightingListUserView.as_view(), # name='list_by_person' - #), + # ), ] diff --git a/app/sightings/views.py b/app/sightings/views.py index cb821c8..f65011c 100644 --- a/app/sightings/views.py +++ b/app/sightings/views.py @@ -1,4 +1,5 @@ from django.views.generic.detail import DetailView +from django.views.generic import ListView from django.contrib.auth.models import User from utils.views import PaginatedListView from .models import AP, Sighting @@ -13,6 +14,13 @@ class SightingListView(PaginatedListView): return Sighting.objects.filter(id__in=qs_ids).order_by('-pub_date') +class LifeListView(ListView): + template_name = 'archives/life-list.html' + + def get_queryset(self): + return Sighting.objects.filter(ap__apclass__kind=1).order_by('ap__id').distinct('ap') + + class SightingListUserView(PaginatedListView): template_name = 'archives/sightings.html' diff --git a/design/sass/_birds.scss b/design/sass/_birds.scss index d491f1d..c50b22e 100644 --- a/design/sass/_birds.scss +++ b/design/sass/_birds.scss @@ -132,5 +132,31 @@ } } } +.life-list { + @include constrain_wide; + text-align: left; + h4 { @include fancy_sans;} + ul { + @include breakpoint(beta){ + height: 1200px; + display: flex; + flex-direction: column; + flex-wrap: wrap; + } + @include breakpoint(gamma){ + height: 1000px; + } + @include breakpoint(epsilon){ + height: 800px; + } + } + li { + margin-bottom: .35rem; + } + a { + color: $body_font; + text-decoration: none; + } +} diff --git a/design/templates/archives/life-list.html b/design/templates/archives/life-list.html new file mode 100644 index 0000000..9b92725 --- /dev/null +++ b/design/templates/archives/life-list.html @@ -0,0 +1,27 @@ +{% extends 'base.html' %} +{% load typogrify_tags %} +{% load pagination_tags %} + +{% block pagetitle %}Luxagraf | Birding Life List {% if region %}in {{region.name|title|smartypants|safe}}{%else%}by {{user}}{%endif%}{% if page != "1" %} -- Page {{page}}{%endif%}{% endblock %} +{% block metadescription %}Briding Life List {% if region %} in {{region.name|title|smartypants|safe}}{%else%}by {{user}}{%endif%} Page {{page}}{% endblock %} +{%block bodyid%}id="birds"{%endblock%} + + +{% block primary %}<ul class="bl" id="breadcrumbs" itemscope itemtype="http://data-vocabulary.org/Breadcrumb"> + <li><a href="/" title="luxagraf homepage" itemprop="url"><span itemprop="title">Home</span></a> → </li> + <li>Life List</li> + </ul> + <main role="main" class="archive"> + <h1 class="hide">Brids Life List {% if region %}in {%if region.name == 'United States'%}the United States{%else%}{{region.name|title|smartypants|safe}}{%endif%}{%else%} by {{user}}{%endif%}</h1> + <div class="life-list"> + <h4>Current Life List Total: {{object_list|length}}</h4> + <ul>{% for object in object_list %} + <li><a href="{{object.get_absolute_url}}">{{object.ap.common_name}}</a></li> + {%endfor%}</ul> + </div> + </main> +{% endblock %} + + + +{% block js %}<script src="/media/js/hyphenate.min.js" type="text/javascript"></script>{% endblock%} |