Beispiel #1
0
    def get_initial(self):
        initial = super(BookmarkCreateUpdateMixin, self).get_initial()
        url = clean_http_referer(self.request)

        self.cancel_url = url

        if not self.object:
            initial["url"] = url

        return initial
Beispiel #2
0
 def get_initial(self):
     initial = super(BookmarkCreateUpdateMixin, self).get_initial() 
     url = clean_http_referer(self.request)
     
     self.cancel_url = url
     
     if not self.object:
         initial["url"] = url
             
     return initial
Beispiel #3
0
def object_unfollow(request, object_model, object_id, path=None, **kwargs):
    """The current user stops to follow object's activities.
    """
    obj = _get_object_by(object_model, object_id)
    follower = request.user

    if isinstance(obj, Observable):
        obj.remove_followers(follower)
        messages.success(request, _("You don't follow %(obj)s anymore.") % {"obj": obj}, fail_silently=True)

    return HttpResponseRedirect(path or clean_http_referer(request))