Example #1
0
 def profile(self, id):
     try:
         user_profile = UserProfile.objects.get(pk=id)
         profile = MessagesCreator.get_user_profile(user_profile)
         profile[
             'image'] = user_profile.photo.url if user_profile.photo.name else None
         return profile
     except ObjectDoesNotExist:
         raise tornado.web.HTTPError(404)
Example #2
0
def show_profile(request, profile_id):
    try:
        user_profile = UserProfile.objects.get(pk=profile_id)
        profile = MessagesCreator.get_user_profile(user_profile)
        profile[
            'image'] = user_profile.photo.url if user_profile.photo.url else None
        return HttpResponse(json.dumps(profile),
                            content_type='application/json')
    except ObjectDoesNotExist:
        raise Http404