Ignore:
Timestamp:
Nov 12, 2011, 3:46:00 AM (14 years ago)
Author:
Alex Dehnert <adehnert@…>
Branches:
master, space-access, stable, stage, test-hooks
Children:
b83db50
Parents:
b928edc
git-author:
Alex Dehnert <adehnert@…> (11/12/11 03:27:37)
git-committer:
Alex Dehnert <adehnert@…> (11/12/11 03:46:00)
Message:

Allow non-Exec to actually edit groups

The StaticWidget? would previously return the model as the value from a
foreign key field. This fails when it tries to get converted. Now, if we're
passed choices, we'll compare their labels against the unicode form of the
value, and see what matches.

Obviously, this means that your values need to unique. OTOH, (a) this is
probably a good idea, and (b) if you don't do this, your admin users, who
actually get to select a value, will have trouble selecting something
reasonable too. Consequently, I don't think I care that much.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • asadb/util/db_form_utils.py

    r9b911db rb63d6b2  
    2626
    2727    def value_from_datadict(self, data, files, name, ):
     28        for choice_value, choice_label in self.choices:
     29            if choice_label == unicode(self.value):
     30                return choice_value
    2831        return self.value
    2932
Note: See TracChangeset for help on using the changeset viewer.