# -*- coding: utf-8 -*-
'''
Created on Nov 14, 2012
@author: ymh
'''
from . import settings
from .models import VideoKCRel
from .utils import get_all_objects
from django import forms
import logging
logger = logging.getLogger(__name__)
class VideoKCRelForm(forms.ModelForm):
iri_id = forms.CharField(max_length=255, widget=forms.widgets.Select())
def __init__(self, *args, **kwargs):
super(VideoKCRelForm, self).__init__(*args, **kwargs)
url = settings.LDT_API_URL + "contents/?limit=" + str(settings.LDT_MAX_FETCH)
contents = get_all_objects(url, 'front_project')
self.fields['iri_id'].widget.choices = [(content['iri_id'], content['title']) for content in contents]
class Meta:
model = VideoKCRel