Comments (12)
Ha! It appears the culprit is quite recent: #77
from django-tenant-schemas.
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.
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.
Oh and thanks for noticing so fast that it was broken! :)
from django-tenant-schemas.
Oh, you beat me to it! I was about to create a pull request with this:
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.
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.
Ok, I'll rebase and open a pull request....
from django-tenant-schemas.
from django-tenant-schemas.
People tend to name files only containing signals signals.py
.
from django-tenant-schemas.
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.
Didn't realize this is still open - but it's resolved last I checked.
from django-tenant-schemas.
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)
- Can't migrate new tables to tennant apps.
- New tenant model is not creating relations in non-public schema with multiple databases
- Accessing tenants data from public. HOT 1
- django-tenants TypeError: argument of type 'TenantQueryset' is not iterable
- ImportError: cannot import name 'force_text' from 'django.utils.encoding' HOT 3
- How to create tenant_schemas.storage.TenantFileSystemStorage within AWS s3 bucket with django-storages 1.12.3
- "Apps aren't loaded yet" when upgrading from django 3.0.10 to 3.2
- Schema Deletion HOT 1
- DRF example
- Support for django 4.0 HOT 7
- how to launch tenant_command loaddata from views with fixtures HOT 1
- Supported Version Django HOT 3
- Distinguish between workspaces
- error 500 DEBUG=False in production HOT 1
- [Solution] Unable to create the django_migrations -relation already exists HOT 1
- healthcheck HOT 2
- Issue in holding DB connection consistently HOT 1
- @contextmanager
- Django-tenants - please help
- About changing public schema to other schema. HOT 2
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 django-tenant-schemas.