Skip to content

Feature/228 warning user without worker

Carlos Vega requested to merge feature/228_warning_user_without_worker into master

Closed previous merge request !163 (closed) to add more commits. This merge request fixes issues #228 (closed) and #239 (closed). Tests pass.

Change log:

  • Removed get_details method and changed extend_context method to use Worker.get_by_user
  • Enhancement: now the superuser also shows a name in the upper right corner or its username if no full_name is available.

AdminLTE.css: changed CSS stuff to style new class .no_worker_warning _base.html: changed header to show a warning message.

worker.py

    @staticmethod
    def get_details(the_user):
        persons = Worker.objects.filter(user=the_user)

        if len(persons) == 0:
            return the_user.get_full_name(), '<No worker information>'
        else:
            person = persons[0]
            role = "N/A"
            if person.roles.filter(study=GLOBAL_STUDY_ID).count() > 0:
-              role = person.roles.filter(study=GLOBAL_STUDY_ID)[0].get_role_display()
+              role = person.role
            return unicode(person), role

Merge request reports

Loading