models/db.py", line 62, in <module>
class Poll(Model):
File "applications\try_django_polls\modules\django.py", line 145, in __new__
fields=[db.Field(key,**value.serial(name,db)) for key,value in attrs.items() if hasattr(value,'serial') and not isinstance(value,ManyToManyField)]
File "...\Desktop\web2py_src\web2py\gluon\dal\base.py", line 893, in __getattr__
return ogetattr(self, key)
The example is very old and too many changes neede.
Even after the deprecated fixes , DjangoModelFactory not working anymore
it have this error:
Traceback (most recent call last):
File "/home/v3ss/workspace/web2py/gluon/restricted.py", line 224, in restricted
exec ccode in environment
File "applications/otwopy/models/db.py", line 91, in <module>
class Poll(Model):
File "applications/otwopy/modules/django.py", line 229, in __new__
table = db.define_table(name, migrate=migrate, *fields)
File "/home/v3ss/workspace/web2py/gluon/dal/base.py", line 787, in define_table
table = self.lazy_define_table(tablename,*fields,**args)
File "/home/v3ss/workspace/web2py/gluon/dal/base.py", line 804, in lazy_define_table
table = table_class(self, tablename, *fields, **args)
File "/home/v3ss/workspace/web2py/gluon/dal/objects.py", line 327, in __init__
'define_table argument is not a Field or Table: %s' % field)
SyntaxError: define_table argument is not a Field or Table: <no table>.name
.
On Sat, Mar 28, 2015 at 3:26 AM, Ron Chatterjee achatte...@gmail.com wrote:
This is an old web2py blog.
http://www.web2py.com/AlterEgo/default/show/189
Did anyone went through the steps and was able to generate the tables? I
tried but it failed. It didn’t work. Is it only valid for polls example only
or any django models can be used in web2py this way? Not sure.I know its not a recommended and I will never deploy an application using
this method. But wanted to try few django projects and code them up in
web2py to learn more but I am and kind of feeling lazy to write the table
from scratch. thought copy and paste will be nice if I can get this method
to work. Any web2pier wants to try and see what I am doing wrong?I get an error saying:
models/db.py”, line 62, in
class Poll(Model):
File “applications\trydjangopolls\modules\django.py”, line 145, in
new
fields=[db.Field(key,**value.serial(name,db)) for key,value in
attrs.items() if hasattr(value,’serial’) and not
isinstance(value,ManyToManyField)]
File “…\Desktop\web2py_src\web2py\gluon\dal\base.py”, line 893, in
__getattr
return ogetattr(self, key)AttributeError: ‘DAL’ object has no attribute ‘Field’
—
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 web2py+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
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)
---
--
python manage.py inspectdb > models.py
Which will generate models.py. Then someone can synch the db
and create the app.
Here is the link:
https://docs.djangoproject.com/en/1.7/howto/legacy-databases/