25 |
25 |
26 |
26 |
27 from google.appengine.api import users |
27 from google.appengine.api import users |
28 |
28 |
29 from django import forms |
29 from django import forms |
30 from django.utils.translation import ugettext_lazy |
|
31 |
30 |
32 from soc.logic import dicts |
31 from soc.logic import dicts |
33 from soc.logic import validate |
32 from soc.logic import validate |
34 from soc.views import helper |
33 from soc.views import helper |
35 from soc.views.helper import widgets |
|
36 from soc.views.models import base |
34 from soc.views.models import base |
37 |
35 |
38 import soc.models.document |
36 import soc.models.document |
39 import soc.logic.models.document |
37 import soc.logic.models.document |
40 import soc.logic.dicts |
38 import soc.logic.dicts |
41 import soc.views.helper |
39 import soc.views.helper |
42 import soc.views.helper.widgets |
40 import soc.views.helper.widgets |
|
41 |
43 |
42 |
44 class CreateForm(helper.forms.BaseForm): |
43 class CreateForm(helper.forms.BaseForm): |
45 """Django form displayed when Developer creates a Document. |
44 """Django form displayed when Developer creates a Document. |
46 """ |
45 """ |
47 |
46 |
48 content = forms.fields.CharField(widget=helper.widgets.TinyMCE( |
47 content = forms.fields.CharField(widget=helper.widgets.TinyMCE( |
49 attrs={'rows':10, 'cols':40})) |
48 attrs={'rows':10, 'cols':40})) |
50 |
49 |
51 class Meta: |
50 class Meta: |
|
51 """Inner Meta class that defines some behavior for the form. |
|
52 """ |
52 model = soc.models.document.Document |
53 model = soc.models.document.Document |
53 |
54 |
54 #: list of model fields which will *not* be gathered by the form |
55 #: list of model fields which will *not* be gathered by the form |
55 exclude = ['author', 'created', 'modified_by', 'modified', 'scope'] |
56 exclude = ['author', 'created', 'modified_by', 'modified', 'scope'] |
56 |
57 |
74 """ |
75 """ |
75 |
76 |
76 doc_key_name = forms.fields.CharField(widget=forms.HiddenInput) |
77 doc_key_name = forms.fields.CharField(widget=forms.HiddenInput) |
77 created_by = forms.fields.CharField(widget=helper.widgets.ReadOnlyInput(), |
78 created_by = forms.fields.CharField(widget=helper.widgets.ReadOnlyInput(), |
78 required=False) |
79 required=False) |
79 last_modified_by = forms.fields.CharField(widget=helper.widgets.ReadOnlyInput(), |
80 last_modified_by = forms.fields.CharField( |
80 required=False) |
81 widget=helper.widgets.ReadOnlyInput(), required=False) |
81 |
82 |
82 |
83 |
83 class View(base.View): |
84 class View(base.View): |
84 """View methods for the Document model. |
85 """View methods for the Document model. |
85 """ |
86 """ |