I want to make something like when someone download a pdf from my site after downloading download value will be increasing
Below are sample mixin you can use in your Class based view to inherit the functionality.
from .signals import object_viewed_signal
class ObjectViewedMixin(object):
def get_context_data(self, *args, **kwargs):
context = super(ObjectViewedMixin, self).get_context_data(*args, **kwargs)
request = self.request
instance = context.get('object')
if instance:
object_viewed_signal.send(instance.__class__, instance=instance, request=request)
return context
@Js-Tutul can you response whether the issue has been resolved. If resolved kindly close the ticket.
- Vengat
I think you can use this approach