Skip to content
This repository has been archived by the owner on Aug 18, 2020. It is now read-only.

Commit

Permalink
Added readonly mode to discussion, sms, post_comment and chat_message
Browse files Browse the repository at this point in the history
  • Loading branch information
dbreedt committed May 26, 2015
1 parent 1cb5d81 commit b3a2fc9
Showing 1 changed file with 88 additions and 44 deletions.
132 changes: 88 additions & 44 deletions oneplus/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -2881,11 +2881,18 @@ def discussion_response(request, disc):
else:
return HttpResponse("Discussion %s not found" % disc)

ro = None
response = None

if db_disc.response:
ro = 1
response = db_disc.response

def get():
return render(
request=request,
template_name='misc/discussion_response.html',
dictionary={'disc': db_disc, 'participant': db_participant}
template_name="misc/discussion_response.html",
dictionary={"disc": db_disc, "participant": db_participant, "ro": ro, "response": response}
)

def post():
Expand All @@ -2902,17 +2909,19 @@ def post():
if title_error or dt_error or content_error:
return render(
request=request,
template_name='misc/discussion_response.html',
template_name="misc/discussion_response.html",
dictionary={
'disc': db_disc,
'participant': db_participant,
'title_error': title_error,
'dt_error': dt_error,
'content_error': content_error,
'v_title': title,
'v_date': date,
'v_time': time,
'v_content': content
"disc": db_disc,
"participant": db_participant,
"ro": ro,
"response": response,
"title_error": title_error,
"dt_error": dt_error,
"content_error": content_error,
"v_title": title,
"v_date": date,
"v_time": time,
"v_content": content
}
)
else:
Expand All @@ -2932,7 +2941,7 @@ def post():
db_disc.response = disc
db_disc.save()

return HttpResponseRedirect('/admin/communication/discussion/')
return HttpResponseRedirect("/admin/communication/discussion/")

return resolve_http_method(request, [get, post])

Expand Down Expand Up @@ -3075,12 +3084,19 @@ def sms_response(request, sms):
else:
return HttpResponse("Sms %s not found" % sms)

ro = None
resp = None

if db_sms.response:
ro = 1
resp = db_sms.response

def get():

return render(
request=request,
template_name='misc/sms_response.html',
dictionary={'sms': db_sms, 'participant': db_participant}
template_name="misc/sms_response.html",
dictionary={"sms": db_sms, "participant": db_participant, "ro": ro, "response": resp}
)

def post():
Expand All @@ -3098,15 +3114,17 @@ def post():
if dt_error or content_error:
return render(
request=request,
template_name='misc/sms_response.html',
template_name="misc/sms_response.html",
dictionary={
'sms': db_sms,
'participant': db_participant,
'dt_error': dt_error,
'content_error': content_error,
'v_date': date,
'v_time': time,
'v_content': content
"sms": db_sms,
"participant": db_participant,
"ro": ro,
"response": resp,
"dt_error": dt_error,
"content_error": content_error,
"v_date": date,
"v_time": time,
"v_content": content
}
)
else:
Expand All @@ -3121,7 +3139,7 @@ def post():
db_sms.response = qsms
db_sms.save()

return HttpResponseRedirect('/admin/communication/sms/')
return HttpResponseRedirect("/admin/communication/sms/")

return resolve_http_method(request, [get, post])

Expand Down Expand Up @@ -3234,11 +3252,22 @@ def blog_comment_response(request, pc):
if not db_pc:
return HttpResponse("PostComment %s not found" % pc)

ro = None
response = None

if db_pc.response:
ro = 1
response = db_pc.response

def get():
return render(
request=request,
template_name='misc/blog_comment_response.html',
dictionary={'pc': db_pc}
template_name="misc/blog_comment_response.html",
dictionary={
"pc": db_pc,
"ro": ro,
"response": response
}
)

def post():
Expand All @@ -3252,14 +3281,16 @@ def post():
if dt_error or content_error:
return render(
request=request,
template_name='misc/blog_comment_response.html',
template_name="misc/blog_comment_response.html",
dictionary={
'pc': db_pc,
'dt_error': dt_error,
'content_error': content_error,
'v_date': date,
'v_time': time,
'v_content': content
"pc": db_pc,
"ro": ro,
"response": response,
"dt_error": dt_error,
"content_error": content_error,
"v_date": date,
"v_time": time,
"v_content": content
}
)
else:
Expand All @@ -3274,7 +3305,7 @@ def post():
db_pc.response = pc
db_pc.save()

return HttpResponseRedirect('/admin/communication/postcomment/')
return HttpResponseRedirect("/admin/communication/postcomment/")

return resolve_http_method(request, [get, post])

Expand Down Expand Up @@ -3352,11 +3383,22 @@ def chat_response(request, cm):
if not db_cm:
return HttpResponse("ChatMessage %s not found" % cm)

ro = None
response = None

if db_cm.response:
ro = 1
response = db_cm.response

def get():
return render(
request=request,
template_name='misc/chat_response.html',
dictionary={'cm': db_cm}
template_name="misc/chat_response.html",
dictionary={
"cm": db_cm,
"ro": ro,
"response": response,
}
)

def post():
Expand All @@ -3370,14 +3412,16 @@ def post():
if dt_error or content_error:
return render(
request=request,
template_name='misc/chat_response.html',
template_name="misc/chat_response.html",
dictionary={
'cm': db_cm,
'dt_error': dt_error,
'content_error': content_error,
'v_date': date,
'v_time': time,
'v_content': content
"cm": db_cm,
"ro": ro,
"response": response,
"dt_error": dt_error,
"content_error": content_error,
"v_date": date,
"v_time": time,
"v_content": content
}
)
else:
Expand All @@ -3392,7 +3436,7 @@ def post():
db_cm.response = cm
db_cm.save()

return HttpResponseRedirect('/admin/communication/chatmessage/')
return HttpResponseRedirect("/admin/communication/chatmessage/")

return resolve_http_method(request, [get, post])

Expand Down

0 comments on commit b3a2fc9

Please sign in to comment.