Changeset dc17b01
- Timestamp:
- Mar 28, 2010, 6:35:41 AM (15 years ago)
- Branches:
- master, client
- Children:
- a75ed9b
- Parents:
- 3111c8a
- git-author:
- Alex Dehnert <adehnert@…> (03/28/10 06:35:41)
- git-committer:
- Alex Dehnert <adehnert@…> (03/28/10 06:35:41)
- Location:
- remit
- Files:
-
- 1 added
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
remit/remit_templates/vouchers/ReimbursementRequest_review.html
re8550be rdc17b01 55 55 </tr> 56 56 <tr> 57 <th>Documentation</th> 58 <td>{{rr.documentation}}</td> 59 </tr> 60 <tr> 57 61 <th>Request Time</th> 58 62 <td>{{rr.request_time}}</td> … … 67 71 </tr> 68 72 </table> 73 74 {% if doc_form %} 75 <h3>(Optional) Upload Documentation</h3> 76 77 <p>If you ordered online, you may wish to upload documentation instead of providing a physical copy.</p> 78 79 <form enctype="multipart/form-data" method="post" action=""> 80 <table class='pretty-table'> 81 {{ doc_form.as_table }} 82 <tr><th colspan='2'><input type='submit' value='Upload Documentation' /></th></tr> 83 </table> 84 </form> 85 {% endif %} 69 86 70 87 {% if new %} -
remit/vouchers/models.py
rc020a3b rdc17b01 31 31 name = models.CharField(max_length=50, verbose_name='short description', ) 32 32 description = models.TextField(blank=True, verbose_name='long description', ) 33 documentation = models.ForeignKey('Documentation', null=True, ) 33 34 34 35 class Meta: … … 92 93 gl = models.IntegerField() 93 94 processed = models.BooleanField() 95 documentation = models.ForeignKey('Documentation', null=True, ) 94 96 95 97 def mailing_addr_lines(self): … … 116 118 ('generate_vouchers', 'Can generate vouchers',), 117 119 ) 120 121 122 class Documentation(models.Model): 123 backing_file = models.FileField(upload_to='documentation', verbose_name='File', help_text='PDF files only', ) 124 label = models.CharField(max_length=50, ) 125 submitter = models.CharField(max_length=10) # MIT username of submitter 126 upload_time = models.DateTimeField(default=datetime.datetime.now) 118 127 119 128 -
remit/vouchers/views.py
r37c15c4 rdc17b01 1 1 import vouchers.models 2 from vouchers.models import ReimbursementRequest 2 from vouchers.models import ReimbursementRequest, Documentation 3 3 from finance_core.models import BudgetTerm, BudgetArea 4 4 … … 52 52 term = ModelChoiceField(queryset = BudgetTerm.objects.all()) 53 53 54 class DocUploadForm(ModelForm): 55 class Meta: 56 model = Documentation 57 fields = ( 58 'label', 59 'backing_file', 60 ) 61 62 54 63 @user_passes_test(lambda u: u.is_authenticated()) 55 64 def select_request_basics(http_request, ): … … 111 120 form.fields['budget_area'] = CommitteeBudgetAreasField(comm_obj) 112 121 form.fields['expense_area'] = ExpenseAreasField() 122 113 123 if form.is_valid(): # All validation rules pass 114 124 request_obj = form.save() … … 165 175 new = False 166 176 177 # DOCUMENTATION # 178 if request_obj.documentation: 179 doc_upload_form = None 180 else: 181 new_docs = Documentation() 182 new_docs.submitter = http_request.user.username 183 if http_request.method == 'POST': # If the form has been submitted... 184 doc_upload_form = DocUploadForm(http_request.POST, http_request.FILES, instance=new_docs) # A form bound to the POST data 185 186 if doc_upload_form.is_valid(): # All validation rules pass 187 new_docs = doc_upload_form.save() 188 189 return HttpResponseRedirect(reverse(review_request, args=[object_id],)) # Redirect after POST 190 else: 191 doc_upload_form = DocUploadForm(instance=new_docs, ) # An unbound form 192 193 # SEND EMAILS 167 194 show_email = http_request.user.has_perm('vouchers.can_email') 168 195 if show_email: … … 181 208 }) 182 209 210 # APPROVE VOUCHERS 183 211 show_approve = (http_request.user.has_perm('vouchers.can_approve') 184 212 and request_obj.approval_status == vouchers.models.APPROVAL_STATE_PENDING) … … 229 257 'pagename':'request_reimbursement', 230 258 'new': new, 259 'doc_form': doc_upload_form, 231 260 } 232 261 if show_approve:
Note: See TracChangeset
for help on using the changeset viewer.