def profile_edit(request, username): u = get_carnique_user(username) if not u: raise Http404() editing_user = request.user profile_raw = u.get_profile().text profile_html = convert_bb_to_html(profile_raw) if not _can_edit_profile(username, editing_user): return cnq_render_to_response( 'profile.html', request, { 'puser': u, 'profile_text': profile_html, 'body_top_error': 'You cannot edit this profile.', }) if not 'profile_birthday' in request.POST: return cnq_render_to_response('profile_edit.html', request, { 'puser': u, 'profile': u.get_profile(), 'profile_text': profile_raw, }) # Verify and commit changes if u.get_profile().text != request.POST['profile_text']: u.get_profile().text = request.POST['profile_text'] u.get_profile().last_updated = datetime.datetime.now() u.get_profile().realname = request.POST['profile_realname'] u.get_profile().location = request.POST['profile_location'] u.get_profile().twitter_username = request.POST['profile_twitter_username'] u.get_profile().blog_url = request.POST['profile_blog_url'] u.get_profile().blog_name = request.POST['profile_blog_name'] if request.POST['profile_birthday']: u.get_profile().birthday = request.POST['profile_birthday'] u.save() u.get_profile().save() profile_text = convert_bb_to_html(u.get_profile().text) return cnq_render_to_response( 'profile.html', request, { 'puser': u, 'profile_birthday': u.get_profile().birthday, 'profile': u.get_profile(), 'profile_text': profile_text, 'body_top_message': 'The changes to your profile have been saved.', })
def profile_edit(request, username): u = get_carnique_user(username) if not u: raise Http404() editing_user = request.user profile_raw = u.get_profile().text profile_html = convert_bb_to_html(profile_raw) if not _can_edit_profile(username, editing_user): return cnq_render_to_response('profile.html', request, { 'puser': u, 'profile_text': profile_html, 'body_top_error': 'You cannot edit this profile.', }) if not 'profile_birthday' in request.POST: return cnq_render_to_response('profile_edit.html', request, { 'puser': u, 'profile': u.get_profile(), 'profile_text': profile_raw, }) # Verify and commit changes if u.get_profile().text != request.POST['profile_text']: u.get_profile().text = request.POST['profile_text'] u.get_profile().last_updated = datetime.datetime.now() u.get_profile().realname = request.POST['profile_realname'] u.get_profile().location = request.POST['profile_location'] u.get_profile().twitter_username = request.POST['profile_twitter_username'] u.get_profile().blog_url = request.POST['profile_blog_url'] u.get_profile().blog_name = request.POST['profile_blog_name'] if request.POST['profile_birthday']: u.get_profile().birthday = request.POST['profile_birthday'] u.save() u.get_profile().save() profile_text = convert_bb_to_html(u.get_profile().text) return cnq_render_to_response('profile.html', request, { 'puser': u, 'profile_birthday': u.get_profile().birthday, 'profile': u.get_profile(), 'profile_text': profile_text, 'body_top_message': 'The changes to your profile have been saved.', })
def quote_view(request, quote_id): q = get_object_or_404(Quote, pk=quote_id) return cnq_render_to_response('quote.html', request, { 'quote': q, 'quote_text': convert_bb_to_html(q.text), })
def quote_view_random(request): num_quotes = Quote.objects.count() q = Quote.objects.all()[randint(0, num_quotes - 1)] return cnq_render_to_response('quote.html', request, { 'quote': q, 'quote_text': convert_bb_to_html(q.text), })
def quote_vote_down(request, quote_id): quote = get_object_or_404(Quote, pk=quote_id) if not _already_voted(quote, request): _vote(quote, request, -1) return cnq_render_to_response('quote.html', request, { 'quote': quote, 'quote_text': convert_bb_to_html(quote.text), })
def profile_view(request, username): u = get_carnique_user(username) if not u: raise Http404() profile_text = convert_bb_to_html(u.get_profile().text) return cnq_render_to_response('profile.html', request, { 'puser': u, 'profile_text': profile_text, })
def quote_view_random(request): num_quotes = Quote.objects.count() q = Quote.objects.all()[randint(0, num_quotes - 1)] return cnq_render_to_response("quote.html", request, {"quote": q, "quote_text": convert_bb_to_html(q.text)})
def quote_vote_down(request, quote_id): quote = get_object_or_404(Quote, pk=quote_id) if not _already_voted(quote, request): _vote(quote, request, -1) return cnq_render_to_response("quote.html", request, {"quote": quote, "quote_text": convert_bb_to_html(quote.text)})
def quote_view(request, quote_id): q = get_object_or_404(Quote, pk=quote_id) return cnq_render_to_response("quote.html", request, {"quote": q, "quote_text": convert_bb_to_html(q.text)})
def bbed_text(self): return convert_bb_to_html(self.text)