Dear developers,
I'm using auth.register() to sign users up to a website but I am getting an
error on the modified_by field in the auth_user table.
modified_by isn't included in auth.register() and I can't pre populate the
field.
*Controller:*
def user():
form = auth()
form.vars.modified_by = 3
form.vars.created_by = 3
return locals()
*View:*
<div class="reg_form" style="top: 15px;">
{{if purchase_referral:}}Please login to purchase products. Not
registered? <a href="../register.html">Register here.</a><br><br>{{pass}}
<div id="web2py_user_form">
{{=form}}
{{if request.args(0)=='login':}}
{{if not 'register' in auth.settings.actions_disabled:}}
<br/><a href="{{=URL(args='register')}}">register</a>
{{pass}}
{{if not 'request_reset_password' in
auth.settings.actions_disabled:}}
<br/>
<a href="{{=URL(args='request_reset_password')}}">lost
password</a>
{{pass}}
{{pass}}
</div>
</div>
*Error:*
Error ticket for "maiafranceschi"Ticket ID
176.25.239.122.2018-09-24.21-37-01.cb4a0f47-f680-4146-bdf3-04ae996caf77
<class '_mysql_exceptions.OperationalError'> (1048, "Column 'modified_by'
cannot be null")Version
web2py™ Version 2.14.6-stable+timestamp.2016.05.10.00.21.47
Python Python 2.7.6: /usr/local/bin/uwsgi (prefix: /usr)Traceback
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
Traceback (most recent call last):
File "/home/dmjbdevelopers/mf_web2py/gluon/restricted.py", line 227, in
restricted
exec ccode in environment
File
"/home/dmjbdevelopers/mf_web2py/applications/maiafranceschi/controllers/default.py"
<https://dmjbdevelopers.pythonanywhere.com/admin/default/edit/maiafranceschi/controllers/default.py>,
line 378, in <module>
File "/home/dmjbdevelopers/mf_web2py/gluon/globals.py", line 417, in <lambda>
self._caller = lambda f: f()
File
"/home/dmjbdevelopers/mf_web2py/applications/maiafranceschi/controllers/default.py"
<https://dmjbdevelopers.pythonanywhere.com/admin/default/edit/maiafranceschi/controllers/default.py>,
line 326, in user
form = auth()
File "/home/dmjbdevelopers/mf_web2py/gluon/tools.py", line 1941, in __call__
return getattr(self, args[0])()
File "/home/dmjbdevelopers/mf_web2py/gluon/tools.py", line 3351, in register
hideerror=self.settings.hideerror):
File "/home/dmjbdevelopers/mf_web2py/gluon/sqlhtml.py", line 1746, in accepts
self.vars.id = self.table.insert(**fields)
File "/home/dmjbdevelopers/mf_web2py/gluon/packages/dal/pydal/objects.py",
line 726, in insert
ret = self._db._adapter.insert(self, self._listify(fields))
File
"/home/dmjbdevelopers/mf_web2py/gluon/packages/dal/pydal/adapters/base.py",
line 746, in insert
raise e
OperationalError: (1048, "Column 'modified_by' cannot be null")
*Thank you for your help!*
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.