Application Home

The HOME application contains the general pages of the EMERGEN-DB application.

Templates

The HOME application contains 3 templates :

  • about.html : about page

  • index.html : home page

  • profile.html : profile page

Key files of the « HOME » application

admin.py

class apps.home.admin.EMERGEN_DB(name='admin')

Declaration custom admin page

class apps.home.admin.GroupAdmin(model, admin_site)

Adding the User table in the Django admin and customizing the rendering

has_add_permission(request)

Return True if the given request has permission to add an object. Can be overridden by the user in subclasses.

has_delete_permission(request, obj=None)

Return True if the given request has permission to change the given Django model instance, the default implementation doesn’t examine the obj parameter.

Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to delete the obj model instance. If obj is None, this should return True if the given request has permission to delete any object of the given type.

class apps.home.admin.LocationTeamAdmin(model, admin_site)
class apps.home.admin.MeetUsProfileAdmin(model, admin_site)
class apps.home.admin.PageContentAdmin(model, admin_site)

Adding the PageContent table in the Django admin and customizing the rendering

class apps.home.admin.ProfileAdmin(model, admin_site)

Adding the User table in the Django admin and customizing the rendering

has_add_permission(request)

Return True if the given request has permission to add an object. Can be overridden by the user in subclasses.

has_delete_permission(request, obj=None)

Return True if the given request has permission to change the given Django model instance, the default implementation doesn’t examine the obj parameter.

Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to delete the obj model instance. If obj is None, this should return True if the given request has permission to delete any object of the given type.

class apps.home.admin.SendUserEmails(**kwargs)
form_class

alias de apps.home.forms.SendEmailForm

form_valid(form)

If the form is valid, redirect to the supplied URL.

class apps.home.admin.TaskResultAdmin(model, admin_site)

Admin-interface for results of tasks.

has_add_permission(request)

Return True if the given request has permission to add an object. Can be overridden by the user in subclasses.

has_delete_permission(request, obj=None)

Return True if the given request has permission to change the given Django model instance, the default implementation doesn’t examine the obj parameter.

Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to delete the obj model instance. If obj is None, this should return True if the given request has permission to delete any object of the given type.

model

alias de django_celery_results.models.TaskResult

class apps.home.admin.UserAdmin(model, admin_site)

Adding the User table in the Djnango admin and customizing the rendering

changelist_view(request, extra_context=None)

The “change list” admin view for this model.

get_hijack_user(obj)

Return the user based on the current object.

This method may be overridden to support hijack keys on related objects.

has_add_permission(request)

Return True if the given request has permission to add an object. Can be overridden by the user in subclasses.

has_delete_permission(request, obj=None)

Return True if the given request has permission to change the given Django model instance, the default implementation doesn’t examine the obj parameter.

Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to delete the obj model instance. If obj is None, this should return True if the given request has permission to delete any object of the given type.

send_email(request, queryset)

Action to send mails

send_mail_to_reset_password(request, queryset)

Action to reset password

upload_csv(request)

Function to import the CSV file of users

class apps.home.admin.WebMessageAdmin(model, admin_site)
apps.home.admin.create_username(first_name, last_name)

Create a username

Paramètres
  • first_name (str) – First name

  • last_name (str) – Last name

Renvoie

A generated username

class apps.home.admin.experiemnt_groupAdmin(model, admin_site)
has_add_permission(request)

Return True if the given request has permission to add an object. Can be overridden by the user in subclasses.

has_delete_permission(request, obj=None)

Return True if the given request has permission to change the given Django model instance, the default implementation doesn’t examine the obj parameter.

Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to delete the obj model instance. If obj is None, this should return True if the given request has permission to delete any object of the given type.

apps.home.admin.mail_create_my(user, team, request)

Function to send a mail with the documentation for creating an cluster account

apps.home.admin.mail_reset_pwd(user, request)

Function to send a mail when creating a user without access to the cluster to reset his password

apps.home.admin.oui_to_bool(val)

Convert oui to boolean

Paramètres

val (str) – value to convert

Renvoie

Boolean (True if val = oui, False in others cases)

class apps.home.admin.teamAdmin(model, admin_site)

Adding the User table in the Django admin and customizing the rendering

has_add_permission(request)

Return True if the given request has permission to add an object. Can be overridden by the user in subclasses.

has_delete_permission(request, obj=None)

Return True if the given request has permission to change the given Django model instance, the default implementation doesn’t examine the obj parameter.

Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to delete the obj model instance. If obj is None, this should return True if the given request has permission to delete any object of the given type.

class apps.home.admin.team_auth_groupAdmin(model, admin_site)
has_add_permission(request)

Return True if the given request has permission to add an object. Can be overridden by the user in subclasses.

has_delete_permission(request, obj=None)

Return True if the given request has permission to change the given Django model instance, the default implementation doesn’t examine the obj parameter.

