Giter Club home page Giter Club logo

Comments (9)

acmeguy avatar acmeguy commented on June 20, 2024

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.

bernardopires avatar bernardopires commented on June 20, 2024

Hi acmeguy, thanks for replying to this issue! Would you like to send a patch with your code?

from django-tenant-schemas.

acmeguy avatar acmeguy commented on June 20, 2024

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.

bernardopires avatar bernardopires commented on June 20, 2024

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.

acmeguy avatar acmeguy commented on June 20, 2024

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.

bernardopires avatar bernardopires commented on June 20, 2024

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.

acmeguy avatar acmeguy commented on June 20, 2024

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.

acmeguy avatar acmeguy commented on June 20, 2024

I moved over to the proper issue (sorry for tainting this one)

from django-tenant-schemas.

bernardopires avatar bernardopires commented on June 20, 2024

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)

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.