@waffle_flag('testing-autovouch-views')
@allow_unvouched
@never_cache
def vouch(request, username):
 profile = get_object_or_404(UserProfile, user__username=username)
 now = timezone.now()
 description = 'Automatically vouched for testing purposes on {0}'.format(now)
 vouch = profile.vouch(None, description=description, autovouch=True)
 if vouch:
  messages.success(request, _('Successfully vouched user.'))
 else:
  msg = _('User not vouched. Maybe there are {0} vouches already?')
  msg = msg.format(settings.VOUCH_COUNT_LIMIT)
  messages.error(request, msg)
 return redirect('phonebook:profile_view', profile.user.username)

@ waffle_flag ( 'testing-autovouch-views' ) @ allow_unvouched @ never_cache def vouch ( request , username ) : profile = get_object_or_404 ( UserProfile , user__username = username ) now = timezone . now ( ) description = 'Automatically vouched for testing purposes on {0}' . format ( now ) vouch = profile . vouch ( None , description = description , autovouch = True ) if vouch : messages . success ( request , _ ( 'Successfully vouched user.' ) ) else : msg = _ ( 'User not vouched. Maybe there are {0} vouches already?' ) msg = msg . format ( settings . VOUCH_COUNT_LIMIT ) messages . error ( request , msg ) return redirect ( 'phonebook:profile_view' , profile . user . username )
automatically vouch username .