19 project_id = forms.CharField(max_length=255, widget=forms.widgets.Select()) |
19 project_id = forms.CharField(max_length=255, widget=forms.widgets.Select()) |
20 |
20 |
21 def __init__(self, *args, **kwargs): |
21 def __init__(self, *args, **kwargs): |
22 super(VideoKCRelForm, self).__init__(*args, **kwargs) |
22 super(VideoKCRelForm, self).__init__(*args, **kwargs) |
23 |
23 |
24 url = settings.LDT_API_URL + "contents/?limit=" + str(settings.LDT_MAX_FETCH) |
24 url = settings.LDT_API_URL + "contents/" |
25 contents = get_all_objects(url, 'front_project') |
25 contents = get_all_objects(url, {'limit':settings.LDT_MAX_FETCH}, 'front_project') |
26 self.fields['iri_id'].widget.choices = [(content['iri_id'], content['title']) for content in contents] |
26 self.fields['iri_id'].widget.choices = [(content['iri_id'], content['title']) for content in contents] |
27 |
27 |
28 url = settings.LDT_API_URL + "projects/?state=2&limit=" + str(settings.LDT_MAX_FETCH) |
28 url = settings.LDT_API_URL + "projects/" |
29 projects = get_all_objects(url, None) |
29 projects = get_all_objects(url, {'state': 2, 'limit': settings.LDT_MAX_FETCH}, None) |
30 logger.debug("projects " + repr(projects)) |
30 logger.debug("projects " + repr(projects)) |
31 values = [(None, "-----")] |
31 values = [(None, "-----")] |
32 values.extend([(project['ldt_id'], project['title']) for project in projects]) |
32 values.extend([(project['ldt_id'], project['title']) for project in projects]) |
33 |
33 |
34 self.fields['project_id'].widget.choices = values |
34 self.fields['project_id'].widget.choices = values |