You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

10 lines
351 B

from django.http import HttpResponseRedirect
from django.shortcuts import get_object_or_404
from banners.models import Redirect
from django.db.models import F
def redirect(request, id):
redirect = get_object_or_404(Redirect, id=id)
Redirect.objects.filter(id=id).update(count=F('count')+1)
return HttpResponseRedirect(redirect.redirect)