summaryrefslogtreecommitdiff
path: root/bak/unused_apps/projects/views.py
diff options
context:
space:
mode:
authorluxagraf <sng@luxagraf.net>2023-07-28 13:39:02 -0500
committerluxagraf <sng@luxagraf.net>2023-07-28 13:39:02 -0500
commit9a620cf42bf1fe6977e378bd834b41ff4a593dde (patch)
treecf41a0582681cecaf88a30bfe409f9c2be57972a /bak/unused_apps/projects/views.py
parent6e5897117124cd60ae81efb1574c6347f48e60e5 (diff)
main: removed some apps I wasn't using and added bak to git to preserve
a copy of old apps
Diffstat (limited to 'bak/unused_apps/projects/views.py')
-rw-r--r--bak/unused_apps/projects/views.py45
1 files changed, 45 insertions, 0 deletions
diff --git a/bak/unused_apps/projects/views.py b/bak/unused_apps/projects/views.py
new file mode 100644
index 0000000..ad5f167
--- /dev/null
+++ b/bak/unused_apps/projects/views.py
@@ -0,0 +1,45 @@
+from django.shortcuts import render, get_object_or_404
+from django.template import RequestContext
+from django.apps import apps
+
+from projects.shortcuts import render_to_geojson
+from projects.models.natparks import NationalParks
+from projects.models.gifs import AnimatedGif
+
+projects = {
+ '5x5': 'FiveBy',
+ '6x6': 'SixBy',
+ 'national-parks': 'NationalParks',
+ 'code': 'Code'
+}
+
+
+def detail(request, slug):
+ """Projects by slug"""
+ name = projects[slug]
+ model = apps.get_model('projects', name)
+ if slug == 'national-parks':
+ qs = model.objects.filter(visited__exact=True).order_by("-date_visited_begin")
+ else:
+ qs = model.objects.filter(status__exact=1)
+ context = {
+ "object_list": qs,
+ }
+ template = 'details/%s.html' % (slug)
+ return render(request, template, context)
+
+
+def gif_detail(request, slug):
+ obj = get_object_or_404(AnimatedGif, slug__exact=slug)
+ return render(request, 'details/gifs.html', {'object': obj})
+
+
+def data_json(request, id):
+ qs = NationalParks.objects.filter(pk=id)
+ return render_to_geojson(
+ qs,
+ included_fields=['id'],
+ geom_attribute='mpoly',
+ mimetype='application/json',
+ pretty_print=True
+ )