Code Monkey home page Code Monkey logo

Comments (12)

fuhrysteve avatar fuhrysteve commented on September 23, 2024

Ha! It appears the culprit is quite recent: #77

from django-tenant-schemas.

bernardopires avatar bernardopires commented on September 23, 2024

What a weird error! Did this start since we moved the signals to __init__.py?
Edit: Just saw your last message confirming it. Well, it's still a weird error. I don't understand why django would complain about this.

I'll take a careful look at this tomorrow if nobody finds a solution until then.

from django-tenant-schemas.

bernardopires avatar bernardopires commented on September 23, 2024

Alright, I tested this locally and it seems to work. Moved the receiver to listeners.py and imported it from models.py instead.

from django-tenant-schemas.

bernardopires avatar bernardopires commented on September 23, 2024

Oh and thanks for noticing so fast that it was broken! :)

from django-tenant-schemas.

fuhrysteve avatar fuhrysteve commented on September 23, 2024

Oh, you beat me to it! I was about to create a pull request with this:

MontmereLimited@20b68e0

I'm not sure which approach is better, but the bottom line is that it appears that you simply have to be careful when you import stuff in your setup.py from your project.

from django-tenant-schemas.

bernardopires avatar bernardopires commented on September 23, 2024

Oh was the whole problem this line from tenant_schemas import __version__? Yeah I think it's a cleaner solution what you did. I'd stil leave the receivers on the new file though, as I think it is a bit more intuitive this way. I don't have the habit to check the __init__.py file. The presence of listeners.py clearly indicates that we have something there.

So I'd take your changes and instead of importing the listeners from models, I'd import them from init.

Thanks so much for the help!

from django-tenant-schemas.

fuhrysteve avatar fuhrysteve commented on September 23, 2024

Ok, I'll rebase and open a pull request....

from django-tenant-schemas.

fuhrysteve avatar fuhrysteve commented on September 23, 2024

#82

from django-tenant-schemas.

kissgyorgy avatar kissgyorgy commented on September 23, 2024

People tend to name files only containing signals signals.py.

from django-tenant-schemas.

bernardopires avatar bernardopires commented on September 23, 2024

Yes walkman, I'm aware of that. Most people name it signals.py instead of listeners.py, however I find the name signals.py a bit misleading, as we're not defining any new signal, we're simply listening to them.

In fact, I've been thinking if we shouldn't simply move the code to the delete method and remove the listener. What do you guys think? The listener came before the method, so at that time we at least had an excuse to have it. But now I can't think of any reason to keep anymore.

from django-tenant-schemas.

fuhrysteve avatar fuhrysteve commented on September 23, 2024

Didn't realize this is still open - but it's resolved last I checked.

from django-tenant-schemas.

kissgyorgy avatar kissgyorgy commented on September 23, 2024

In fact, I've been thinking if we shouldn't simply move the code to the delete method and remove the listener. What do you guys think?

@bernardopires That was my first thought about this feature: #59 (comment)

You lose the benefit of Tenants not being bulk deleted but I don't think that's a big problem, as tenants only get deleted one-by-one. Even if you have to iterate through them, still not a big deal as they probably don't get deleted by hundreds.

So yes, I think moving the deleting code to TenanMixin.delete() would be ideal.

from django-tenant-schemas.

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.