def gml(request, mark_reference): mark = get_object_or_404(Mark, reference=mark_reference) date_drawn = int(time.mktime(mark.date_drawn.timetuple())) context = {'mark': mark, 'obj_decoded': simplejson.loads(mark.points_obj_simplified), 'date_drawn': date_drawn} response = render_response(request, 'gml.xml', context, mimetype='application/xml') response['Content-Disposition'] = "attachment; filename=%s.gml" % mark.reference return response
def list_invites(request): if not request.user.is_authenticated(): return HttpResponseRedirect('/accounts/login/') else: invites = Invitation.objects.order_by('id') context = {'invites': invites} return render_response(request, 'list_invites.html', context)
def makemark(request): mark_form = MarkForm(request.POST) if mark_form.is_valid(): mark_data = {'points_obj': mark_form.cleaned_data['points_obj'], 'country_code': mark_form.cleaned_data['country_code']} common.save_new_mark_with_data(mark_data) else: mark_form = MarkForm() return render_response(request, 'makemark.html', {'form': mark_form})
def makemark(request): mark_form = MarkForm(request.POST) if mark_form.is_valid(): mark_data = { 'points_obj': mark_form.cleaned_data['points_obj'], 'country_code': mark_form.cleaned_data['country_code'] } common.save_new_mark_with_data(mark_data) else: mark_form = MarkForm() return render_response(request, 'makemark.html', {'form': mark_form})
def community(request): if 'offset' in request.GET: try: offset = int(request.GET['offset']) per_page = int(request.GET['per_page']) except ValueError: return HttpResponseBadRequest() top_limit = offset + per_page all_marks = Mark.objects.exclude(flaggings__gte=1)[offset:top_limit] else: all_marks = Mark.objects.exclude(flaggings__gte=1) return render_response(request, 'community.html', {'all_marks': all_marks})
def gml(request, mark_reference): mark = get_object_or_404(Mark, reference=mark_reference) date_drawn = int(time.mktime(mark.date_drawn.timetuple())) context = { 'mark': mark, 'obj_decoded': simplejson.loads(mark.points_obj_simplified), 'date_drawn': date_drawn } response = render_response(request, 'gml.xml', context, mimetype='application/xml') response[ 'Content-Disposition'] = "attachment; filename=%s.gml" % mark.reference return response
def subscribe(request): """ Subscribe a new email address to our contact list """ form = forms.EmailSubscribeForm(request.POST or None) if request.method == 'POST': if form.is_valid(): data = form.cleaned_data responsys.subscribe(settings.RESPONSYS_CAMPAIGN, data['email'], 'text', responsys.make_source_url(request), request.locale, data['country']) return HttpResponseRedirect('/') # Not a POST or an Error return render_response(request, 'newsletter.html', {'form': form})
def evan(request): evan_urls = { 'laser_url': 'http://graffitiresearchlab.com/projects/laser-tag/', 'throwies_url': 'http://graffitiresearchlab.com/projects/led-throwies/', 'glove_url': 'http://whiteglovetracking.com/', 'eyewriter_url': 'http://www.eyewriter.org/', 'graffiti_url': 'http://graffitianalysis.com/', 'jayz_url': 'http://www.youtube.com/watch?v=QftcJtvLr8g', 'research_url': 'http://www.graffitiresearchlab.com/', 'fat_url': 'http://fffff.at/', 'npr_url': 'http://www.npr.org/templates/story/story.php?storyId=124980282', 'nyt_url': 'http://evan-roth.com/press/High-Tech-Graffiti-Spray-Paint-Is-So-20th-Century-New-York-Times.pdf', 'liberation_url': 'http://evan-roth.com/press/C-est-graff-docteur.pdf', 'time_url': 'http://www.time.com/time/photogallery/0,29307,1911799_1912685,00.html', 'cnn_url': 'http://edition.cnn.com/2010/TECH/web/09/10/gif.images/index.html', 'guardian_url': 'http://www.guardian.co.uk/search?search=%22evan+roth%22&sitesearch-radio=guardian&go-guardian=Search', 'abc_url': 'http://abcnews.go.com/Technology/popup?id=2425229', 'esquire_url': 'http://www.esquire.com/features/best-brightest-2007/graffiti1207', 'juxtapoz_url': 'http://evan-roth.com/press/juxtapoz-2010-10-oct-eroth.pdf', } return render_response(request, 'evan-roth.html', evan_urls)
def mark_sammy(request): mark = get_object_or_404(Mark, reference=mark_reference) return render_response(request, 'sammy/mark.html', {'mark': mark})
def mozilla(request): return render_response(request, 'mozilla.html')
def about_gml(request): return render_response(request, 'gml.html')
def coming_soon(request): return render_response(request, 'coming_soon.html')
def credits(request): return render_response(request, 'credits.html')
def newsletter(request): form = EmailSubscribeForm() return render_response(request, 'newsletter.html', {'form': form})
def home(request): mr = settings.MEDIA_ROOT return render_response(request, 'home.html', {'mr': mr})
def manifesto(request): return render_response(request, 'manifesto.html')
def moderate_sammy(request): if not request.user.is_authenticated(): return HttpResponseRedirect('/accounts/login/') else: return render_response(request, 'sammy/moderate.html')
def about(request): return render_response(request, 'about.html')
def code(request): return render_response(request, 'code.html')
def makemark_sammy(request): mark_form = MarkForm() return render_response(request, 'sammy/makemark.html', {'form': mark_form})
def account_locked(request): return render_response(request, 'registration/locked.html')
def linear_sammy(request): return render_response(request, 'sammy/linear.html')
def mark(request, mark_reference): mark = get_object_or_404(Mark, reference=mark_reference) return render_response(request, 'mark.html', {'mark': mark})