예제 #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)
예제 #2
0
파일: views.py 프로젝트: ruankranz/pychat
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