Esempio n. 1
0
    def _parse_admins_as_list_of_usernames(cls, obj):
        """
        Parse admins as a a list of usernames. Each username must be an existing user.

        If all usernames are valid, ``obj.admins`` is cleared, and the
        given admins are added (I.E.: All current admins are replaced).
        """
        if hasattr(obj, 'fake_admins') and obj.fake_admins != None:
            users = _convert_list_of_usernames_to_userobjects(obj.fake_admins)
            obj.admins.clear()
            for user in users:
                obj.admins.add(user)
Esempio n. 2
0
    def _parse_admins_as_list_of_usernames(cls, obj):
        """
        Parse admins as a a list of usernames. Each username must be an existing user.

        If all usernames are valid, ``obj.admins`` is cleared, and the
        given admins are added (I.E.: All current admins are replaced).
        """
        if hasattr(obj, "fake_admins") and obj.fake_admins != None:
            users = _convert_list_of_usernames_to_userobjects(obj.fake_admins)
            obj.admins.clear()
            for user in users:
                obj.admins.add(user)
Esempio n. 3
0
    def _parse_examiners_as_list_of_usernames(cls, obj):
        """
        Parse examiners as a a list of usernames. Each username must be an existing user.

        If all usernames are valid, ``obj.examiners`` is cleared, and the
        given examiners are added (I.E.: All current examiners are replaced).
        """
        if hasattr(obj, 'fake_examiners') and obj.fake_examiners != None:
            users = _convert_list_of_usernames_to_userobjects(obj.fake_examiners)
            for examiner in obj.examiners.all():
                examiner.delete()
            for user in users:
                obj.examiners.create(user=user)