Comments (9)
from django.template import Library
from django.template.defaulttags import url as default_url, URLNode
from tenant_schemas.utils import clean_tenant_url
register = Library()
class SchemaURLNode(URLNode):
def __init__(self, url_node):
super(SchemaURLNode, self).__init__(url_node.view_name, url_node.args, url_node.kwargs, url_node.asvar, url_node.legacy_view_name)
def render(self, context):
url = super(SchemaURLNode, self).render(context)
return clean_tenant_url(url)
@register.tag
def url(parser, token):
return SchemaURLNode(default_url(parser,token))
from django-tenant-schemas.
Hi acmeguy, thanks for replying to this issue! Would you like to send a patch with your code?
from django-tenant-schemas.
Hi,
Sure I will.
How much work would it be to get Shared Applications working?
Regards,
-Stefan
On Sat, Feb 2, 2013 at 3:10 PM, Bernardo Pires Carneiro <
[email protected]> wrote:
Hi acmeguy, thanks for replying to this issue! Would you like to send a
patch with your code?—
Reply to this email directly or view it on GitHubhttps://github.com//issues/3#issuecomment-13031864.
from django-tenant-schemas.
Thanks!
Well, I don't know how much work it would be because I don't how to implement it. Are you aware of any way to only call syncdb on particular applications or models? That would be the ideal solution and I'd gladly implement it.
A simple non-ideal solution you can do yourself, if you want, is simply adding public
to the search path. But all models would still be synced to all the tenants and thus this would required you deleting tables manually to achieve what you want.
from django-tenant-schemas.
Well, I could live with having the tables in too many places if they would be empty where they are not needed. I need the ability to flag Model tables which should be apart of the schema and leave global Models un-flagged.
from django-tenant-schemas.
The thing is, every time you call sync_schemas, it's going to add all
models to all schemas, including public. If your search path is "tenant,
public", it's always going to search first at "tenant" and then at
"public". If the table is found at "tenant", then it's not going to check
public, and you will have no shared app. So you have to delete the shared
tables from all your tenants, every time you sync the database. This way
it's going to search "tenant", not find the desired table and then it will
find the table at "public". Do you understand what I mean?
2013/2/2 Stefán Baxter [email protected]
Well, I could live with having the tables in too many places if they would
be empty where they are not needed. I need the ability to Model tables
which should be apart of the schema and leave global Models un-flagged.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/3#issuecomment-13033233.
Bernardo Pires Carneiro
from django-tenant-schemas.
Yeah I understand (now). That also means that there is no integrity between schemas, right?, and that is not acceptable. I wish there was a good way to achieve this, it would make my life so much easier.
from django-tenant-schemas.
I moved over to the proper issue (sorry for tainting this one)
from django-tenant-schemas.
What do you mean with integrity between schemas? If we find out how to only
syncdb a particular app/model instead of all apps that would be a life
saver, we wouldn't need to delete tables anymore. Maybe we can write our
own version of syncdb that only syncs a particular app, that shouldn't be
that hard (I think).
2013/2/2 Stefán Baxter [email protected]
Yeah I understand (now). That also means that there is no integrity
between schemas, right?, and that is not acceptable. I wish there was a
good way to achieve this, it would make my life so much easier.—
Reply to this email directly or view it on GitHubhttps://github.com//issues/3#issuecomment-13033425.
Bernardo Pires Carneiro
from django-tenant-schemas.
Related Issues (20)
- weird behaviour using "with schema_context" HOT 3
- 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
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.