def send_reminder_to_referees():
- returns
None
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
def forgotpassword(request):
- returns view
app/other/forgot_password.html
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
def _get_user_type(user):
user
- User
model object.
- returns
String
object with value S
or G
or D
or R
or A
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
def _get_user_type_object(user):
user
- User
model object.
- returns
dict
type object with keys -
username
- contains username of the user.
type
- contains return value of _get_user_type(user)
- Keys added by the method -
_get_all_student_info(user, dict)
if the user is a student.
_get_all_guide_info(user, dict)
if the user is a faculty member.
_get_all_referee_info(user, dict)
if the user is a referee.
_get_all_admin_info(user, dict)
if the user is the admin (Ph.D. cell).
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
def _get_all_user_info(user):
user
- User
model object.
- returns
Student
type object if user
is a student.
Faculty
type object if user
is a faculty member.
Referee
type object if user
is a referee.
Admin
type object if user
is the admin (Ph.D. cell).
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
def _get_all_referee_info(user, dict):
user
- User
model object.
dict
- dict
object.
- returns
None
, adds keys to dict
parameter.
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
def _get_all_admin_info(user, dict):
user
- User
model object.
dict
- dict
object.
- returns
None
, adds keys to dict
parameter.
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
def _get_all_student_info(user, dict):
user
- User
model object.
dict
- dict
object.
- returns
None
, adds keys to dict
parameter.
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
def _get_all_guide_info(user, dict):
user
- User
model object.
dict
- dict
object.
- returns
None
, adds keys to dict
parameter.
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
@login_required
def user_profile(request):
- returns view
app/common/user_profile.html
, sends data to view -
layout_data
- contains return value of get_layout_data(request)
user
- dict
, contains return value of _get_all_user_info()
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
@login_required
def view_user_profile(request, username):
username
- String
object which is the username of a particular user.
- returns view
app/common/user_profile.html
, sends data to view -
layout_data
- contains return value of get_layout_data(request)
user
- dict
, contains return value of _get_all_user_info()
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
def send_notification(sender, receiver, message, link):
sender
- User
model object.
receiver
- User
model object.
message
- String
object which is the message content.
link
- String
object which is the link to redirect when notification is clicked.
- returns
None
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
def validate_request(request):
request
- HttpRequest
object which is received by a method which handles an application request.
- returns
True
- if the user has accessed a proper URL
False
- if the user has accessed a URL he/she shouldn't
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
def validate_pdf(file_dict):
file_dict
- request.FILES['file']
- dict object which has file details
- returns
True
- if file is a valid PDF
False
- if the file is not valid
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
def _add_user_data_to_session(user, request):
user
- User
model object.
request
- HttpRequest
object.
- returns
None
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
def login(request):
- returns view
app/other/login.html
for a GET request, performs authentication for POST
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
@login_required
def logout(request):
- returns
None
. Redirects user to login page after performing logout
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
@login_required
def user_edit_profile(request):
- returns view
app/common/edit_profile.html
for GET request and POST request.
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
def send_text_email(receiver, subject, content):
receiver
- User
model object.
subject
- String
object.
content
- String
object.
- returns
None
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
@login_required
def user_notifications(request):
- returns view
app/common/notifications.html
, sends data to view -
layout_data
- contains return value of get_layout_data(request)
.
read_notifications
- QuerySet
object, contains list of all read notifications of logged in user.
unread_notifications
- QuerySet
object, contains list of all unread notifications of logged in user.
zone
- String
object, name of the timezone in which the logged in user belongs to.
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
def _verify_user_notification(user, id):
user
- User
model object.
id
- int
, ID of the notification in the Notification
model.
- returns
True
- if notification exists and belongs to user
False
- invalid notification id / user
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
@login_required
def delete_user_notification(request, id):
id
- int
, ID of the notification in the Notification
model.
- redirects user to
User notifications
page if deletion is successful.
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
@login_required
def delete_all_unread_notifications(request):
- redirects user to
User notifications
page if deletion is successful.
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
@login_required
def delete_all_read_notifications(request):
- redirects user to
User notifications
page if deletion is successful.
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
@login_required
def mark_all_notifications_read(request):
- redirects user to
User notifications
page if operation is successful.
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
@login_required
def mark_notification_read(request, id):
id
- int
, ID of the notification in the Notification
model.
- redirects user to
User notifications
page if operation is successful.
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
@login_required
def search_user(request):
- returns view
app/common/search_user.html
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
def _clean_user_info_results(data):
data
- list of tuples.
- returns list of dictionary objects where each
dict
has the keys -
username
first_name
last_name
email
type
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
@login_required
def search_user_query(request):
- returns JSON text, which is the
json.dumps()
of the return value of _clean_user_info_results()
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
def get_referee_recommendations(thesis):
thesis
- Thesis
model object.
- returns
dict
object with keys -
indian
- list
of dict
objects, where each dict
object has the keys -
username
- String
, username of referee
full_name
- String
, full name of referee
address
- String
, currently hard-coded to No yet included in database
designation
- String
, designation of referee
website
- String
, website of referee
university
- String
, university name of referee
type
- String
of value Indian
foreign
- list
of dict
objects, where each dict
object has the same keys as above, except for type
, which holds value Foreign
.
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
def get_layout_data(request):
request
- HttpRequest
object.
- returns
dict
object with keys
unread_notifications_count
- int
, count of unread notifications
unread_notifications
- QuerySet
object, top 3 unread notifications by user. Currently not sorted by time.
- Write a short sentence about what the method does.
- Control flow -
- Query for all thesis under a guide.
- For each thesis retrieve the status.
def bad_request(request):
- returns view
app/layouts/error.html
, sends data to the view -
status_code
- int
of value 400
.
message
- String
object which has message to display.
- Write a short sentence about what the method does.
def not_found(request):
- returns view
app/layouts/error.html
, sends data to the view -
status_code
- int
of value 404
.
message
- String
object which has message to display.
- Write a short sentence about what the method does.
def unauthorized_access(request):
- returns view
app/layouts/error.html
, sends data to the view -
status_code
- int
of value 401
.
message
- String
object which has message to display.
- Write a short sentence about what the method does.
def forbidden(request):
- returns view
app/layouts/error.html
, sends data to the view -
status_code
- int
of value 403
.
message
- String
object which has message to display.
- Write a short sentence about what the method does.
def internal_server_error(request):
- returns view
app/layouts/error.html
, sends data to the view -
status_code
- int
of value 500
.
message
- String
object which has message to display.
- Write a short sentence about what the method does.