def links_index(request): """View for showing links index.""" extra_context = get_extra_context() links = Link.objects.all() extra_context['links'] = links return render_to_response("other/links.html", extra_context, context_instance=RequestContext(request))
def team_index(request): """View for showing team index.""" extra_context = get_extra_context() players = Player.objects.filter().order_by('-number') extra_context['players'] = players return render_to_response("team.html", extra_context, context_instance=RequestContext(request))
def tournaments_list(request): """View for showing tournaments index.""" extra_context = get_extra_context() tournaments = Tournament.objects.filter().order_by('-created') extra_context['tournaments'] = tournaments return render_to_response("fixtures/list.html", extra_context, context_instance=RequestContext(request))
def tournament(request, tournament_id): """View for showing fixtures for a single tournament.""" extra_context = get_extra_context() try: tournament = Tournament.objects.get(pk=tournament_id) extra_context['tournament'] = tournament return render_to_response("fixtures/single.html", extra_context, context_instance=RequestContext(request)) except ObjectDoesNotExist: raise Http404
def posts_single(request, post_id): """View for showing single blog post.""" extra_context = get_extra_context() try: post = Post.objects.get(pk=post_id) extra_context['post'] = post return render_to_response("post.html", extra_context, context_instance=RequestContext(request)) except ObjectDoesNotExist: raise Http404
def photo_view(request, album_id, photo_id): """View for showing single photos.""" extra_context = get_extra_context() try: album = Album.objects.get(pk=album_id) photo = Photo.objects.get(pk=photo_id) extra_context['album'] = album extra_context['photo'] = photo return render_to_response("gallery/photo.html", extra_context, context_instance=RequestContext(request)) except ObjectDoesNotExist: raise Http404
def album_photos_view(request, album_id): """View for showing album photos.""" extra_context = get_extra_context() try: album = Album.objects.get(pk=album_id) photos = Photo.objects.filter(album_id=album_id) extra_context['album'] = album extra_context['photos'] = photos return render_to_response("gallery/album_photos.html", extra_context, context_instance=RequestContext(request)) except ObjectDoesNotExist: raise Http404
def register(request): """User registration view.""" extra_context = get_extra_context() if request.method == 'POST': user_form = CustomRegistrationForm(request.POST) if user_form.is_valid(): user_form.save() messages.info(request, 'Dodano nowego użytkownika') login_form = AuthenticationForm() extra_context['form'] = login_form return render_to_response("login.html", extra_context, context_instance=RequestContext(request)) else: user_form = CustomRegistrationForm() extra_context['form'] = user_form return render_to_response("register.html", extra_context, context_instance=RequestContext(request))
def _render_archive_posts(request, posts): """Render archive posts.""" extra_context = get_extra_context() extra_context['posts'] = posts return render_to_response("blog.html", extra_context, context_instance=RequestContext(request))
def page_not_found(request): extra_context = get_extra_context() return render_to_response("error/404.html", extra_context, context_instance=RequestContext(request))
def achivements(request): """View for showing achivements.""" extra_context = get_extra_context() return render_to_response("achivements.html", extra_context, context_instance=RequestContext(request))
def albums_view(request): """View for showing photos index.""" extra_context = get_extra_context() extra_context['albums'] = Album.objects.filter().order_by('-date_created') return render_to_response("gallery/albums.html", extra_context, context_instance=RequestContext(request))