That is a very interesting question.

I presume that you will not be doing this dynamically as a user logs on.

If that is the case, why don't you let django answer the question for you.

Create a database with the several different schemas and follow the 
instructions to let django create your model.

https://docs.djangoproject.com/en/dev/howto/legacy-databases/?from=olddocs

python manage.py inspectdb

Save this as a file by using standard Unix output redirection:

python manage.py inspectdb > models.py


I will try this myself to see if it works.


On Thursday, March 8, 2012 6:10:36 PM UTC-5, Moisés P. Sena wrote:
>
> Good night!
>
> I need to create the "DDL" a model in several DB schemas, not only in the 
> "public". The names of these schemas is "username" user logged.
>
> I'm using PostgreSQL.
>
> My model:
>
> class Empresa(models.Model):
>     '''
>     classdocs
>     '''
>     cnpj = models.CharField(max_length=14, blank=False, null=False, 
> unique=True,help_text=_("Required. 14 caracterss. Some numbers."))
>     nome = models.CharField(max_length=255, blank=False, null=False)
>     uf = models.ForeignKey(Uf, on_delete=models.PROTECT, blank=False, 
> null=False)
>
>     def __unicode__(self):
>         return self.nome + " (" + self.cnpj + ")"
>
> Thanks,
>
> {}'
>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/ylZWHoGyeYoJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to