def user_links(request): request.frontend_context.update({ 'REQUEST_ACTIVATION_URL': reverse('misago:request_activation'), 'FORGOTTEN_PASSWORD_URL': reverse('misago:forgotten_password'), 'BANNED_URL': reverse('misago:banned'), 'USERCP_URL': reverse('misago:options'), 'USERS_LIST_URL': reverse('misago:users'), 'AUTH_API': reverse('misago:api:auth'), 'USERS_API': reverse('misago:api:user-list'), 'CAPTCHA_API_URL': reverse('misago:api:captcha_question'), }) return { 'USERCP_URL': usercp.get_default_link(), 'USERS_LIST_URL': users_list.get_default_link(), 'USER_PROFILE_URL': user_profile.get_default_link(), }
def get(self, request, *args, **kwargs): profile = self.get_profile(request, kwargs.pop('pk'), kwargs.pop('slug')) return redirect(user_profile.get_default_link(), slug=profile.slug, pk=profile.pk)
def moderation_return_path(request, user): return_path = clean_return_path(request) if not return_path: return reverse(user_profile.get_default_link(), kwargs={ 'user_slug': user.slug, 'user_id': user.pk }) return return_path
def decorator(request, profile): response = f(request, profile.lock()) if request.is_ajax(): response['is_error'] = False return JsonResponse(response) else: messages.success(request, response['message']) return_path = clean_return_path(request) if return_path: return redirect(return_path) else: return redirect(user_profile.get_default_link(), user_slug=profile.slug, user_id=profile.id)
def user_links(request): request.frontend_context.update({ 'REQUEST_ACTIVATION_URL': reverse('misago:request_activation'), 'FORGOTTEN_PASSWORD_URL': reverse('misago:forgotten_password'), 'BANNED_URL': reverse('misago:banned'), 'USERCP_URL': reverse('misago:options'), 'USERS_LIST_URL': reverse('misago:users'), }) return { 'USERCP_URL': usercp.get_default_link(), 'USERS_LIST_URL': users_list.get_default_link(), 'USER_PROFILE_URL': user_profile.get_default_link(), }
def follow_user(request, profile): user_locked = request.user.lock() profile.lock() if request.user.is_following(profile): request.user.follows.remove(profile) followed = False else: allow_follow_user(request.user, profile) followed = True request.user.follows.add(profile) if followed: message = _("You are now following %(user)s.") notify_user(profile, _("%(user)s is now following you."), reverse(user_profile.get_default_link(), kwargs={ 'user_slug': user_locked.slug, 'user_id': user_locked.id }), "profile_%s" % user_locked.pk, formats={'user': user_locked.username}, sender=user_locked, update_user=False) else: message = _("You have stopped following %(user)s.") message = message % {'user': profile.username} profile.followers = profile.followed_by.count() if followed: profile.save(update_fields=['followers', 'new_notifications']) else: profile.save(update_fields=['followers']) user_locked.following = user_locked.follows.count() user_locked.save(update_fields=['following']) if request.is_ajax: return {'is_following': followed, 'message': message} else: messages.success(request, message)
def user_links(request): request.frontend_context.update({ 'REQUEST_ACTIVATION_URL': reverse('misago:request_activation'), 'FORGOTTEN_PASSWORD_URL': reverse('misago:forgotten_password'), 'BANNED_URL': reverse('misago:banned'), 'USERCP_URL': reverse('misago:options'), 'USERS_LIST_URL': reverse('misago:users'), 'AUTH_API': reverse('misago:api:auth'), 'USERS_API': reverse('misago:api:user-list'), 'CAPTCHA_API_URL': reverse('misago:api:captcha_question'), 'USERNAME_CHANGES_API': reverse('misago:api:usernamechange-list'), }) return { 'USERCP_URL': usercp.get_default_link(), 'USERS_LIST_URL': users_list.get_default_link(), 'USER_PROFILE_URL': user_profile.get_default_link(), }
def landing(request, profile): return redirect(user_profile.get_default_link(), slug=profile.slug, pk=profile.pk)
def lander(request, profile): return redirect(user_profile.get_default_link(), slug=profile.slug, pk=profile.pk)
def moderation_return_path(request, user): return_path = clean_return_path(request) if not return_path: return reverse(user_profile.get_default_link(), kwargs={'user_slug': user.slug, 'user_id': user.pk}) return return_path
def lander(request, profile): return redirect(user_profile.get_default_link(), user_slug=profile.slug, user_id=profile.id)
def get_absolute_url(self): return reverse(user_profile.get_default_link(), kwargs={ 'user_slug': self.slug, 'user_id': self.id, })