|
1
|
1 |
from django import forms |
|
2
|
2 |
#from models import Project, Content, Media |
|
|
3 |
from models import Annotation |
|
1
|
4 |
import uuid |
|
|
5 |
from utils import generate_uuid |
|
|
6 |
from django.forms.widgets import Widget, RadioSelect |
|
|
7 |
from django.contrib.admin import widgets as admin_widgets |
|
|
8 |
from django.core.urlresolvers import reverse |
|
|
9 |
from ldt.settings import BASE_URL |
|
|
10 |
from ldt.forms import widgets as ldt_widgets |
|
|
11 |
from django.utils.translation import ugettext_lazy as _ |
|
|
12 |
|
|
2
|
13 |
#class LdtImportForm(forms.Form): |
|
|
14 |
# importFile = forms.FileField() |
|
|
15 |
# videoPath = forms.CharField(required=False) |
|
|
16 |
# flatten = forms.BooleanField(required=False, initial=True) |
|
|
17 |
# |
|
|
18 |
#class LdtAddForm(forms.ModelForm): |
|
|
19 |
# title = forms.CharField() |
|
|
20 |
# contents = forms.ModelMultipleChoiceField(Content.objects.all()) |
|
|
21 |
# owner = forms.ModelChoiceField(Author.objects.all()) |
|
|
22 |
# class Meta: |
|
|
23 |
# model = Annotation |
|
|
24 |
# exclude = ("ldt_id", "ldt", "created_by", "changed_by", "creation_date", "modification_date", "state", "owner") |
|
|
25 |
# |
|
|
26 |
#class ReindexForm(forms.Form): |
|
|
27 |
# contents = forms.ModelMultipleChoiceField(Content.objects.all()) |
|
|
28 |
# |
|
|
29 |
#class SearchForm(forms.Form): |
|
|
30 |
# search = forms.CharField() |
|
|
31 |
# field = forms.ChoiceField([(u"all", u"all"), (u"title", u"title"), (u"abstract", u"resume"), (u"tags", u"tags")]) |
|
|
32 |
# |
|
|
33 |
#class AddProjectForm (forms.Form): |
|
|
34 |
# title = forms.CharField(widget=forms.TextInput(attrs={'class':'inputbox required'})) |
|
|
35 |
# |
|
|
36 |
#class CopyProjectForm (forms.Form): |
|
|
37 |
# title = forms.CharField() |
|
|
38 |
# |
|
|
39 |
# |
|
|
40 |
#class ContentForm(forms.ModelForm): |
|
|
41 |
# |
|
|
42 |
# #iri_id = forms.CharField(max_length=1024, widget=forms.HiddenInput, initial=generate_uuid) |
|
|
43 |
# iriurl = forms.CharField(max_length=1024, widget=forms.HiddenInput, required=False) |
|
|
44 |
# content_creation_date = forms.SplitDateTimeField(widget=ldt_widgets.LdtSplitDateTime, required=False, label=_("content.content_creation_date")) |
|
|
45 |
# media_input_type = forms.ChoiceField(required=False, label=_("content.media_input_type"), choices=(("upload",_("file_upload")),("url",_("url")),("link",_("existing_media")),("create",_("create_media")),("none",_("none_media")) )) |
|
|
46 |
# |
|
|
47 |
# def clean_iri_id(self): |
|
|
48 |
# data = self.cleaned_data.get('iri_id') |
|
|
49 |
# if not data: |
|
|
50 |
# data = generate_uuid() |
|
|
51 |
# return data |
|
|
52 |
# |
|
|
53 |
# def clean(self): |
|
|
54 |
# cleaned_data = self.cleaned_data |
|
|
55 |
# iriurl_data = cleaned_data.get('iriurl') |
|
|
56 |
# iri_id_data = cleaned_data['iri_id'] |
|
|
57 |
# if not iriurl_data: |
|
|
58 |
# iriurl_data = "%s/%s.iri" % (iri_id_data, iri_id_data) |
|
|
59 |
# cleaned_data['iriurl'] = iriurl_data |
|
|
60 |
# return cleaned_data |
|
|
61 |
# |
|
|
62 |
# class Meta: |
|
|
63 |
# model = Content |
|
|
64 |
# exclude = ("creation_date", "update_date", "authors") |
|
|
65 |
# widgets = { |
|
|
66 |
# 'iri_id': forms.HiddenInput, |
|
|
67 |
# } |
|
|
68 |
# |
|
|
69 |
# class Media: |
|
|
70 |
# css = { |
|
|
71 |
# 'all' : ('admin/css/forms.css','admin/css/base.css', 'admin/css/widgets.css') |
|
|
72 |
# } |
|
|
73 |
# |
|
|
74 |
#class MediaForm(forms.ModelForm): |
|
|
75 |
# |
|
|
76 |
# media_creation_date = forms.SplitDateTimeField(widget=ldt_widgets.LdtSplitDateTime, required=False) |
|
|
77 |
# media_file = forms.FileField(required=False); |
|
|
78 |
# src = forms.CharField(required=False, max_length=1024) |
|
|
79 |
# |
|
|
80 |
# class Meta: |
|
|
81 |
# model = Media |
|
|
82 |
# exclude = ("creation_date", "update_date", "creator") |
|
|
83 |
# |
|
|
84 |
# class Media: |
|
|
85 |
# css = { |
|
|
86 |
# 'all' : ('admin/css/forms.css','admin/css/base.css', 'admin/css/widgets.css') |
|
|
87 |
# } |