Comments (4)
Still doesn't tell us where to put models.py, or how to get sandman2ctl to load and use it. This bug is still valid.
from sandman2.
I modified the models.py
that was included with the pip
package and put the classes at the bottom. But when I do, the top-level table disappears from the list of tables.
All the existing data looks nice, and the foreign key references do what they should, at the expense of no longer being able to query the table itself anymore.
I tried putting the Class extensions into /usr/local/bin/sandman2ctl
as well, which worked precisely the same way.
from sandman2.
It occurs to me that FK-referenced tables are meant to be static within the view of Sandman2's admin interface. So in order to fix my problem above, I run two instances of Sandman2, one with my FK-referenced tables without any Class extension, so that I can edit those tables, and another with them, so that I can edit the relationships sensibly.
It seems weird, but it does work.
from sandman2.
Hi,
@abegong, I had a similar problem because I used to get "<sandman2.models.Employee object at ...>" in foreign keys in the admin view. Found out that I had to overwrite the str method instead of unicode method in models.py. I don't know why it is so, I just made a lucky guess that turned out to be correct.
As in your case, it didn't solve the issue right away. I had to modify run.py in order to list the tables.
run.py
app = get_app('sqlite+pysqlite:///tests/data/db.sqlite3', user_models=[ Artist, Album,Customer, Employee, Genre, Invoice, InvoiceLine, MediaType, Playlist, Track])
instead of
#app = get_app('sqlite+pysqlite:///tests/data/db.sqlite3')
In models.py , I addedd the str_ method.
models.py
...
class Genre(AutomapModel):
"""A music genre."""
__tablename__ = 'Genre'
def __unicode__(self):
return self.Name
__str__ = __unicode__
...
Maybe this will work for you, @philovivero.
Thanks @jeffknupp for this great tool.
from sandman2.
Related Issues (20)
- indentation error in __main__.py", line 61
- Error creating backref HOT 1
- No module named 'sandman2.api'
- Errors generated by table names containing spaces; unable to start sandman2ctl HOT 1
- Seems like `exclude_tables` not working in call to get_app
- YOUR WEBSITE IS DOWN!
- AWS ECS
- How to use this with ForeignKey table
- howto apply sqlalchemy 1.4.15 HOT 1
- Where is the package?
- AWS ECS - Deploy as a lambda container image
- Is it possible to serialize the models/code that sandman2 generates?
- how to find a datetime value?
- ValueError: The name 'admin' is already registered for a different blueprint. Use 'name=' to provide a unique name.
- Sandman Error for composite primary keys
- Is it possible to get access to stored procedures and functions?
- 'LocalStack' object has no attribute '__ident_func__' error on launch HOT 2
- About MS SQL HOT 1
- Support linking via foreign indices
- Generate swagger document for exposed REST API
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sandman2.