voucher model modified
Voucher number follow naming schema: {ND_NUMBER}-{DATE}-{VOUCHER_TYPE_CODE}-{VOUCHER_PARTNER_CODE}-{SEQ_NUMBER}{CHECKSUM}
Single voucher is issued for some hours to be used. These hours can be used in few sessions by corresponding voucher partner.
Closes #211 (closed)
Merge request reports
Activity
assigned to @valentin.groues
- Resolved by Piotr Gawron
85 85 GLOBAL_STUDY_ID = 1 86 86 87 87 VOUCHER_STATUS_NEW = "NEW" 88 VOUCHER_STATUS_IN_USE = "IN_USE" 88 89 VOUCHER_STATUS_USED = "USED" 89 90 VOUCHER_STATUS_EXPIRED = "EXPIRED" 90 91 VOUCHER_STATUS_CHOICES = ( 91 92 (VOUCHER_STATUS_NEW, 'New'), 93 (VOUCHER_STATUS_IN_USE, 'In use'), 92 94 (VOUCHER_STATUS_USED, 'Used'), 93 95 (VOUCHER_STATUS_EXPIRED, 'Expired'), 94 96 ) we use https://github.com/takeflight/django-enumchoicefield for DAISY and we are very happy with it, maybe worth considering a refactoring to replace all the django CHOICES fields
59 59 </div> 60 60 </div><!-- /.box-footer --> 61 61 </form> 62 </div> 62 {% if voucher.id %} 63 <h3 class="box-title">List of voucher partner sessions 64 {% if voucher.status == 'NEW' or voucher.status == 'IN_USE' %} 65 fixed here: 7949ed91
But I don't like it. The syntax for me look wrong. There is no indication that we iterate over a list, and comma inside string as a separator looks simply wrong:
{% if voucher.status in 'NEW,IN_USE' %}
Oh, indeed it’s was not a good suggestion for the template actually. sorry. I didn’t know you cannot use in [‘NEW’ , ‘IN_USE’] in django templates (in flask it’s possible). apparently, it’s possible to use in my_list and to pass the my_list variable as a template context variable. not sure if it’s better though.
Valentin Grouès
Bioinformatics Core Luxembourg Centre For Systems Biomedicine (LCSB)
University of Luxembourg Campus Belval | House of Biomedicine 2 6, avenue du Swing L-4367 Belvaux
T +352 46 66 44 9646 F +352 46 66 44 3 9646 valentin.groues@uni.lu mailto:valentin.groues@uni.lu http://lcsb.uni.lu http://lcsb.uni.lu/
added 1 commit
- 7949ed91 - multiple === operators changed into "in" operator
mentioned in commit e0d00b85
mentioned in merge request !141 (merged)