def edit_form(self, obj=None): form = super(WatchLiveTaskAdmin, self).edit_form(obj) cids = Channels.all_channels_ids() channels = Channels.get_list(cids) form.channels.choices = [(c.sign, c.channels_name) for c in channels] vids = VersionConfig.all_version_ids() version = VersionConfig.get_list(vids) form.version_code_mix.choices = [(v.version_code, v.version_name) for v in version] form.version_code_max.choices = [(v.version_code, v.version_name) for v in version] pids = Province.all_province_ids() province = Province.get_list(pids) form.province.choices = [(p.code, ''.join((p.name, p.operators))) for p in province] form.group.choices = Group.groups_for_admin() return form
def edit_form(self, obj=None): form = super(UserGroupAdmin, self).edit_form(obj) form.group.choices = Group.groups_for_admin() return form