Saturday Morning Work

So chris’ correct was to use the conditional check on form.groups.choices.  After running the debugger the value form.groups does not exist, but form[“groups”] does. But there is no form.groups.choices.

Spent time in accounts/ to test the value of groups.  Even after continuing past the first preferences page there doesn’t seem to be a value for form.groups when returning to the preferences page even though there are some review groups.  However, there is a value for form[“groups”] but I was unable to determine if there were any ways to find if form[“groups”] could be used to determine the value of choices (if it exists).

Apparently, choices is an option in django that can be added to the MultipleChoiceField (here), available in rb/accounts/ Unfortunately this value takes a list and does not accept a boolean value (which I thought would have set a default value).  Ultimately I don’t think form.groups.choices is a boolean value that can be tested.

Not feeling like I’m getting anywhere or understanding much, so supervisor told me to just go read up on Python for a bit and see if that helps.  During lunch Mike had some time to help me out.  Turns out held the missing key, self.fields[‘groups’].choices.  I read this earlier but thought fields was just a method of accessing the form.groups.  Apparently it actually is filling in the choices to form.fields[‘groups’].choices.  Once we determined that it was easy to make the condition value form.fields.groups.choices, which seems to work fine.

Committed the change to the review board & pushed it up to my git repo. On to the project!


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s