﻿id	summary	reporter	owner	description	type	status	component	version	severity	resolution	keywords	cc	stage	has_patch	needs_docs	needs_tests	needs_better_patch	easy	ui_ux
18300	Don't repeat yourself?  Are you sure about that?	chris.uzal@…	nobody	"Knowing that my business types would each have a specific discount, I created the following tuple:

BUSINESS_TYPES = (
    ('Ad Agency', 'Ad Agency', 0),    # value, label, open rate discount 
    ('Business Card Display', 'Business Card Display', 0),
    ('Local Business', 'Local Business', 0.5),
    ('Legal Office', 'Legal Office', 0.7),
    ('Classified Display', 'Classified Display', 0.7),
    ('Nonprofit', 'Nonprofit', 0.6),
)

My thinking is that it handles my drop down box and I can use it later to calculate the discount.  

When I go to sync the database. I get:

Error: One or more models did not validate:
contrato.contrato: ""business_type"": ""choices"" should be a sequence of two-tuples.
contrato.contrato: ""business_type"": ""choices"" should be a sequence of two-tuples.
contrato.contrato: ""business_type"": ""choices"" should be a sequence of two-tuples.
contrato.contrato: ""business_type"": ""choices"" should be a sequence of two-tuples.
contrato.contrato: ""business_type"": ""choices"" should be a sequence of two-tuples.
contrato.contrato: ""business_type"": ""choices"" should be a sequence of two-tuples.

W8y? The only concern of the drop down are elements and zero and one.  If I want to create extra spots in the sequence, it should be okay because i am dryer than thou.  :-) 

The problem was solved by using the following:

choices = [(elem[0], elem[1]) for elem in BUSINESS_TYPES]

Changing the way you read the tuple would make it more DRY. 

 




"	Cleanup/optimization	closed	Forms	1.4	Normal	wontfix			Unreviewed	0	0	0	0	0	0
