def cateappadmin_factory(class_s, category_name, model=CategoryAppAdmin): class_attrs = { 'cate_name': category_name, '__module__': __name__, } class_name = '%s%s' % (model.__name__, class_s) return forms.MediaDefiningClass(class_name, (model,), class_attrs)
def applistitemadmin_factory(class_s, app_list, model=AppListItemAdmin): class_attrs = { 'app_list': app_list, '__module__': __name__, } class_name = '%s%s' % (model.__name__, class_s) return forms.MediaDefiningClass(class_name, (model, ), class_attrs)
def banneradmin_factory(area, cate_name=None, recommend_type=None, model=TopAreaBannerAdmin): class_attrs = { 'area': area, 'cate_name': cate_name, 'recommend_type': recommend_type, '__module__': __name__, } class_name = '%s%s' % (model.__name__, get_category(cate_name, only_id=True) \ if area == BANNER_IMAGE_AREAS.TOP else recommend_type) return forms.MediaDefiningClass(class_name, (model, ), class_attrs)