Giter VIP home page Giter VIP logo

Comments (4)

DanielJoyce avatar DanielJoyce commented on May 19, 2024 3

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.

time-less-ness avatar time-less-ness commented on May 19, 2024

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.

time-less-ness avatar time-less-ness commented on May 19, 2024

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.

PieterVeldman avatar PieterVeldman commented on May 19, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.