def moneyiousertype_add(request): if not check_user_login(request): return login(request) user = request.session.get('user') if request.method == 'POST': form = MoneyIOUserTypeForm(data=request.POST, user=user, id=None) if form.is_valid(): name = form.cleaned_data['name'] isio = int(form.cleaned_data['isio']) MoneyService().addMoneyIOUserType(name, isio, user) return HttpResponseRedirect('/moneyiousertype/') else: form = MoneyIOUserTypeForm(user=user, id=None) page_title = ugettext('Add Money Income and Expense Type') pageinfo = PageInfo(page_menu_name='Money', user=user, page_title=page_title) helptext_list = AdminService().getCategoryHelpTextList( 'Money Income and Expense') form_action_url = '/moneyiousertype/add' return render_to_response( 'common_add_edit.html', { 'pageinfo': pageinfo, 'helptext_list': helptext_list, 'form_action_url': form_action_url, 'form': form, 'user': user })
def moneybl_add(request): if not check_user_login(request): return login(request) user = request.session.get('user') if request.method == 'POST': form = MoneyBLForm(data=request.POST, user=user) if form.is_valid(): account = AccountService().getAccount(form.cleaned_data['account'], user) isio = int(form.cleaned_data['isio']) happentime = form.cleaned_data['happentime'] money = form.cleaned_data['money'] currency = AccountService().getCurrency( form.cleaned_data['currency']) description = form.cleaned_data['description'] MoneyService().addMoneyBL(account, isio, happentime, money, currency, description, user) return HttpResponseRedirect('/moneybl/') else: form = MoneyBLForm(user=user) pageinfo = PageInfo(page_menu_name='Money', user=user, page_title=ugettext('Add Money Borrow and Lend')) helptext_list = AdminService().getCategoryHelpTextList( 'Money Income and Expense') form_action_url = '/moneybl/add' return render_to_response( 'common_add_edit.html', { 'pageinfo': pageinfo, 'helptext_list': helptext_list, 'form_action_url': form_action_url, 'form': form, 'user': user })
def add(request): if not check_user_login(request): return login(request) user = request.session.get('user') if request.method == 'POST': form = AccountForm(data=request.POST, user=user, id=None) if form.is_valid(): name = form.cleaned_data['name'] type = AccountService().getAccountType(form.cleaned_data['type']) currency = AccountService().getCurrency( form.cleaned_data['currency']) initmoney = float(form.cleaned_data['initmoney']) description = form.cleaned_data['description'] AccountService().addAccount(name, type, currency, initmoney, description, user) return HttpResponseRedirect('/account/') else: form = AccountForm(user=user, id=None) page_title = ugettext('Add Account') pageinfo = PageInfo(page_menu_name='Account', user=user, page_title=page_title) helptext_list = AdminService().getCategoryHelpTextList('Account') form_action_url = '/account/add/' return render_to_response( 'common_add_edit.html', { 'pageinfo': pageinfo, 'helptext_list': helptext_list, 'form_action_url': form_action_url, 'form': form, 'user': user })
def moneytransfer_edit(request, id): if not check_user_login(request): return login(request) user = request.session.get('user') if request.method == 'POST': form = MoneyTransferForm(data=request.POST, user=user) if form.is_valid(): fromaccount = AccountService().getAccount( form.cleaned_data['fromaccount'], user) toaccount = AccountService().getAccount( form.cleaned_data['toaccount'], user) happentime = form.cleaned_data['happentime'] money = form.cleaned_data['money'] currency = AccountService().getCurrency( form.cleaned_data['currency']) description = form.cleaned_data['description'] MoneyService().editMoneyTransfer(id, fromaccount, toaccount, happentime, money, currency, description, user) return HttpResponseRedirect('/moneytransfer/') else: moneytransfer = MoneyService().getMoneyTransfer(id, user) if moneytransfer: moneytransfer_currency_id = None if moneytransfer.currency: moneytransfer_currency_id = moneytransfer.currency.id moneytransfer_fromaccount_id = None if moneytransfer.fromaccount: moneytransfer_fromaccount_id = moneytransfer.fromaccount.id moneytransfer_toaccount_id = None if moneytransfer.toaccount: moneytransfer_toaccount_id = moneytransfer.toaccount.id form = MoneyTransferForm(initial={ 'fromaccount': moneytransfer_fromaccount_id, 'toaccount': moneytransfer_toaccount_id, 'happentime': moneytransfer.happentime, 'money': moneytransfer.money, 'currency': moneytransfer_currency_id, 'description': moneytransfer.description }, user=user) else: return HttpResponseRedirect('/moneytransfer/') pageinfo = PageInfo(page_menu_name='Money', user=user, page_title=ugettext('Edit Money Transfer')) helptext_list = AdminService().getCategoryHelpTextList( 'Money Income and Expense') form_action_url = '/moneytransfer/edit/' + id return render_to_response( 'common_add_edit.html', { 'pageinfo': pageinfo, 'helptext_list': helptext_list, 'form_action_url': form_action_url, 'form': form, 'user': user })
def add(request): if not check_user_login(request): return login(request) user = request.session.get('user') moneyiousertype_list = MoneyService().getMoneyIOUserTypeList(user) moneyiousertype_count = MoneyService().getMoneyIOUserTypeCount(user) BudgetDetailFormSet = formset_factory(BudgetDetailForm, max_num=moneyiousertype_count) if request.method == 'POST': budgetform = BudgetForm(request.POST) budgetdetailformset = BudgetDetailFormSet(request.POST) if budgetform.is_valid() and budgetdetailformset.is_valid(): name = budgetform.cleaned_data['name'] begindate = budgetform.cleaned_data['begindate'] enddate = budgetform.cleaned_data['enddate'] currency = AccountService().getCurrency( budgetform.cleaned_data['currency']) description = budgetform.cleaned_data['description'] budget = BudgetService().addBudget(name, begindate, enddate, currency, description, user) for budgetdetailform in budgetdetailformset.forms: moneyiousertypeid = budgetdetailform.cleaned_data[ 'moneyiousertypeid'] moneyiousertype = MoneyService().getMoneyIOUserType( moneyiousertypeid, user) money = budgetdetailform.cleaned_data['money'] if money > 0.0: BudgetService().addBudgetDetail(budget, moneyiousertype, money) return HttpResponseRedirect('/budget/') else: budgetform = BudgetForm() formsetinitdata = [{ 'moneyiousertypeid': moneyiousertype.id, 'moneyiousertypename': moneyiousertype.name, 'money': 0.0 } for moneyiousertype in moneyiousertype_list] budgetdetailformset = BudgetDetailFormSet(initial=formsetinitdata) page_title = ugettext('Add Budget') pageinfo = PageInfo(page_menu_name='Budget', user=user, page_title=page_title) helptext_list = AdminService().getCategoryHelpTextList('Budget') form_action_url = '/budget/add/' return render_to_response( 'budget_add_edit.html', { 'helptext_list': helptext_list, 'form_action_url': form_action_url, 'budgetform': budgetform, 'budgetdetailformset': budgetdetailformset, 'user': user, 'pageinfo': pageinfo })
def edit(request, id): if not check_user_login(request): return login(request) user = request.session.get('user') account = AccountService().getAccount(id, user) if account: if account.isclosed: return HttpResponseRedirect('/account/') if request.method == 'POST': form = AccountForm(data=request.POST, id=id, user=user) if form.is_valid(): name = form.cleaned_data['name'] type = AccountService().getAccountType(form.cleaned_data['type']) currency = AccountService().getCurrency( form.cleaned_data['currency']) initmoney = float(form.cleaned_data['initmoney']) description = form.cleaned_data['description'] AccountService().editAccount(id, name, type, currency, initmoney, description, user) return HttpResponseRedirect('/account/') else: if account: account_type_id = None if account.type: account_type_id = account.type.id account_currency_id = None if account.currency: account_currency_id = account.currency.id form = AccountForm(initial={ 'name': account.name, 'type': account_type_id, 'currency': account_currency_id, 'initmoney': account.initmoney, 'description': account.description }, id=id, user=user) else: return HttpResponseRedirect('/account/') page_title = ugettext('Edit Account') helptext_list = AdminService().getCategoryHelpTextList('Account') form_action_url = '/account/edit/' + id page_module = 'Account' return render_to_response( 'common_add_edit.html', { 'page_title': page_title, 'helptext_list': helptext_list, 'form_action_url': form_action_url, 'form': form, 'user': user, 'page_module': page_module })
def setting(request): if not check_user_login(request): return login(request) user = request.session.get('user') if request.method == 'POST': form = UserForm(data=request.POST, id=user.id) if form.is_valid(): name = form.cleaned_data['name'] gender = int(form.cleaned_data['gender']) email = form.cleaned_data['email'] logo = form.cleaned_data['logo'] isreceivemail = form.cleaned_data['isreceivemail'] pagecount = form.cleaned_data['pagecount'] if logo == '': logo = None UserService().editCoolUser(user.id, name, gender, email, logo, isreceivemail, pagecount) else: form = UserForm(initial={ 'name': user.name, 'gender': user.gender, 'logo': user.logo, 'email': user.email, 'isreceivemail': user.isreceivemail, 'pagecount': user.pagecount }, id=user.id) ''' sina_login_url = None if not user.sinaid: sina_login_url = _createSinaLoginUrl(request) ''' google_login_url = None if not user.googleid: google_login_url = _createGoogleLoginUrl(request) user = UserService().getUser(user) request.session['user'] = user page_title = ugettext('Setting') pageinfo = PageInfo(page_menu_name='Setting', user=user, page_title=page_title) helptext_list = AdminService().getCategoryHelpTextList('Setting') form_action_url = '/setting/' return render_to_response( 'user_setting.html', { 'pageinfo': pageinfo, 'form_action_url': form_action_url, 'form': form, 'user': user, 'helptext_list': helptext_list, #'sina_login_url': sina_login_url, 'google_login_url': google_login_url })
def index(request): if not check_user_login(request): return login(request) user = request.session.get('user') pageinfo = PageInfo(page_menu_name='Budget', user=user) helptext_list = AdminService().getCategoryHelpTextList('Budget') return render_to_response('budget.html', { 'user': user, 'pageinfo': pageinfo, 'helptext_list': helptext_list })
def detail(request, id): if not check_user_login(request): return login(request) user = request.session.get('user') pageinfo = PageInfo(page_menu_name='Account', user=user) account = AccountService().getAccount(id, user) helptext_list = AdminService().getCategoryHelpTextList('Account') return render_to_response( 'account_detail.html', { 'account': account, 'user': user, 'pageinfo': pageinfo, 'helptext_list': helptext_list })
def moneytransfer_index(request): if not check_user_login(request): return login(request) user = request.session.get('user') pageinfo = PageInfo(page_menu_name='Money', user=user, page_title=ugettext('Money Transfer')) helptext_list = AdminService().getCategoryHelpTextList( 'Money Income and Expense') return render_to_response('moneytransfer.html', { 'user': user, 'pageinfo': pageinfo, 'helptext_list': helptext_list })
def add(request): if not check_user_login(request): return login(request) user = request.session.get('user') if request.method == 'POST': form = AlarmForm(data=request.POST, user=user, id=None) if form.is_valid(): name = form.cleaned_data['name'] account = AccountService().getAccount(form.cleaned_data['account'], user) begindate = form.cleaned_data['begindate'] enddate = form.cleaned_data['enddate'] cycletype = form.cleaned_data['cycletype'] cyclevalue = form.cleaned_data['cyclevalue'] isautogenmoneyio = form.cleaned_data['isautogenmoneyio'] moneyiousertype = MoneyService().getMoneyIOUserType( form.cleaned_data['moneyiousertype'], user) money = form.cleaned_data['money'] currency = AccountService().getCurrency( form.cleaned_data['currency']) description = form.cleaned_data['description'] AlarmService().addAlarm(name, account, begindate, enddate, cycletype, cyclevalue, isautogenmoneyio, moneyiousertype, money, currency, description, user) return HttpResponseRedirect('/alarm/') else: form = AlarmForm(user=user, id=None) pageinfo = PageInfo(page_menu_name='Alarm', user=user, page_title=ugettext('Add Alarm')) helptext_list = AdminService().getCategoryHelpTextList('Alarm') form_action_url = '/alarm/add/' return render_to_response( 'common_add_edit.html', { 'pageinfo': pageinfo, 'helptext_list': helptext_list, 'form_action_url': form_action_url, 'form': form, 'user': user })
def moneyiousertype_index(request): if not check_user_login(request): return login(request) user = request.session.get('user') page_title = ugettext('Money Income and Expense Type') pageinfo = PageInfo(page_menu_name='Money', user=user, page_title=page_title) helptext_list = AdminService().getCategoryHelpTextList( 'Money Income and Expense') moneyiousertype_list = MoneyService().getMoneyIOUserTypeList(user) return render_to_response( 'moneyiousertype.html', { 'moneyiousertype_list': moneyiousertype_list, 'user': user, 'pageinfo': pageinfo, 'helptext_list': helptext_list, })
def edit(request, id): if not check_user_login(request): return login(request) user = request.session.get('user') if request.method == 'POST': form = ObjectForm(data=request.POST, user=user, id=id) if form.is_valid(): name = form.cleaned_data['name'] finishdate = form.cleaned_data['finishdate'] money = float(form.cleaned_data['money']) currency = AccountService().getCurrency(form.cleaned_data['currency']) accountlist = form.cleaned_data['accountlist'] description = form.cleaned_data['description'] ObjectService().editObject(id, name, finishdate, money, currency, accountlist, description, user) return HttpResponseRedirect('/object/') else: object = ObjectService().getObject(id, user) if object: object_currency_id = None if object.currency: object_currency_id = object.currency.id form = ObjectForm(initial= {'name': object.name, 'finishdate':object.finishdate, 'money':object.money, 'currency':object_currency_id, 'accountlist':object.accountlist, 'description':object.description}, user=user, id=id) else: return HttpResponseRedirect('/object/') page_title=ugettext('Edit Object') pageinfo = PageInfo(page_menu_name='Object', user=user, page_title=page_title) helptext_list = AdminService().getCategoryHelpTextList('Object') form_action_url='/object/edit/' + id return render_to_response('common_add_edit.html', {'pageinfo':pageinfo, 'helptext_list': helptext_list, 'form_action_url': form_action_url, 'form': form, 'user':user })
def detail(request, id): if not check_user_login(request): return login(request) user = request.session.get('user') budget = BudgetService().getBudget(id, user) if budget: page_title = ugettext('Budget Detail') pageinfo = PageInfo(page_menu_name='Budget', user=user, page_title=page_title) helptext_list = AdminService().getCategoryHelpTextList('Budget') return render_to_response( 'budget_detail.html', { 'budget': budget, 'user': user, 'helptext_list': helptext_list, 'pageinfo': pageinfo }) else: return render_to_response('budget_detail.html', {'budget': None})
def index(request): if not check_user_login(request): return login(request) helptext_list = AdminService().getCategoryHelpTextList('Home') user = request.session.get('user', None) pageinfo = PageInfo(page_menu_name='Home', user=user) begindate = datetime.datetime.strptime( common.datetimeutil.get_firstday_month(), '%Y-%m-%d') enddate = datetime.date.today() moneyio_list = MoneyService().getMoneyIOList(None, '-createtime', 5, 1, user)[0] account_list = AccountService().getAccountList(None, '-createtime', 5, 1, user)[0] object_list = ObjectService().getObjectList(None, '-createtime', 5, 1, user)[0] budget_filter_dict = {'begindate >=': begindate, 'begindate <=': enddate} budget_list = BudgetService().getBudgetList(budget_filter_dict, '-begindate', 5, 1, user)[0] errormessage = request.session.get('errormessage', None) request.session['errormessage'] = None return render_to_response( 'index.html', { 'user': user, 'helptext_list': helptext_list, 'pageinfo': pageinfo, 'moneyio_list': moneyio_list, 'account_list': account_list, 'object_list': object_list, 'budget_list': budget_list, 'errormessage': errormessage })
def message_detail(request, id): if not check_user_login(request): return login(request) user = request.session.get('user') message = UserService().getUserMessage(id, user) if message: UserService().updateUserMessageRead(message) page_title = ugettext('Message Detail') pageinfo = PageInfo(page_menu_name='Setting', user=user, page_title=page_title) helptext_list = AdminService().getCategoryHelpTextList('Setting') return render_to_response( 'message_detail.html', { 'message': message, 'user': user, 'helptext_list': helptext_list, 'pageinfo': pageinfo })
def detail(request, id): if not check_user_login(request): return login(request) user = request.session.get('user') object = ObjectService().getObject(id, user) object_list = [] if object: object_list.append(object) page_title = ugettext('Object Detail') pageinfo = PageInfo(page_menu_name='Object', user=user, page_title=page_title) helptext_list = AdminService().getCategoryHelpTextList('Object') account_list = AccountService().getAccountListByIDList(object.accountlist, user) return render_to_response('object_detail.html', {'object': object, 'object_list': object_list, 'user':user, 'pageinfo': pageinfo, 'helptext_list':helptext_list, 'account_list' : account_list }) else: return render_to_response('object_detail.html', {'object': None})
def moneyio_stat_index(request): if not check_user_login(request): return login(request) user = request.session.get('user') page_title = ugettext('Money Income and Expense Statistics') pageinfo = PageInfo(page_menu_name='Money', user=user, page_title=page_title) helptext_list = AdminService().getCategoryHelpTextList( 'Money Income and Expense') year = common.datetimeutil.year month = int(common.datetimeutil.month) yearmonthlist = [(year + '/' + str(i)) for i in range(1, month)] + [year + '/' + str(month)] account_id = '-1' currency_id = '-1' if request.method == 'POST': form = MoneyIOStatSearchForm(data=request.POST, user=user) if form.is_valid(): filter_dict = {} begindate = form.cleaned_data['begindate'] if begindate: filter_dict.update({'happentime >=': begindate}) enddate = form.cleaned_data['enddate'] if enddate: enddate = common.datetimeutil.getdayofday(enddate, 1) filter_dict.update({'happentime <': enddate}) account = AccountService().getAccount(form.cleaned_data['account'], user) if account: filter_dict.update({'account': account}) account_id = account.id currency = AccountService().getCurrency( form.cleaned_data['currency']) if currency: filter_dict.update({'currency': currency}) currency_id = currency.id else: form = MoneyIOStatSearchForm(user=user) try: yearmonth = request.GET['yearmonth'] except: yearmonth = '' if not yearmonth or yearmonth == '': yearmonth = year + '/' + str(month) begindate = datetime.datetime.strptime(yearmonth, '%Y/%m') enddate = common.datetimeutil.datetime_offset_by_month(begindate, 1) filter_dict = {'happentime >=': begindate, 'happentime <': enddate} begindatestr = datetime.datetime.strftime(begindate, '%Y-%m-%d') enddatestr = datetime.datetime.strftime(enddate, '%Y-%m-%d') '''getMoneyStatList will return a money stat list, every currency has one''' moneystat_list = MoneyService().getMoneyStatList(filter_dict, user) return render_to_response( 'moneyiostat.html', { 'yearmonthlist': yearmonthlist, 'form': form, 'moneystat_list': moneystat_list, 'begindate': begindatestr, 'enddate': enddatestr, 'account_id': account_id, 'currency_id': currency_id, 'user': user, 'pageinfo': pageinfo, 'helptext_list': helptext_list })
def moneyio_index(request): if not check_user_login(request): return login(request) user = request.session.get('user') pageinfo = PageInfo(page_menu_name='Money', user=user) helptext_list = AdminService().getCategoryHelpTextList( 'Money Income and Expense') year = common.datetimeutil.year month = int(common.datetimeutil.month) yearmonthlist = [(year + '/' + str(i)) for i in range(1, month)] + [year + '/' + str(month)] if request.method == 'POST': form = MoneyIOSearchForm(data=request.POST, user=user) if form.is_valid(): filter_dict = {} begindate = form.cleaned_data['begindate'] if begindate: filter_dict.update({'happentime >=': begindate}) enddate = form.cleaned_data['enddate'] if enddate: enddate = common.datetimeutil.getdayofday(enddate, 1) filter_dict.update({'happentime <': enddate}) account = AccountService().getAccount(form.cleaned_data['account'], user) if account: filter_dict.update({'account': account}) moneyiotype = MoneyService().getMoneyIOUserType( form.cleaned_data['moneyiotype'], user) if moneyiotype: filter_dict.update({'moneyiotype': moneyiotype}) currency = AccountService().getCurrency( form.cleaned_data['currency']) if currency: filter_dict.update({'currency': currency}) else: form = MoneyIOSearchForm(user=user) try: yearmonth = request.GET['yearmonth'] except: yearmonth = '' if not yearmonth or yearmonth == '': yearmonth = year + '/' + str(month) begindate = datetime.datetime.strptime(yearmonth, '%Y/%m') enddate = common.datetimeutil.datetime_offset_by_month(begindate, 1) filter_dict = {'happentime >=': begindate, 'happentime <': enddate} request.session['moneyio_filter_dict'] = filter_dict return render_to_response( 'moneyio.html', { 'user': user, 'pageinfo': pageinfo, 'helptext_list': helptext_list, 'yearmonthlist': yearmonthlist, 'form': form })
def moneyio_edit(request, id): if not check_user_login(request): return login(request) user = request.session.get('user') if request.method == 'POST': form = MoneyIOForm(data=request.POST, user=user) if form.is_valid(): account = AccountService().getAccount(form.cleaned_data['account'], user) happentime = form.cleaned_data['happentime'] moneyiotype = MoneyService().getMoneyIOUserType( form.cleaned_data['moneyiotype'], user) money = form.cleaned_data['money'] currency = AccountService().getCurrency( form.cleaned_data['currency']) isshare = form.cleaned_data['isshare'] description = form.cleaned_data['description'] MoneyService().editMoneyIO(id, account, happentime, moneyiotype, money, currency, isshare, description, user) return HttpResponseRedirect('/moneyio/') else: moneyio = MoneyService().getMoneyIO(id, user) if moneyio: moneyio_account_id = None if moneyio.account: moneyio_account_id = moneyio.account.id moneyio_moneyiotype_id = None if moneyio.moneyiotype: moneyio_moneyiotype_id = moneyio.moneyiotype.id moneyio_currency_id = None if moneyio.currency: moneyio_currency_id = moneyio.currency.id form = MoneyIOForm(initial={ 'account': moneyio_account_id, 'happentime': moneyio.happentime, 'moneyiotype': moneyio_moneyiotype_id, 'money': moneyio.money, 'currency': moneyio_currency_id, 'isshare': moneyio.isshare, 'description': moneyio.description }, user=user) else: return HttpResponseRedirect('/moneyio/') page_title = ugettext('Edit Money Income and Expense') pageinfo = PageInfo(page_menu_name='Money', user=user, page_title=page_title) helptext_list = AdminService().getCategoryHelpTextList( 'Money Income and Expense') form_action_url = '/moneyio/edit/' + id return render_to_response( 'common_add_edit.html', { 'pageinfo': pageinfo, 'helptext_list': helptext_list, 'form_action_url': form_action_url, 'form': form, 'user': user })
def edit(request, id): if not check_user_login(request): return login(request) user = request.session.get('user') if request.method == 'POST': form = AlarmForm(data=request.POST, user=user, id=id) if form.is_valid(): name = form.cleaned_data['name'] account = AccountService().getAccount(form.cleaned_data['account'], user) begindate = form.cleaned_data['begindate'] enddate = form.cleaned_data['enddate'] cycletype = form.cleaned_data['cycletype'] cyclevalue = form.cleaned_data['cyclevalue'] isautogenmoneyio = form.cleaned_data['isautogenmoneyio'] moneyiousertype = MoneyService().getMoneyIOUserType( form.cleaned_data['moneyiousertype'], user) money = form.cleaned_data['money'] currency = AccountService().getCurrency( form.cleaned_data['currency']) description = form.cleaned_data['description'] AlarmService().editAlarm(id, name, account, begindate, enddate, cycletype, cyclevalue, isautogenmoneyio, moneyiousertype, money, currency, description, user) return HttpResponseRedirect('/alarm/') else: alarm = AlarmService().getAlarm(id, user) if alarm: alarm_account_id = None if alarm.account: alarm_account_id = alarm.account.id alarm_moneyiousertype_id = None if alarm.moneyiousertype: alarm_moneyiousertype_id = alarm.moneyiousertype.id form = AlarmForm(initial={ 'name': alarm.name, 'account': alarm_account_id, 'begindate': alarm.begindate, 'enddate': alarm.enddate, 'cycletype': alarm.cycletype, 'cyclevalue': alarm.cyclevalue, 'isautogenmoneyio': alarm.isautogenmoneyio, 'moneyiousertype': alarm_moneyiousertype_id, 'money': alarm.money, 'currency': alarm.currency.id, 'description': alarm.description, }, user=user, id=id) else: return HttpResponseRedirect('/alarm/') page_title = ugettext('Edit Alarm') helptext_list = AdminService().getCategoryHelpTextList('Alarm') form_action_url = '/alarm/edit/' + id page_module = 'Alarm' return render_to_response( 'common_add_edit.html', { 'page_title': page_title, 'helptext_list': helptext_list, 'form_action_url': form_action_url, 'form': form, 'user': user, 'page_module': page_module })