• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
平日
博客园    首页    新随笔    联系   管理    订阅  订阅
为OpenEdx中lms注册模块扩展字段

最近遇到需求,需要扩展注册的字段,例如新增手机mobile字段

1、打开register.html文件   路径为\edxapp\edx-platform\lms\templates\register.html

    如下图位置添加手机部分

  

2、找到\edxapp\edx-platform\common\djangoapps\student\views.py中的def _do_create_account

    新增mobile

  

3、在model里增加字段

  打开\edxapp\edx-platform\common\djangoapps\student\models.py  找到class UserProfile(models.Model):新增字段

4、打开配置文件\edxapp\edx-platform\lms\envs\common.py,修改如下图

  

5、因为是新增字段所以python manage.py lms syncdb已经不能用

需要进入到mysql 进行新增字段

mysql> ALTER TABLE auth_userprofile ADD mobile varchar(11);

新增已经成功

进入到lms去注册

提示注册成功

进入后台看看数据是否保存成功

以上就是新增一个字段的完整过程,由于水平有限,错误难免,只给有相同需求的用户提供参考。如有错误请指正!

 

posted on 2014-11-14 11:22  平日  阅读(2160)  评论(1)    收藏  举报
刷新页面返回顶部
博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3