Example #1
0
 def _build_service_url(self, language, request, students, ordinal_number, url_name, submission_url):
     """
     Generates complete URL with added parameters to the exercise service.
     """
     uid_str = '-'.join(sorted(str(profile.user.id) for profile in students)) if students else ''
     auri = (
         settings.OVERRIDE_SUBMISSION_HOST + submission_url
         if settings.OVERRIDE_SUBMISSION_HOST
         else request.build_absolute_uri(submission_url)
     )
     return update_url_params(pick_localized(self.service_url, language), {
         "max_points": self.max_points,
         "max_submissions": self.max_submissions,
         "submission_url": auri,
         "post_url": request.build_absolute_uri(str(self.get_url(url_name))),
         "uid": uid_str,
         "ordinal_number": ordinal_number,
         "lang": language,
     })
Example #2
0
def parse_localization(entry):
    return pick_localized(entry, get_language())
Example #3
0
 def get_templates(self):
     entries = pick_localized(self.templates, get_language())
     return [(url,url.split('/')[-1]) for url in entries.split()]
Example #4
0
 def get_load_url(self, language, request, students, url_name="exercise"):
     return update_url_params(pick_localized(self.service_url, language), {
         'lang': language,
     })
Example #5
0
 def get_models(self):
     entries = pick_localized(self.model_answers, get_language())
     return [(url,url.split('/')[-1]) for url in entries.split()]
Example #6
0
def parse_localization(entry):
    return pick_localized(entry, get_language())
Example #7
0
 def get_templates(self):
     entries = pick_localized(self.templates, get_language())
     return [(url, url.split('/')[-1]) for url in entries.split()]
Example #8
0
 def get_models(self):
     entries = pick_localized(self.model_answers, get_language())
     return [(url, url.split('/')[-1]) for url in entries.split()]
Example #9
0
 def get_service_url(self, language):
     return pick_localized(self.service_url, language)
Example #10
0
 def get_load_url(self, language, request, students, url_name="exercise"):
     return update_url_params(pick_localized(self.service_url, language), {
         'lang': language,
     })