class AssistForm(forms.Form): stats = ( ('strength', 'Strength'), ('dexterity', 'Dexterity'), ('stamina', 'Stamina'), ('charm', 'Charm'), ('command', 'Command'), ('composure', 'Composure'), ('intellect', 'Intellect'), ('perception', 'Perception'), ('wits', 'Wits'), ('mana', 'Mana'), ('luck', 'Luck'), ('willpower', 'Willpower') ) tldr = forms.CharField(widget=forms.Textarea(attrs={'rows': 1, 'class': 'form-control'}), required=True, label='Provide a brief one-sentence summary of this action.') action_text = forms.CharField(widget=forms.Textarea(attrs={'rows': 10, 'class': 'form-control'}), required=True, label='What are you doing in this action?') secret_action = forms.CharField(widget=forms.Textarea(attrs={'rows': 10, 'class': 'form-control'}), required=False, label='What, if anything, are you doing secretly in this action?') ooc_intent = forms.CharField(widget=forms.Textarea(attrs={'rows': 3, 'class': 'form-control'}), required=True, label="What do you want to achieve with this action? This is so we know as GMs what you're hoping for.") stat_choice = forms.ChoiceField(choices=stats, label='Stat to Roll') skill_choice = forms.ChoiceField(choices=[], label='Skill to Roll') attending = forms.BooleanField(label='I am physically present for this action.', required=False) traitor = forms.BooleanField(label='I am trying to sabotage this action.', required=False) def __init__(self, caller, *args, **kwargs): super(AssistForm,self).__init__(*args, **kwargs) skills = [] for k, v in caller.db.skills.iteritems(): skills.append((k, k.capitalize())) self.fields['skill_choice'] = forms.ChoiceField(choices=skills, label='Skill to Roll')
class AssistForm(forms.Form): stats = ( ("strength", "Strength"), ("dexterity", "Dexterity"), ("stamina", "Stamina"), ("charm", "Charm"), ("command", "Command"), ("composure", "Composure"), ("intellect", "Intellect"), ("perception", "Perception"), ("wits", "Wits"), ("mana", "Mana"), ("luck", "Luck"), ("willpower", "Willpower"), ) tldr = forms.CharField( widget=forms.Textarea(attrs={"rows": 1, "class": "form-control"}), required=True, label="Provide a brief one-sentence summary of this action.", ) action_text = forms.CharField( widget=forms.Textarea(attrs={"rows": 10, "class": "form-control"}), required=True, label="What are you doing in this action?", ) secret_action = forms.CharField( widget=forms.Textarea(attrs={"rows": 10, "class": "form-control"}), required=False, label="What, if anything, are you doing secretly in this action?", ) ooc_intent = forms.CharField( widget=forms.Textarea(attrs={"rows": 3, "class": "form-control"}), required=True, label="What do you want to achieve with this action? This is so we know as GMs what you're hoping for.", ) stat_choice = forms.ChoiceField(choices=stats, label="Stat to Roll") skill_choice = forms.ChoiceField(choices=[], label="Skill to Roll") attending = forms.BooleanField( label="I am physically present for this action.", required=False ) traitor = forms.BooleanField( label="I am trying to sabotage this action.", required=False ) def __init__(self, caller, *args, **kwargs): super(AssistForm, self).__init__(*args, **kwargs) skills = [] for k, v in caller.traits.skills: skills.append((k, k.capitalize())) self.fields["skill_choice"] = forms.ChoiceField( choices=skills, label="Skill to Roll" )
def __init__(self, caller, *args, **kwargs): super(AssistForm, self).__init__(*args, **kwargs) skills = [] for k, v in caller.db.skills.iteritems(): skills.append((k, k.capitalize())) self.fields['skill_choice'] = forms.ChoiceField(choices=skills, label='Skill to Roll')
def __init__(self, caller, *args, **kwargs): super(AssistForm, self).__init__(*args, **kwargs) skills = [] for k, v in caller.traits.skills: skills.append((k, k.capitalize())) self.fields["skill_choice"] = forms.ChoiceField( choices=skills, label="Skill to Roll" )
def __init__(self, caller, *args, **kwargs): super(ActionForm,self).__init__(caller, *args, **kwargs) # Do black magic to prepend the Category field keys = self.fields.keys() self.fields['category'] = forms.ChoiceField(choices=self.CATEGORY_CHOICES, label='What type of action is this?') keys.insert(0, 'category') new_fields = (OrderedDict)([k, self.fields[k]] for k in keys) self.fields = new_fields