Files
@ 9b48cc94e651
Branch filter:
Location: website/www/conservancy/apps/events/views.py - annotation
9b48cc94e651
2.3 KiB
text/x-python
Continuing saga of the sizing chart problems for original shirts
Gildan removed the sizing chart entirely from their website again
after yet another redesign. Originally, we deep-linked into files in
their CDN for the charts, but it appears that in 5c72071 that I
introduced cut-and-paste error on the sizing charts. I cannot find
the original links, but finally I simply decided we'd mirror the
files in our CDN, which is where these now link to.
I suspect that I didn't do this to start for worrying about copyright
infringement, but upon second thought, I think it's very reasonably
fair use for us to distribute these images. We bought a lot of
t-shirts from Gildan and just trying to sell through.
Gildan removed the sizing chart entirely from their website again
after yet another redesign. Originally, we deep-linked into files in
their CDN for the charts, but it appears that in 5c72071 that I
introduced cut-and-paste error on the sizing charts. I cannot find
the original links, but finally I simply decided we'd mirror the
files in our CDN, which is where these now link to.
I suspect that I didn't do this to start for worrying about copyright
infringement, but upon second thought, I think it's very reasonably
fair use for us to distribute these images. We bought a lot of
t-shirts from Gildan and just trying to sell through.
2bf594b86cb1 66dbfac066b0 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf f6bbcc7ee328 2bf594b86cb1 2bf594b86cb1 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 05bee8b3c3b9 66dbfac066b0 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 05bee8b3c3b9 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 2bf594b86cb1 2bf594b86cb1 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf 8e6ea8ad71bf | # from django.views.generic.list_detail import object_list
from django.shortcuts import render
from django.http import Http404, HttpResponse
from django.template import loader
from django.core.exceptions import ObjectDoesNotExist
from conservancy.apps.events.models import Event
# for debugging...
from django.http import HttpResponse
def event_detail(request, year, slug, queryset, **kwargs):
"""This view shows event detail.
Nothing special, but it is necessary because
django.views.generic.date_based.object_detail only works with
slugs that are unique and specified by day, but we make slugs
unique by year.
"""
try:
event = queryset.get(date__year=year, slug__exact=slug)
except ObjectDoesNotExist:
raise Http404("Event does not exist")
return render(request, 'events/event_detail.html', {'event': event})
def custom_index(request, queryset, *args, **kwargs):
"""Scrollable index of future and past events, with date index.
"""
future_events = None
if "page" not in request.GET:
future_events = Event.future.all().order_by("date")
date_list = queryset.dates(kwargs['date_field'], 'year')
kwargs = dict(kwargs, extra_context={'date_list': date_list,
'future_events': future_events})
del kwargs['date_field']
del kwargs['allow_future']
# return object_list(request, queryset, *args, **kwargs)
return HttpResponse("FIXME: events must be updated like blog and news.")
def future_event_ics(request, queryset, *args, **kwargs):
"""ICS calendar view of future events
This view just renders information into a template that looks like
an ics file. If in the future we want a 'real' implementation of
this function, there is a python 'vobject' library that can be
used. Search google for details, or see
http://www.technobabble.dk/2008/mar/06/exposing-calendar-events-using-icalendar-django/
Hopefully at some point this functionality is integrated into
django.contrib.
"""
future_events = Event.future.all().order_by("date")
return HttpResponse(loader.render_to_string('events/calendar.ics',
{'events': future_events}),
mimetype='text/calendar')
|