ajax_request def add_movie request form UrlForm request request POST i

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
@ajax_request
def add_movie(request):
form = UrlForm(request, request.POST)
if form.is_valid():
seen = form.save()
if seen.like:
html = "<li><span class='left_block'><span class='date'><span class='tl'><span class='tr'><span class='bl'><span class='br'>%s</span></span></span></span></span><a href='/users/%s/'></a> <a href='http://www.imdb.com/title/%s/' class='f-name'>%s</a></span><span class='like'><span class='tl'><span class='tr'><span class='bl'><span class='br'>%s</span></span></span></span></span></li>" % (seen.date, seen.profile.username, seen.movie.imdb, seen.movie.title, "не понравилось")
else:
html = "<li><span class='left_block'><span class='date'><span class='tl'><span class='tr'><span class='bl'><span class='br'>%s</span></span></span></span></span><a href='/users/%s/'></a> посмотрел(а) <a href='http://www.imdb.com/title/%s/' class='f-name'>%s</a></span><span class='hate'><span class='tl'><span class='tr'><span class='bl'><span class='br'>не понравилось</span></span></span></span></span></li>" % (seen.date, seen.profile.username, seen.movie.imdb, seen.movie.title)
return {'html': html}
assert False, form