Changeset 570
- Timestamp:
- 08/17/10 12:05:53 (3 years ago)
- Location:
- trunk/opentrials/reviewapp
- Files:
-
- 2 modified
-
forms.py (modified) (4 diffs)
-
templates/reviewapp/new_submission.html (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/opentrials/reviewapp/forms.py
r503 r570 4 4 from opentrials.reviewapp.models import Remark 5 5 from opentrials.reviewapp.models import UserProfile 6 from opentrials.reviewapp.models import Attachment 6 from opentrials.reviewapp.models import Attachment, Submission 7 7 from django import forms 8 8 from django.utils.translation import ugettext as _ … … 18 18 19 19 20 class InitialTrialForm(forms.Form): 20 class InitialTrialForm(ReviewModelForm): 21 class Meta: 22 model = Submission 23 exclude = ['primary_sponsor', 'trial', 'status', 'staff_note', 'title'] 24 21 25 def __init__(self, *args, **kwargs): 22 26 self.user = kwargs.pop('user', None) … … 24 28 if self.user: 25 29 self.fields['language'] = forms.ChoiceField(label=_('Submission language'), 26 choices=settings.MANAGED_LANGUAGES_CHOICES, initial=self.user.get_profile().preferred_language) 30 choices=settings.MANAGED_LANGUAGES_CHOICES, 31 initial=self.user.get_profile().preferred_language) 27 32 28 33 form_title = _('Initial Trial Data') … … 36 41 choices=settings.MANAGED_LANGUAGES_CHOICES) 37 42 38 class PrimarySponsorForm( forms.ModelForm):43 class PrimarySponsorForm(ReviewModelForm): 39 44 class Meta: 40 45 model = Institution -
trunk/opentrials/reviewapp/templates/reviewapp/new_submission.html
r489 r570 1 1 {% extends "base.html" %} 2 2 {% load i18n %} 3 4 {% block extrahead %} 5 <script type="text/javascript"> 6 $(document).ready(function() { 7 $("select[multiple]").asmSelect({ 8 addItemTarget: 'bottom', 9 animate: true, 10 highlight: true, 11 sortable: false 12 }); 13 $('.dataTable th img').cluetip({sticky: true, closePosition: 'title',local:true, cursor: 'pointer'}); 14 }); 15 </script> 16 {% endblock %} 3 17 4 18 {% block stepmenu_top %} … … 11 25 12 26 {% block body %} 13 14 <script type="text/javascript">15 //{# From http://stackoverflow.com/questions/501719/dynamically-adding-a-form-to-a-django-formset-with-ajax#669982 */ #}16 function cloneMore(selector, type) {17 var newElement = $(selector).clone(true);18 var total = $('#id_' + type + '-TOTAL_FORMS').val();19 newElement.find(':input').each(function() {20 var name = $(this).attr('name').replace('-' + (total-1) + '-','-' + total + '-');21 var id = 'id_' + name;22 $(this).attr({'name': name, 'id': id}).val('').removeAttr('checked');23 });24 newElement.find('label').each(function() {25 var newFor = $(this).attr('for').replace('-' + (total-1) + '-','-' + total + '-');26 $(this).attr('for', newFor);27 });28 total++;29 $('#id_' + type + '-TOTAL_FORMS').val(total);30 newElement.css("display","none");31 $(selector).after(newElement);32 newElement.show("fast");33 }34 35 $(document).ready(function() {36 $("input#addmore").click(function(){37 cloneMore('table:last','form');38 });39 $("select[multiple]").asmSelect({40 addItemTarget: 'bottom',41 animate: true,42 highlight: true,43 sortable: false44 });45 });46 </script>47 27 48 28 <form method="post" action="/accounts/newsubmission/" enctype="multipart/form-data">{% csrf_token %}