Can be overridden by the user in subclasses. In such case it should return True if the given request has permission to delete the obj model instance. If obj is None, this should return True if the given request has permission to delete any object of the given type.

test.py

class apps.home.tests.TestPage(methodName='runTest')
setUp()

Hook method for setting up the test fixture before exercising it.

tearDown()

Hook method for deconstructing the test fixture after testing it.

test_MeetUs_page()

Test get MeetUs page

test_about_page()

Test get about page

test_admin_get_groups()

Test get admin page

test_api_get_area_content()

Test api_get_area_content

test_create_username()

Test create username

test_data_analyst()

Test data_analyst

test_experiment()

Test print team admin page

test_index_page()

Test get index page

test_logout()

Test get logout page

test_message_page()

Test get message page

test_no_access()
test_no_profile()

Test no profile

test_oui_to_bool()

Test convert oui to bool

test_profile_get_log()

Test get profile page

test_profile_get_noLog()

Test get profile page but not log

test_roles()

Test user roles

test_send_email_get()

Test send email action : Get

test_send_email_post()

Test send email action : Post

test_send_mail_to_reset_password()

Test admin action : send mail to reset password

test_send_mail_to_reset_password_error()

Test admin action : send mail to reset password with mail error

test_str_team()

Test model : get str from team

test_str_to_bool()

Test str_to_bool function

test_team_admin()

Test print team admin page

test_team_admin_WP()

Test print team admin page

test_team_export()

Test export team week file

test_team_filter()

Test filters : team

test_teams_page_with_groupe()

Test get teams page with groupe

test_upload_img()

Test get message page

test_upload_user()

Test admin upload users

test_upload_user_bad_file()

Test admin upload user bad file

test_upload_user_bad_mail()

Test admin upload user : test BadHeaderError mail with

url.py

The urls.py file contains :

  • Home page ;

  • About page ;

  • Profile page ;

  • Logout page ;

  • Documentation pages ;

view.py

class apps.home.views.IsDataAnalyst

API permission : test if user is data_analyst

has_permission(request, view)

Return True if permission is granted, False otherwise.

class apps.home.views.IsDataBroker

API permission : test if user is data_broker

has_permission(request, view)

Return True if permission is granted, False otherwise.

class apps.home.views.IsDataReporter

API permission : test if user is data_reporter

has_permission(request, view)

Return True if permission is granted, False otherwise.

class apps.home.views.IsDataSubmitter

API permission : test if user data_submitter

has_permission(request, view)

Return True if permission is granted, False otherwise.

class apps.home.views.IsManager

API permission : test if user is manager

has_permission(request, view)

Return True if permission is granted, False otherwise.

class apps.home.views.IsSuperUser

API permission : test if super_user

has_permission(request, view)

Return True if permission is granted, False otherwise.

class apps.home.views.IsTiersHds

API permission : test if user is tiers_hds

has_permission(request, view)

Return True if permission is granted, False otherwise.

apps.home.views.about_page(request)

Render about template

apps.home.views.df_team_week_report(query, teams_list)

Create a dataframe from a query composed by 3 fields - year_week (concatenation of year and week) - Activity §count of labo_sequenceur__name) - Team name (labo_sequenceur__name)

Paramètres

query (sueryset) –

Renvoie

Data frame of team sequencing activity per week

apps.home.views.edit_content_page(request, pageName)

Render about template

apps.home.views.editorJS_send_file(response, filename)

Send element of editor JS entry

apps.home.views.experiment_delete(request, team_id, experiment_id)

Delete experiment

apps.home.views.experiment_edit(request, team_id, experiment_id)

Edit experiment

apps.home.views.experiment_new(request, team_id)

Create new experiment

apps.home.views.export_team_week_report(request)

Export report by team and week

apps.home.views.home_page(request)

Render index template

apps.home.views.logout(request)

Logout and render index template

apps.home.views.manage_message(request, mode, idMessage=None)

Render edit message template

apps.home.views.meet_us_page(request)

Render meet_us template

apps.home.views.meet_us_send_file(response, filename)

Send meet us photo

apps.home.views.messageContent_page(request, idMessage)

Render message template

apps.home.views.messageUser_archive_page(request, cat_user=None)

Render message archive template

apps.home.views.messageUser_page(request, cat_user=None)

Render message template

apps.home.views.permission_error_page(request)

Render permission error page

apps.home.views.profile(request, test=False)

Render profile template

apps.home.views.str_to_bool(s)

Convert str to bool

apps.home.views.team_page(request)

Render team template

apps.home.views.user_permission_decorator(list_perm)

Checks if a user has at least one of the permissions. Using a list, at least one element of true. Using the wrapper several times with a single element, they should all be true

apps.home.views.user_photo_send_file(response, filename)

Send user photo