~widelands-dev/widelands-website/django_staticfiles

« back to all changes in this revision

Viewing changes to wlmaps/views.py

  • Committer: franku
  • Date: 2018-04-03 05:18:03 UTC
  • mto: This revision was merged to the branch mainline in revision 491.
  • Revision ID: somal@arcor.de-20180403051803-2003zf49j3xd860i
url fixes; render_to_response() -> render(); disabled tracking

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
#
4
4
 
5
5
from forms import UploadMapForm, EditCommentForm
6
 
from django.shortcuts import render_to_response, get_object_or_404
7
 
from django.template import RequestContext
 
6
from django.shortcuts import render, get_object_or_404
8
7
from django.contrib.auth.decorators import login_required
9
8
from django.http import HttpResponseRedirect, HttpResponseNotAllowed, HttpResponse, HttpResponseBadRequest
10
9
from django.core.urlresolvers import reverse
19
18
#########
20
19
def index(request):
21
20
    maps = models.Map.objects.all()
22
 
    return render_to_response('wlmaps/index.html',
 
21
    return render(request, 'wlmaps/index.html',
23
22
                              {'maps': maps,
24
23
                               'maps_per_page': MAPS_PER_PAGE,
25
 
                               },
26
 
                              context_instance=RequestContext(request))
 
24
                               })
27
25
 
28
26
 
29
27
def rate(request, map_slug):
75
73
    context = {
76
74
        'map': map,
77
75
    }
78
 
    return render_to_response('wlmaps/map_detail.html',
79
 
                              context,
80
 
                              context_instance=RequestContext(request))
 
76
    return render(request, 'wlmaps/map_detail.html',
 
77
                              context)
81
78
 
82
79
 
83
80
@login_required
94
91
 
95
92
    context = {'form': form, 'map': map}
96
93
 
97
 
    return render_to_response('wlmaps/edit_comment.html',
98
 
                              context,
99
 
                              context_instance=RequestContext(request))
 
94
    return render(request, 'wlmaps/edit_comment.html',
 
95
                              context)
100
96
 
101
97
 
102
98
@login_required
112
108
        form = UploadMapForm()
113
109
 
114
110
    context = {'form': form, }
115
 
    return render_to_response('wlmaps/upload.html',
116
 
                              context,
117
 
                              context_instance=RequestContext(request))
 
111
    return render(request, 'wlmaps/upload.html',
 
112
                              context)