コード例 #1
0
ファイル: forms.py プロジェクト: rjbernsen/quinnrose
def get_subscription_choices(subtype):

    choices = [('', 'Select...')]

#     print('SUBSCRIPTION_CHOICES[subtype] = {}'.format(SUBSCRIPTION_CHOICES[subtype]))
#     print(SUBSCRIPTIONS.get_choices(subtype))
    for choice in SUBSCRIPTIONS.get_choices(subtype):
        choices.append((choice[0],choice[1]))
            
    return (choices)
コード例 #2
0
ファイル: views.py プロジェクト: rjbernsen/quinnrose
    def _get_features(self, subtype):
        features = [] # To send to the template
        all_features = [] # A holding place

        for s in SUBSCRIPTIONS:
            all_features.append([])
        
        # Get the feature list
        feature_list = SUBSCRIPTIONS.features
#         print(feature_list)
        
        # Get the features for each level. Add each
        # level list to the next level.
        i = -1
        SUBSCRIPTIONS.current_subtype = subtype
#         print('Getting features')
        for s in SUBSCRIPTIONS:

            i += 1
            cur_list = s.features
            
            for j in range(i,SUBSCRIPTIONS.count()):
                all_features[j] += cur_list
#         print(all_features)

        # Add check marks for the compare feature list.
        for i in range(len(feature_list)):
            cur_row = {}
            cur_row['feature'] = feature_list[i]
            
            cur_row['checks'] = []
            
            for j in range(len(all_features)):
                if feature_list[i] in all_features[j]:
                    cur_row['checks'].append('check')
                else:
                    cur_row['checks'].append('')
            features.append(cur_row)
#         print(features)
        return features