def pgFormChoicesUpdate_ajax(request): """ Given an ajax request with a region and communicator specified, send back the pg form (in html) """ cntry = request.GET['country'] release_id = request.GET['crelid'] release = Release.objects.get(id=release_id) comm_model = request.GET['communicator'] pgs = getPGForGeographyAndCommAndRelease(release, cntry, comm_model) return HttpResponse(json.dumps([{"optionValue":x, "optionDisplay":y} for (x, y) in pgs]))
def __init__(self, case, *args, **kwargs): """Constructor""" super(forms.Form, self).__init__(*args, **kwargs) self.fields['geography'].choices = getGeographyForRelease(case.protocol.release) initGeog = self.fields['geography'].choices[0][0] self.fields['country'].choices = getCountryForGeography(case.protocol.release, initGeog) initCountry = self.fields['country'].choices[0][0] self.fields['communicator'].choices = getCommForGeographyAndRelease(case.protocol.release, initCountry) initComm = self.fields['communicator'].choices[0][0] self.fields['pg_model'].choices = getPGForGeographyAndCommAndRelease(case.protocol.release, initCountry, initComm) self.fields['browser'].choices = BROWSER_OPTIONS self.fields['owner'].choices = getOwnerUsers(team=None) self.fields['owner'].initial = case.owner self.fields['planned_for'].choices = getPlannedForChoices(case.protocol.release) self.fields['country_ignore'].initial = True
def __init__(self, release, geog_str, comm_model, *args, **kwargs): """Constructor""" super(forms.Form, self).__init__(*args, **kwargs) self.fields['pg_model'].choices = getPGForGeographyAndCommAndRelease(release, geog_str, comm_model)